What Is .editorconfig
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 10, 2026
Key Facts
- .editorconfig was introduced in 2012 and now supports over 50 editors including VS Code, JetBrains IDEs, Sublime Text, Vim, and Emacs
- Properties include indent_style (space/tab), indent_size (2-8 spaces), end_of_line (LF/CRLF), charset (UTF-8), and trim_trailing_whitespace (true/false)
- Configuration files use glob patterns to apply different rules to specific file types (*.js, *.py, src/**/*.html) within the same project
- Most modern frameworks and projects including React, Vue, Angular, and Django include pre-configured .editorconfig files in their repositories
- Setting root = true prevents editors from searching parent directories, useful for defining project-specific formatting that overrides system or user settings
Overview
.editorconfig is a standardized file format designed to maintain consistent coding styles across different text editors and integrated development environments (IDEs). Created in 2012 to solve the problem of inconsistent formatting when developers use different tools, it provides a cross-platform, editor-agnostic solution for enforcing coding conventions automatically.
The .editorconfig file sits in a project repository and contains rules that adjust editor settings like indentation, line endings, and character encoding based on file type. With support from over 50 editors and IDEs—including Visual Studio Code, JetBrains IntelliJ IDEA, Sublime Text, Vim, and Emacs—it has become a standard practice in modern software development teams.
How It Works
.editorconfig files use simple INI-style syntax and are processed by supported editors to automatically apply formatting rules. When you open a file, your editor reads the .editorconfig configuration and applies the defined properties before you start editing. The editor searches for .editorconfig files in the current directory and parent directories up the file tree.
- File Naming and Location: The configuration file must be named exactly .editorconfig (with a dot prefix). Editors automatically discover this file when opening projects, eliminating the need for manual configuration or installation.
- Glob Pattern Matching: Rules are organized by file patterns using glob syntax such as *.js for JavaScript files or src/**/*.html for HTML files in subdirectories. This allows different settings for different file types within the same project.
- Property Configuration: Common properties include indent_style (space or tab), indent_size (typically 2 to 8 spaces), end_of_line (LF, CRLF, or auto-detect), charset (UTF-8, Latin-1, etc.), and trim_trailing_whitespace. The insert_final_newline property ensures files end with a newline character.
- Root Declaration: Setting root = true at the top level of the file prevents editors from searching parent directories, useful when .editorconfig is in your project root to ensure project-specific settings override global configurations.
- Universal Application: Once configured, the rules apply automatically to all team members without requiring per-editor setup or configuration files in each developer's home directory.
Key Comparisons
| Aspect | .editorconfig | Prettier/ESLint | IDE Settings |
|---|---|---|---|
| Scope | Cross-editor, language-agnostic formatting | Language-specific (primarily JavaScript/TypeScript) | Single editor configuration only |
| Configuration Format | INI-style file in project repository | JSON, YAML, or JavaScript config files | GUI settings or editor-specific files |
| Auto-Formatting | Applies editor settings, formatting is manual | Automatic formatting on save or commit hooks | Manual or on-demand per editor |
| Editor Support | 50+ editors with native support | Mainly JavaScript ecosystem tools | Limited to specific editor application |
| Team Adoption | Zero setup for team members with supported editors | Requires tool installation and integration | Each developer configures individually |
Why It Matters
- Eliminates Style Debates: Removes endless discussions about tabs versus spaces and line endings. All developers follow identical rules regardless of their editor preferences or operating system.
- Reduces Merge Conflicts: When everyone uses consistent formatting, whitespace-related merge conflicts disappear entirely. Code reviews focus on logic and functionality rather than style inconsistencies.
- Improves Onboarding: New team members automatically receive correct formatting without manual editor configuration. This reduces setup time and prevents style-related issues in early pull requests.
- Language Flexibility: Unlike editor-specific or language-specific tools, .editorconfig works uniformly across HTML, CSS, JavaScript, Python, Java, Go, Rust, and dozens of other languages in a single configuration file.
- Team Productivity: By automating style enforcement, teams spend less time reviewing formatting issues and more time focusing on actual code quality and functionality.
In modern development workflows, .editorconfig typically complements language-specific formatters like Prettier, Black, or Gofmt. While .editorconfig handles cross-editor settings and basic formatting rules, dedicated formatters provide sophisticated code transformation and style rules. Together, they create a comprehensive system ensuring consistent, high-quality code across entire development teams and projects.
Most popular open-source projects and frameworks—including React, Vue, Angular, Laravel, Django, and Node.js—include pre-configured .editorconfig files. By adopting .editorconfig, teams establish a foundation for consistent code style that persists regardless of individual developer preferences or tool choices.
More What Is in Daily Life
Also in Daily Life
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
Missing an answer?
Suggest a question and we'll generate an answer for it.