EditorConfig helps developer to define and maintain the coding styles between vastly different editors and IDE for Python and Javascript file.

Your IDE should have its plugin first. For instace, for PHPStorm you go to the Setting options ( Ctrl-Alt-S ) and then on the left hand side we choose plugin. Next you may want to browse the plugin for editorconfig and install it ( Note that when you type in the name of the plugin, it doesn't show up. Don't worry, press browse and type in again then install it )

Then create .editorconfig file at the root of the project. In Windows though, you should name the file to be .editorconfig. for window explore to change that back to .editorconfig

About the code convention in editor config, please access to editorconfig wiki page to see the full list. Here is an example:

If you still wonder how a .editorconfig file is constructed, take this as an example

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
charset = utf-8

# 4 space indentation
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
indent_style = tab

# Indentation override for all JS under lib directory
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
indent_style = space
indent_size = 2
If you liked this article

Let's subscribe the updates of Scuti!
Share on Google Plus

About Pham Tuan Anh

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment