eslint-plugin-eslint-config
raw JSON → 2.0.0 verified Sat Apr 25 auth: no javascript maintenance
ESLint plugin for linting ESLint configuration files, ensuring they are valid and consistent. Current stable version is 2.0.0, released January 2021, with a slow release cadence focused on bug fixes. Key differentiators: validates exported configs via execution, provides presets (recommended-rules, rc, all), and includes rules for deprecated/unknown rules and sorting. Requires ESLint >=5 and Node >=10, with peer dependency on eslint.
Common errors
error ESLint configuration is invalid: "eslint-config" is not a known plugin. ↓
cause Plugin name in plugins array is misspelled or missing.
fix
Add 'eslint-config' to plugins array and ensure eslint-plugin-eslint-config is installed.
error Plugin package 'eslint-plugin-eslint-config' not found. ↓
cause Package not installed or ESLint cannot locate it.
fix
Run npm install --save-dev eslint-plugin-eslint-config or yarn add --dev eslint-plugin-eslint-config.
error Cannot read property 'no-deprecated-rules' of undefined ↓
cause Using the rule with a missing or misconfigured plugin.
fix
Verify plugin is installed and added to plugins array, then use rule as 'eslint-config/no-deprecated-rules'.
error ESLint configuration is invalid: "eslint-config/rc" invalid preset. ↓
cause Extending a preset that doesn't exist or wrong path.
fix
Use configs.rc or extend 'plugin:eslint-config/rc' from ESLint config (note: 'eslint-config' is the plugin prefix).
Warnings
breaking Dropped support for Node 8 in v2.0.0. ↓
fix Upgrade Node to v10 or higher.
breaking Updated @typescript-eslint/experimental-utils to v4 in v2.0.0, potentially breaking TypeScript users. ↓
fix Ensure @typescript-eslint packages are compatible; if using TypeScript, update to match.
deprecated The 'all' preset may change in any release; not recommended for long-term consistency. ↓
fix Use 'recommended-rules' or 'rc' instead for stable base.
gotcha Rules execute the config files they lint; can trigger side effects. Should only be applied to specific files via overrides. ↓
fix Use overrides to limit rules to ESLint config files only.
gotcha Plugin name must be 'eslint-config' (without 'eslint-plugin-') in plugins array, or 'eslint-config' as a string. ↓
fix Set plugins: ['eslint-config'] in your ESLint config.
Install
npm install eslint-plugin-eslint-config yarn add eslint-plugin-eslint-config pnpm add eslint-plugin-eslint-config Imports
- eslint-plugin-eslint-config wrong
const configPlugin = require('eslint-plugin-eslint-config'); // works but not needed if using pluginscorrectimport configPlugin from 'eslint-plugin-eslint-config'; // or use through plugins in .eslintrc.js: plugins: ['eslint-config'] - rules wrong
const rules = require('eslint-plugin-eslint-config').rules; // common in CJScorrectimport { rules } from 'eslint-plugin-eslint-config'; // then access individual rules via rules['no-deprecated-rules'] - configs
import { configs } from 'eslint-plugin-eslint-config'; // extend configs.recommendedRules or configs.rc in ESLint config
Quickstart
// .eslintrc.js
module.exports = {
plugins: ['eslint-config'],
overrides: [
{
files: ['.eslintrc.js', 'my-config.js'],
rules: {
'eslint-config/no-deprecated-rules': 'warn',
'eslint-config/no-invalid-config': 'error',
'eslint-config/no-unknown-rules': 'error',
'eslint-config/sort-rules': 'warn'
}
}
]
};