What EditorConfig is and why teams use it
How a single .editorconfig file keeps indentation, line endings and charset consistent across editors, and how its glob sections are resolved.
The problem EditorConfig solves
On any team of more than one person, editors drift apart. One developer indents with tabs, another with two spaces, a third leaves a Windows CRLF at the end of every line. The result is diffs full of whitespace noise that hide the real change and cause needless merge conflicts. EditorConfig fixes this at the source by storing formatting rules in a plain text file that lives with the code, so the editor itself applies them the moment a file is opened.
How the file is structured
An .editorconfig file is a set of INI-style sections. The [*] section applies to every file, and additional sections use glob patterns like [*.md] or [{*.yml,*.yaml}] to target specific types. Inside each section you list key = value pairs such as indent_style = space or end_of_line = lf. The optional root = true line at the very top tells tools to stop searching parent directories, which is why it belongs only in your project root.
How rules are resolved
When you open a file, EditorConfig-aware tools collect every matching section from the closest .editorconfig up to the one marked root. Later and more specific sections win, so a property in [*.md] overrides the same property in [*]. Only the properties that are set change; anything left unset falls back to the editor's own defaults. This layering is what lets you write a short override that adjusts one rule while inheriting the rest.
Putting it to work
Generate the file, save it as .editorconfig in your repository root, and commit it. Team members whose editors support EditorConfig natively need nothing else, while VS Code, Vim and Sublime users install a small extension once. Pair it with a formatter like Prettier for language-aware styling: EditorConfig handles the low-level basics such as indentation and newlines that a formatter may not touch, and the two coexist without conflict.