Skip to content
Sarj Code Standards

directive-no-use

Disallow directive comments, eslint-* or oxlint-*, except the allowed kinds.

Why

Block disables and inline rule configuration hide diagnostics for whole regions of a file. Allowing only line-scoped directives keeps each exception next to the code it excuses.

Fix

Replace the directive with one of the allowed kinds, usually an eslint-disable-next-line comment that names the rule and the reason.

Examples

Before — flagged A block disable hides every later line
src/report.ts
/* eslint-disable no-console -- the CLI prints its report */
console.log(report);
After — preferred Disable one line instead
src/report.ts
// eslint-disable-next-line no-console -- the CLI prints its report
console.log(report);

Options

{
"additionalProperties": false,
"properties": {
"allow": {
"description": "Directive kinds to allow, such as `eslint-disable-next-line`; an `oxlint-*` directive follows its `eslint-*` kind.",
"items": { "type": "string" },
"type": "array",
"uniqueItems": true
}
},
"type": "object"
}

References