EditorConfig
also: .editorconfig
EditorConfig is a configuration format and tool that helps maintain consistent coding styles across different editors and IDEs by defining indentation, line endings, and other formatting rules in a `.editorconfig` file.
EditorConfig uses a simple INI-style configuration file (`.editorconfig`) placed in a project root to specify coding conventions like indentation size, tab vs. space preference, line ending style, and character encoding. Multiple editors and IDEs read these settings automatically, ensuring all developers follow the same formatting rules regardless of their personal preferences.
When you open a file in a supported editor, it searches for `.editorconfig` files in the current directory and parent directories up the tree. The closest matching rules apply to the file being edited. For example, you can specify that all JavaScript files use 2-space indentation while Python files use 4 spaces.
A typical `.editorconfig` might contain:
root = true
[*.{js,py}]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = trueEditorConfig is language-agnostic and supported by most modern editors including VS Code, Vim, Emacs, IntelliJ, and Sublime Text, making it valuable for open-source projects and teams with mixed development environments.