Skip to content
Sarj Code Standards

directive-require-description

Require a -- description on every directive comment, eslint-* or oxlint-*.

Why

A directive comment changes what the linter checks. Without a reason next to it, a reviewer cannot tell whether the exception still holds or can be removed.

Fix

Append -- <reason> to the directive comment, naming why the exception is safe here.

Examples

Before — flagged A disable directive without a reason
src/report.ts
// eslint-disable-next-line no-console
console.log(report);
After — preferred Name the reason after `--`
src/report.ts
// eslint-disable-next-line no-console -- the CLI prints its report
console.log(report);

Options

{
"additionalProperties": false,
"properties": {
"ignore": {
"description": "Directive kinds that need no description; an `oxlint-*` directive follows its `eslint-*` kind.",
"items": {
"enum": [
"eslint",
"eslint-disable",
"eslint-disable-line",
"eslint-disable-next-line",
"eslint-enable",
"eslint-env",
"exported",
"global",
"globals"
]
},
"type": "array",
"uniqueItems": true
}
},
"type": "object"
}

References