No rules, click the bottom button to add
EditorConfig: Ending the Code-style "religious war"
Challenges
In one team, every developer has his own preferred editor (VS Code, WebStorm), who is a very good editor. Vim) and configuration habits. Some like 2 spaces, some like 4 spaces, others insist. Tab。 When these codes are mixed to Git, there will be a large number of format conflicts for code review (Code) The Renew has become a nightmare.
Our solution.
EditorConfig provides an extremely simple and powerful way to harmonize norms. By placing one in the root directory
.editorconfig
File, whatever the developers use IDE, editor, automatically reads the configuration and applies the same indentation, line break and character set rules. This generator allows you to quickly configure these rules through visual interfaces without having to remember complex syntax.
Why does every project need editoric?
Although modern IDEs have their own setup, EditorConfig has an irreplaceable advantage:
- Cross-edit compatible : Almost all mainstream editors support it by plug-in or built-in.
- Follow the project. : The configuration is stored in Git repository, and the developers of the new cloning project can experience it in a consistent manner without any additional configuration.
-
It's very specific.
: Can be used for different types of files (e. g.
.js,.py,Makefile) Defines a completely different style rule. - Lightweight : EditorConfig focuses on the most basic file format and the cost of learning is extremely low compared to the complex Linter configuration.
Core rule resolution
-
indent_style
: To decide on the use
tabOr is it?space。 This is the most basic and most important rule of teamwork. - indent_size : When using spaces indent, determine how many spaces one indent represents.
-
end_of_line
: Unify line breaks as
lf(Unix) orcrlf(Windows)。 This will effectively avoid Git states abnormally in the development of the cross-platform. - trim_trailing_whitespace : Automatically remove redundant spaces from the end of the line and keep the code clean.
- insert_final_newline : Ensure that the document ends in an empty line, which is required by many POSIX tools.
Use recommendations
Recommendations
.editorconfig
Place the root directory of the item, and set it up
root = true
To prevent the editor from searching for other configurations in the upper directory. For large monostores (Monorepo), you can also place additional configuration files in subdirectories to overwrite the rules of a given directory.
Privacy statements
This generator is based entirely on the development of pure front-end technologies. All your configuration operations, file matching modes and parameter selections are processed in your local browser. We will not collect or store any of your configuration information, and you can be assured that you will generate any commercial or private project specifications.