What is it good for?
EditorConfig helps developers define and maintain consistent encoding styles between different publishers and IDEs. This means that no matter which editor you use, you and your team simply use the plugin to make the code consistent.
How is it used?
On the official website in the Downloads section you can download the plugin for various code editors. The first step is to download and install the plugin. To use the plugin, just create a .editorconfig
file at the root of your project and adjust the settings according to your preference.
I leave here the settings that I use in almost all my projects.
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[* .md]
max_line_length = off
trim_trailing_whitespace = false
What advantages do I gain by using it?
Developers choose to use different code editors, and each of these editors has its own settings for setting file patterns.
A very simple example of these patterns would be: align code using spaces or tabs . Only this pattern already generates a discussion of 01 month between developers of the same project.
Imagine a developer who likes to use 04 spaces to align his code and another who likes to use 02 tabs. Even changing one line of the code, whenever one of them submits this file to the code versioner, all other lines will change as well, since their code alignment configuration is different.
To solve this and other problems, someone had the brilliant idea to develop a plugin for most code editors.
Conclusion
Although it is a very old topic, I wrote a very interesting article about EditorConfig and would like to share it with you.
Here is the link to the article:
link
In the article I board:
- What is EditorConfig?
- Why use EditorConfig?
- EditorConfig in VS Code
- Using EditorConfig