eslint-plugin-disable
raw JSON → 2.0.3 verified Sat Apr 25 auth: no javascript maintenance
ESLint plugin to disable other ESLint plugins for specific files using file path patterns or inline comments. Current stable version is 2.0.3, release cadence low (last release 2020). Key differentiator: selectively disables entire plugins per file, reducing noise in mixed-codebases (e.g., tests vs. source) without disabling rules individually. v2.0.0 broke compatibility with pre-ESLint 6 configs and introduced a required processor declaration. Alternative to manually managing overrides for every rule.
Common errors
error ESLint couldn't find the plugin "eslint-plugin-disable". (ESLint configuration error) ↓
cause Plugin not installed or missing in plugins array in .eslintrc.
fix
Install: npm install eslint-plugin-disable --save-dev. Then add 'disable' to plugins array.
error Configuration for rule "react/jsx-uses-vars" is invalid: Value "error" is the wrong type. ↓
cause React plugin is disabled via inline comment or override, but rules are still configured globally; ignores file.
fix
Ensure disabled plugins' rules are not applied to those files; plugin suppression occurs after rule loading.
error Processors is not defined in the configuration for file tests/test.js ↓
cause Missing processor: 'disable/disable' in the override or root config.
fix
Add 'processor': 'disable/disable' to the relevant override or root config.
Warnings
breaking v2.0.0 requires processor: 'disable/disable' in ESLint config; without it, plugin does nothing. ↓
fix Add 'processor': 'disable/disable' to your ESLint config (root or overrides).
breaking v2.0.0 removed settings.extensions; extensions must be provided via ESLint CLI --ext. ↓
fix Use ESLint CLI --ext option (e.g., eslint --ext .js,.ts .).
breaking v2.0.0 changed settings name from 'eslint-plugin-disable' to 'disable/plugins'. ↓
fix Update settings in .eslintrc: use 'disable/plugins' array instead of nested object.
deprecated v1.0.0 removed 'extensions' setting; must use ESLint CLI --ext. ↓
fix Use ESLint CLI --ext to list file extensions for linting.
gotcha Inline comment '/* eslint-plugin-disable */' without plugin names disables ALL registered plugins for that file. ↓
fix Specify plugins to disable, or use 'eslint-plugin-disable-all-except' with explicit list.
Install
npm install eslint-plugin-disable yarn add eslint-plugin-disable pnpm add eslint-plugin-disable Imports
- disable wrong
const disable = require('eslint-plugin-disable') // No default export to assigncorrectimport 'eslint-plugin-disable' // or in .eslintrc: plugins: ['disable'] - processor wrong
processor: 'disable' // Missing /disable sub-pathcorrectprocessor: 'disable/disable' - settings.disable/plugins wrong
settings: { 'eslint-plugin-disable': { plugins: ['react'] } } // Deprecated structure from v1correctsettings: { 'disable/plugins': ['react', 'import'] } - inline comment wrong
/* eslint-disable-plugin react */ // Wrong prefixcorrect/* eslint-plugin-disable react, jsx-a11y */
Quickstart
// .eslintrc.json
{
"plugins": ["react", "disable"],
"processor": "disable/disable",
"rules": {
"react/jsx-uses-vars": "error"
},
"overrides": [
{
"files": ["tests/**/*.test.js"],
"settings": {
"disable/plugins": ["react"]
}
}
]
}
// src/Component.jsx
function Component() {
return <div>Hello</div>;
}
// tests/test.js
/* eslint-plugin-disable react */
import { render } from '@testing-library/react';
// React plugin errors are suppressed