Rules

require-disable-reason

Require a reason for each Oxlint suppression.

Purpose and behavior

Require a reason for each Oxlint suppression.

The rule requires a non-empty reason after -- in oxlint-disable, oxlint-disable-line and oxlint-disable-next-line comments. A rule list alone does not satisfy the rule. Write the reason yourself.

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 provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/require-disable-reason -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the TypeScript preset.

require-disable-reason.ts · Tests