Skip to content

@eslint-community/eslint-comments/require-description

require include descriptions in ESLint directive-comments

This rule warns directive comments without description. A description is separated by the directive name (and optional instructions) with two hyphens (e.g., /* eslint-disable no-await-in-loop -- Sequential */).

WARNING

This rule can only be used with ESLint v7.x or later.

Rule Details

Examples of 👎 incorrect code for this rule:

Now loading...

Examples of 👍 correct code for this rule:

Now loading...

Options

You can specify ignored directive-comments.

json
{
    "@eslint-community/eslint-comments/require-description": [
        "error",
        { "ignore": [] }
    ]
}
  • ignore option is an array to ignore specified directive-comments. The value of the array is some of the following strings:

    • "eslint"
    • "eslint-disable"
    • "eslint-disable-line"
    • "eslint-disable-next-line"
    • "eslint-enable"
    • "eslint-env"
    • "exported"
    • "global"
    • "globals"
  • additionalDirectives - By default, only the above-mentioned ESLint-based comments are checked. If you wish to check other comments, e.g., istanbul or c8 for coverage, you can add them to this string array. Note that as with ESLint directives, descriptions must be preceded by two hyphens. Note that it is possible we may not be able to detect comments for some non-JavaScript languages.

Further Reading