Rules

require-disable-reason

Make every Oxlint suppression explain its exception.

Purpose and behavior

Make every Oxlint suppression explain its exception.

Requires a non-empty reason following -- in oxlint-disable, oxlint-disable-line and oxlint-disable-next-line comments. A rule list alone or an empty reason is insufficient. Does not invent or autofix reasons.

Options

No configurable options. Enable with "rules/require-disable-reason": "error".

Invalid example

// oxlint-disable-next-line no-fetch
fetch("x")

Valid example

// oxlint-disable-next-line no-fetch -- external API boundary
fetch("x")

Fixes and exceptions

This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/require-disable-reason -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the TypeScript preset.

require-disable-reason.ts · Tests