npm.io
6.1.1 • Published 6 months ago

eslint-plugin-disable-autofix

Licence
MIT
Version
6.1.1
Deps
0
Size
12 kB
Vulns
0
Weekly
0
Stars
19

eslint-plugin-disable-autofix

Compatible with ESLint 10

Disable autofix for ESLint rules without turning them off.

  • Rules still report violations but eslint --fix and IDE quick-fixes won't change your code
  • Works with any rule from any plugin — builtin, third-party, scoped, ESM
  • configure() helper — simplified setup, easy to maintain
  • Selective modes — disable autofix only, suggestions only, or both
  • Lazy loading — plugins loaded on demand
  • Monorepo support — pnpm, Nx, Yarn workspaces, Turborepo
  • ESLint 9 and 10 flat config
  • Zero dependencies

Install

npm i -D eslint-plugin-disable-autofix

Usage

configure()

The configure() helper handles the boilerplate of disabling the original rule and enabling the prefixed version:

// eslint.config.js
import disableAutofix from 'eslint-plugin-disable-autofix';

export default [
  disableAutofix.configure({
    'prefer-const': 'warn',
    'no-var': 'error',
    '@stylistic/semi': ['error', 'always'],
  }),
];
Manual setup
import disableAutofix from 'eslint-plugin-disable-autofix';

export default [
  {
    plugins: { 'disable-autofix': disableAutofix },
    rules: {
      'prefer-const': 'off',
      'disable-autofix/prefer-const': 'warn',
    },
  },
];
Selective modes

By default, both autofix and suggestions are disabled. Use createPlugin() to disable one or the other:

import disableAutofix from 'eslint-plugin-disable-autofix';

// Disable autofix only — keep IDE suggestions
const disableFix = disableAutofix.createPlugin({ mode: 'fix' });

// Disable suggestions only — keep autofix
const disableSuggest = disableAutofix.createPlugin({ mode: 'suggest' });

export default [
  disableFix.configure({ 'prefer-const': 'warn' }),
  disableSuggest.configure({ 'no-console': 'warn' }),
];
Restrict to specific plugins
const limited = disableAutofix.createPlugin({ plugins: ['react', 'unicorn'] });

Only wraps rules from the listed plugin prefixes. Builtin ESLint rules are always included.

License

MIT

Keywords