node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »

eslint-plugin-eslint-comments

eslint-plugin-eslint-comments

npm version Downloads/month Build Status codecov Dependency Status

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

💿 Installation

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

Requirements

  • Node.js ^4.0.0, ^6.0.0, or newer.
  • ESLint ^4.7.0, or newer.

📖 Usage

Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin

Example

.eslintrc.json

{
    "extends": [
        "eslint:recommended",
        "plugin:eslint-comments/recommended"
    ],
}

Or you can specify for each rule:

{
    "plugins": [
        "eslint-comments"
    ],
    "rules": {
        "eslint-comments/no-unused-disable": "error",
        "eslint-comments/no-unused-enable": "error",
        // ...
    }
}

Rules

  • 🌟 mark: the rule is enabled by eslint-comments/recommended preset.
  • ✒️ mark: the rule is fixable by eslint --fix command.

Best Practices

Rule ID Description
🌟 eslint-comments/disable-enable-pair requires a eslint-enable comment for every eslint-disable comment
🌟 eslint-comments/no-aggregating-enable disallows eslint-enable comments for multiple eslint-disable comments
🌟 eslint-comments/no-duplicate-disable disallows duplicate eslint-disable comments
🌟 eslint-comments/no-unlimited-disable disallows eslint-disable comments without rule names
🌟 eslint-comments/no-unused-disable disallows unused eslint-disable comments
🌟 eslint-comments/no-unused-enable disallows unused eslint-enable comments

Stylistic Issues

Rule ID Description
eslint-comments/no-restricted-disable disallows eslint-disable comments about specific rules
eslint-comments/no-use disallows ESLint directive-comments

🚥 Semantic Versioning Policy

eslint-plugin-eslint-comments follows semantic versioning and ESLint's Semantic Versioning Policy.

📰 Changelog

🍻 Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests and measures coverage.
  • npm run build updates README.md, index.js, and the header of all rule's documents.
  • npm run clean removes the coverage of the last npm test command.
  • npm run coverage shows the coverage of the last npm test command.
  • npm run lint runs ESLint for this codebase.
  • npm run watch runs tests and measures coverage when source code are changed.