Frequently Asked Question

What is .editorconfig and should my project have one?

EditorConfig is a tiny convention for telling editors how to format a project: indent with tabs or spaces, what size, what line ending, whether to trim trailing whitespace, whether to insert a final newline. A file named .editorconfig at the project root (or any parent directory) declares these settings per file glob, and most editors honour it automatically.

A typical file looks like a short INI document: a [*] section for defaults (charset = utf-8, end_of_line = lf, insert_final_newline = true, trim_trailing_whitespace = true, indent_style = space, indent_size = 4), then per-language overrides like [*.{yml,yaml}] with indent_size = 2. The format is intentionally minimal, no Turing-complete config language, no plugins, and is supported natively by JetBrains IDEs, VS Code (via extension), GitHub's web editor, and most modern terminal editors. Vim and Neovim get support through the editorconfig-vim plugin or the built-in editorconfig feature in Neovim 0.9 and later.

Add one to any shared project. It is the cheapest possible fix for the "every contributor's editor uses different indentation" problem, and it eliminates a category of pointless diff churn in pull requests. The official site has examples covering every common language and editor.

Further reading and video