Getting Started

npm version Downloads/month Build Status codecov Dependency Status

Additional ESLint rules for ESLint directive comments (e.g. //eslint-disable-line).

🏁 Goal

The purpose of this plugin is to apply best practices on directive comments such as /* eslint-disable */.

For example,

  • to disallow unused disabling.
  • to disallow non-effect enabling.
  • to require rule IDs for disabling and enabling.

💿 Installation

Use npm or a compatible tool.

npm install --save-dev eslint eslint-plugin-eslint-comments

Requirements

  • Node.js 6.5.0 or newer.
  • ESLint 4.19.1 or newer.

📖 Usage

Configure your .eslintrc.* file.

For example:

{
    "extends": [
        "eslint:recommended",
        "plugin:eslint-comments/recommended"
    ],
    "rules": {
        // Optional.
        "eslint-comments/no-unused-disable": "error"
    }
}

The eslint-comments/no-unused-disable rule has the same effect as --report-unused-disable-directives option. However, the eslint-comments/no-unused-disable rule is relatively useful since it can be configured in shareable configs.