Appearance
Additional ESLint rules for ESLint directive comments (e.g. //eslint-disable-line).
//eslint-disable-line
The purpose of this plugin is to apply best practices on directive comments such as /* eslint-disable */.
/* eslint-disable */
For example,
Use npm or a compatible tool.
npm install --save-dev eslint @eslint-community/eslint-plugin-eslint-comments
Requirements
^12.22.0 || ^14.17.0 || >=16.0.0
^6.0.0 || ^7.0.0 || ^8.0.0
Configure your eslint.config.* file.
eslint.config.*
For example:
import js from "@eslint/js" import comments from "@eslint-community/eslint-plugin-eslint-comments/configs" export default [ js.configs.recommended, comments.recommended, ]
If your project's ESLint config runs in CommonJS instead of ESM, use require():
require()
const comments = require("@eslint-community/eslint-plugin-eslint-comments/configs")
Either way, you can optionally configure individual rules:
// ... [ // ... comments.recommended, { "@eslint-community/eslint-comments/no-unused-disable": "error" }, ]
TIP
The @eslint-community/eslint-comments/no-unused-disable rule has the same effect as --report-unused-disable-directives option. However, the @eslint-community/eslint-comments/no-unused-disable rule is relatively useful since it can be configured in shareable configs.
@eslint-community/eslint-comments/no-unused-disable
Configure your .eslintrc.* file.
.eslintrc.*
{ "extends": [ "eslint:recommended", "plugin:@eslint-community/eslint-comments/recommended" ], "rules": { // Optional. "@eslint-community/eslint-comments/no-unused-disable": "error" } }
Getting Started
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,
💿 Installation
Use npm or a compatible tool.
Requirements
^12.22.0 || ^14.17.0 || >=16.0.0
^6.0.0 || ^7.0.0 || ^8.0.0
📖 Usage
Configure your
eslint.config.*
file.For example:
If your project's ESLint config runs in CommonJS instead of ESM, use
require()
:Either way, you can optionally configure individual rules:
TIP
The
@eslint-community/eslint-comments/no-unused-disable
rule has the same effect as --report-unused-disable-directives option. However, the@eslint-community/eslint-comments/no-unused-disable
rule is relatively useful since it can be configured in shareable configs.📜 Legacy ESLint Configs
Configure your
.eslintrc.*
file.For example: