What good is he?
Editorconfig helps developers define and maintain consistent coding styles between different editors and Ides. This means that no matter which editor you use, you and your team just use the plugin to make the code consistent.
How is used?
On the official website in the Downloads you can download the plugin to several code editors. The first step is to download and install the plugin. To use the plugin, simply create a file .editorconfig
at the root of your project and adjust the settings according to your preference.
I leave here the settings 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 to set file defaults.
A very simple example of these patterns would be: align code using spaces or tabs. Only this pattern already generates a 01 month discussion among 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 if you change only one line of the code, whenever one of them submits this file to the code versioner, all the other lines will be changed as well, because their code alignment configuration is different.
To solve this and other problems, someone had the brilliant idea of developing a plugin for most code editors.
Completion
Even being a very old topic, I wrote a very interesting article about Editorconfig and I would like to share with you.
Here is the link to the article:
https://showmethecode.com.br/2017/03/29/editor-config/
In the article I approach:
- What is Editorconfig?
- Why to use Editorconfig?
- Editorconfig in VS Code
- Using the Editorconfig
We appreciate your willingness to collaborate with the community, but it might be interesting to read the text We want answers that contain only links? The main problem is that if the answer link eventually ceases to exist, the answer completely loses its meaning. To get around this, check with the content of the link the main points that are valid to the question and describe them here, keeping the link only as a support material.
– Woss
@Andersoncarloswoss I believe the answer is much better now. Thanks for the feedback.
– Roberto Achar