DEV Community

Cover image for Standardizing Code — EditorConfig

Standardizing Code — EditorConfig

walternascimentobarroso profile image Walter Nascimento ・2 min read

[Clique aqui para ler em português]

Defining a standard is very difficult, and most of the time we go into legacy projects that make it even more difficult to write in a standard, and then there are issues like frameworks and programming languages, but we don’t need to define everything from the beginning, standardization is something that we are building little by little and so today I am going to present the editorConfig.

With the editorConfig we define language-independent metrics and with that, even if someone on the team uses a different IDE, the code will have the same indentation in another IDE.

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that 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.


To install .editorConfig just go to the download page and choose your IDE, but for some publishers it is even easier, as in the case of vscode, just access the plugins page and type editorConfig and ready your IDE is already compatible.

How to use

Now that your IDE is already set up, just create a file at the root of the project with the name .editorconfig and add your settings to it.

In vscode the EditorConfig plugin offers an option to automatically generate the file. Just right-click on an empty space in the file area and click Generate .editorConfig

  • root: Set the file as the default for the entire project;
  • [*]: Creates a group, of which everyone will have the same pattern (in place of * you can put the extension of your language, eg: * .php or * .js and etc);
  • indent_style: Indentation using spaces or tab;
  • indent_size: defines the number of spaces;
  • charset: standard fileset charset;
  • trim_trailing_whitespace: Should you delete blank spaces at the end of each line or not;
  • insert_final_newline: Whether or not to insert a blank line at the end of each file;

More information

For more information visit the official website

Thanks for reading!

If you have any questions, complaints or tips, you can leave them here in the comments. I will be happy to answer!

😊😊 See you! 😊😊

Discussion (1)

Editor guide
arvindpdmn profile image
Arvind Padmanabhan

Naming conventions is another way to standardize code: