{"id":1436,"date":"2018-11-14T14:09:50","date_gmt":"2018-11-14T13:09:50","guid":{"rendered":"https:\/\/rosetta.vn\/short\/?p=1436"},"modified":"2018-11-14T14:09:50","modified_gmt":"2018-11-14T13:09:50","slug":"editorconfig","status":"publish","type":"post","link":"https:\/\/rosetta.vn\/short\/2018\/11\/14\/editorconfig\/","title":{"rendered":"EditorConfig"},"content":{"rendered":"<blockquote>\n<section>\n<h2 id=\"overview\">What is EditorConfig?<\/h2>\n<p>EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of\u00a0<strong>a file format<\/strong>\u00a0for defining coding styles and a collection of\u00a0<strong>text editor plugins<\/strong>\u00a0that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.<\/p>\n<\/section>\n<section id=\"file-format\">\n<h2>What&#8217;s an EditorConfig file look like?<\/h2>\n<section id=\"example-file\">\n<h3>Example file<\/h3>\n<p>Below is an example\u00a0<code>.editorconfig<\/code>\u00a0file setting end-of-line and indentation styles for Python and JavaScript files.<\/p>\n<div class=\"code-container\">\n<figure class=\"highlight\">\n<pre><code class=\"language-ini\"><span class=\"c\"># EditorConfig is awesome: https:\/\/EditorConfig.org\r\n<\/span>\r\n<span class=\"c\"># top-most EditorConfig file\r\n<\/span><span class=\"py\">root<\/span> <span class=\"p\">=<\/span> <span class=\"s\">true<\/span>\r\n\r\n<span class=\"c\"># Unix-style newlines with a newline ending every file\r\n<\/span><span class=\"nn\">[*]<\/span>\r\n<span class=\"py\">end_of_line<\/span> <span class=\"p\">=<\/span> <span class=\"s\">lf<\/span>\r\n<span class=\"py\">insert_final_newline<\/span> <span class=\"p\">=<\/span> <span class=\"s\">true<\/span>\r\n\r\n<span class=\"c\"># Matches multiple files with brace expansion notation\r\n# Set default charset\r\n<\/span><span class=\"nn\">[*.{js,py}]<\/span>\r\n<span class=\"py\">charset<\/span> <span class=\"p\">=<\/span> <span class=\"s\">utf-8<\/span>\r\n\r\n<span class=\"c\"># 4 space indentation\r\n<\/span><span class=\"nn\">[*.py]<\/span>\r\n<span class=\"py\">indent_style<\/span> <span class=\"p\">=<\/span> <span class=\"s\">space<\/span>\r\n<span class=\"py\">indent_size<\/span> <span class=\"p\">=<\/span> <span class=\"s\">4<\/span>\r\n\r\n<span class=\"c\"># Tab indentation (no size specified)\r\n<\/span><span class=\"nn\">[Makefile]<\/span>\r\n<span class=\"py\">indent_style<\/span> <span class=\"p\">=<\/span> <span class=\"s\">tab<\/span>\r\n\r\n<span class=\"c\"># Indentation override for all JS under lib directory\r\n<\/span><span class=\"nn\">[lib\/**.js]<\/span>\r\n<span class=\"py\">indent_style<\/span> <span class=\"p\">=<\/span> <span class=\"s\">space<\/span>\r\n<span class=\"py\">indent_size<\/span> <span class=\"p\">=<\/span> <span class=\"s\">2<\/span>\r\n\r\n<span class=\"c\"># Matches the exact files either package.json or .travis.yml\r\n<\/span><span class=\"nn\">[{package.json,.travis.yml}]<\/span>\r\n<span class=\"py\">indent_style<\/span> <span class=\"p\">=<\/span> <span class=\"s\">space<\/span>\r\n<span class=\"py\">indent_size<\/span> <span class=\"p\">=<\/span> <span class=\"s\">2<\/span><\/code><\/pre>\n<\/figure>\n<\/div>\n<\/section>\n<\/section>\n<\/blockquote>\n<p>Source: <em><a href=\"https:\/\/editorconfig.org\/\">EditorConfig.org<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is EditorConfig? EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of\u00a0a file format\u00a0for defining coding styles and a collection of\u00a0text editor plugins\u00a0that enable editors to read the file format<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[30,215],"tags":[989,511,47,224],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p8jhJx-na","_links":{"self":[{"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/posts\/1436"}],"collection":[{"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/comments?post=1436"}],"version-history":[{"count":1,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/posts\/1436\/revisions"}],"predecessor-version":[{"id":1437,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/posts\/1436\/revisions\/1437"}],"wp:attachment":[{"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/media?parent=1436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/categories?post=1436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rosetta.vn\/short\/wp-json\/wp\/v2\/tags?post=1436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}