eslint-plugin-eslint-comments

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

An ESLint plugin providing additional rules specifically for ESLint directive comments like // eslint-disable-line, // eslint-disable-next-line, and global comment directives. Version 3.2.0 is stable, with maintenance releases. It enforces best practices around disable/enable pairs, unused disable directives, and consistent use of eslint-env/eslint-enable. Differentiates from core ESLint rules by focusing exclusively on the correctness and hygiene of ESLint's own comment directives. Supports ESLint >=4.19.1 and Node >=6.5.0.

error ESLint couldn't find the plugin "eslint-plugin-eslint-comments".
cause Plugin not installed or not added to plugins array.
fix
Run npm install eslint-plugin-eslint-comments --save-dev and ensure 'eslint-comments' is in plugins list.
error Definition for rule 'eslint-comments/disable-enable-pair' was not found.
cause Rules are nested under 'eslint-comments/' namespace; may have used wrong prefix.
fix
Use 'eslint-comments/disable-enable-pair' not 'disable-enable-pair'.
error Failed to load plugin 'eslint-comments' declared in '.eslintrc.js': Cannot find module 'eslint-plugin-eslint-comments'
cause Plugin not installed in the project's node_modules.
fix
npm install eslint-plugin-eslint-comments --save-dev
breaking v3.0.0 dropped support for ESLint <4.19.1 and Node <6.5.0.
fix Upgrade ESLint to >=4.19.1 and Node to >=6.5.0.
breaking v3.0.0 removed no-unused-disable from the recommended preset.
fix Manually enable eslint-comments/no-unused-disable if desired, or use --report-unused-disable-directives on CLI.
deprecated The no-unused-disable rule's autofix was reverted in v3.1.1 due to issues.
fix Update to v3.1.2 or later where autofix is removed.
gotcha The disable-enable-pair rule with allowWholeFile option may cause false positives in some editors like WebStorm.
fix Ensure ESLint cache is cleared if rules appear stale.
npm install eslint-plugin-eslint-comments
yarn add eslint-plugin-eslint-comments
pnpm add eslint-plugin-eslint-comments

Shows how to enable the plugin and its recommended rules in an ESLint config.

// .eslintrc.js
module.exports = {
  plugins: ['eslint-comments'],
  extends: ['plugin:eslint-comments/recommended'],
  rules: {
    'eslint-comments/disable-enable-pair': 'error',
    'eslint-comments/no-duplicate-disable': 'error',
    'eslint-comments/no-unlimited-disable': 'error',
    'eslint-comments/no-unused-enable': 'error',
    'eslint-comments/no-unused-disable': 'warn',
    'eslint-comments/no-restricted-disable': 'off'
  }
};