eslint-plugin-editorconfig

raw JSON →
4.0.3 verified Sat Apr 25 auth: no javascript

ESLint plugin (v4.0.3) that enforces EditorConfig rules using existing ESLint and optional @typescript-eslint rules. Released under MIT, updated ~monthly. Key differentiator: automatically reads .editorconfig and applies charset, indent, linebreak, trailing spaces, and eol-last rules, avoiding duplicate configuration. Since v4.0.0, @typescript-eslint/eslint-plugin is no longer a dependency; must be installed separately for TS files. Supports ESLint 8.x, Flat config (v4+), and offers 'all' and 'noconflict' configs.

error Error: Failed to load plugin 'editorconfig' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-editorconfig'
cause Plugin not installed
fix
Run: npm install --save-dev eslint-plugin-editorconfig
error Error: Failed to load config 'plugin:editorconfig/all' to extend from
cause Missing 'plugin:' prefix or plugin not installed
fix
Ensure 'editorconfig' is in plugins array and extends string is 'plugin:editorconfig/all'
error TypeError: eslint-plugin-editorconfig is not a function or export expected
cause Trying to import plugin as function in flat config without correct import
fix
Use: import editorconfig from 'eslint-plugin-editorconfig' (ESM) or const editorconfig = require('eslint-plugin-editorconfig') (CJS) in eslint.config.js
breaking Removed @typescript-eslint/eslint-plugin as a dependency; must install manually
fix If you lint TypeScript files, run: npm install --save-dev @typescript-eslint/eslint-plugin
breaking editorconfig/editorconfig rule removed; replaced with separate rules
fix Use individual rules (charset, eol-last, indent, linebreak-style, no-trailing-spaces) or extend 'plugin:editorconfig/all'
gotcha Flat config (eslint.config.js) requires import; not supported in legacy configs
fix Use import editorconfig from 'eslint-plugin-editorconfig'; then export default [...editorconfig.configs.recommended]
gotcha Conflicts with built-in ESLint rules (eol-last, indent, linebreak-style, no-trailing-spaces, unicode-bom) and @typescript-eslint equivalents
fix Either remove those rules from config or extend 'plugin:editorconfig/noconflict' to disable them
deprecated Node <14 and ESLint <8 not supported in v4+
fix Update to Node >=14 and ESLint >=8
npm install eslint-plugin-editorconfig
yarn add eslint-plugin-editorconfig
pnpm add eslint-plugin-editorconfig

Shows minimal setup with all rules enabled via 'plugin:editorconfig/all' and a sample .editorconfig file.

// Install:
// npm install --save-dev eslint eslint-plugin-editorconfig

// .eslintrc.json:
{
  "extends": ["plugin:editorconfig/all"],
  "plugins": ["editorconfig"]
}

// .editorconfig (example):
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

// Run:
// npx eslint .