eslint-plugin-no-autofix
raw JSON → 2.1.0 verified Sat Apr 25 auth: no javascript
ESLint plugin that wraps any rule to disable its autofix behavior, allowing rules to report warnings without automatically fixing them. Current stable version is 2.1.0, released September 2024. Requires Node >= 18 and ESLint >= 8. The plugin supports all ESLint core rules and third-party plugin rules by simply prefixing the rule name with 'no-autofix/'. It is particularly useful for teams that want to enforce certain rules (like prefer-const) but avoid automatic code modifications that might conflict with other tools or team conventions. Unlike alternatives (e.g., using eslint --no-fix), this provides per-rule granularity.
Common errors
error Error: Failed to load plugin 'no-autofix' declared in 'plugins' array of my config: Cannot find module 'eslint-plugin-no-autofix' ↓
cause Plugin not installed or misspelled.
fix
Run 'npm install eslint-plugin-no-autofix --save-dev' and verify the spelling in your config.
error Error: Cannot find module 'eslint-plugin-no-autofix' require() of ES Module not supported ↓
cause Using CJS require() with ESM-only package (v2+).
fix
Use import syntax (ESM) or downgrade to v1.x with require() and Node < 18.
error ESLint: Definition for rule 'no-autofix/prefer-const' was not found. ↓
cause Rule prefix is correct but plugin not registered in 'plugins' array.
fix
Make sure to add 'no-autofix' to the plugins list in your ESLint config.
Warnings
breaking v2.0.0 dropped support for ESLint < 8 and Node < 18. Flat config is now expected. ↓
fix Upgrade to Node >= 18 and ESLint >= 8. If using .eslintrc, stay on v1.x or migrate to flat config.
gotcha The plugin only disables the autofix modifier; the rule still reports the same warnings. If you want to completely disable a rule, use 'off' on the original, not 'no-autofix/rule' alone. ↓
fix Always set the original rule to 'off' when using the no-autofix variant to avoid duplicate warnings.
gotcha When using the old .eslintrc style, plugin must be listed in 'plugins' array, and the rule prefix must be 'no-autofix/'. Omitting the plugin declaration will cause an error. ↓
fix Add 'no-autofix' to the plugins array in your ESLint config.
deprecated The .eslintrc format (JSON, YAML, JS) is deprecated in ESLint v9. Use flat config (eslint.config.js) instead. ↓
fix Migrate to eslint.config.js with flat config as shown in Quickstart.
Install
npm install eslint-plugin-no-autofix yarn add eslint-plugin-no-autofix pnpm add eslint-plugin-no-autofix Imports
- plugin (default export) wrong
const noAutofix = require('eslint-plugin-no-autofix')correctimport noAutofix from 'eslint-plugin-no-autofix' - flat config (ESLint v9 compatible) wrong
module.exports = { plugins: ['no-autofix'], rules: { 'no-autofix/prefer-const': 'error' } }correctimport noAutofix from 'eslint-plugin-no-autofix'; export default [ { plugins: { 'no-autofix': noAutofix }, rules: { 'no-autofix/prefer-const': 'error' } } ] - rules object (advanced usage) wrong
import { noAutofix } from 'eslint-plugin-no-autofix'correctimport { rules } from 'eslint-plugin-no-autofix'
Quickstart
// Install: npm i eslint-plugin-no-autofix -D
// eslint.config.js (flat config, ESLint v9+)
import noAutofix from 'eslint-plugin-no-autofix';
export default [
{
plugins: {
'no-autofix': noAutofix
},
rules: {
// Disable the original rule
'prefer-const': 'off',
// Enable no-autofix version
'no-autofix/prefer-const': 'error',
// Works with plugin rules too
'react/jsx-indent': 'off',
'no-autofix/react/jsx-indent': 'error'
}
}
];