oxc-project/oxc · error · OxcDiagnostic

Unexpected `oxlint-disable` comment that does not specify an

Error message

Unexpected `oxlint-disable` comment that does not specify any rules to disable.

What it means

Raised by unicorn/no-abusive-eslint-disable when an `oxlint-disable` comment lists no rules and therefore silences all rules indiscriminately. The helper selects this message for the Oxlint directive prefix; the faulting input is the bare `oxlint-disable` comment at the labeled span.

Source

Thrown at crates/oxc_linter/src/rules/unicorn/no_abusive_eslint_disable.rs:23

use crate::{
    context::LintContext,
    disable_directives::{DirectivePrefix, RuleCommentType},
    rule::Rule,
};

fn no_abusive_eslint_disable_diagnostic(
    span: Span,
    directive_prefix: DirectivePrefix,
) -> OxcDiagnostic {
    let message = match directive_prefix {
        DirectivePrefix::Eslint => {
            "Unexpected `eslint-disable` comment that does not specify any rules to disable."
        }
        DirectivePrefix::Oxlint => {
            "Unexpected `oxlint-disable` comment that does not specify any rules to disable."
        }
    };
    OxcDiagnostic::warn(message)
        .with_help("Specify the rules you want to disable.")
        .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct NoAbusiveEslintDisable;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Disallows `oxlint-disable` or `eslint-disable` comments without specifying rules.
    ///
    /// ### Why is this bad?
    ///
    /// A general `oxlint-disable` or `eslint-disable` comment suppresses all lint errors, not just the intended one,
    /// potentially hiding useful warnings and making debugging harder.
    ///
    /// ### Examples

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Name the exact rules to disable, e.g. `// oxlint-disable-next-line rule-name`
  2. Remove the comment if it is not needed
  3. Address the reported lint issue rather than suppressing it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/unicorn/no_abusive_eslint_disable.rs:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/6cdfaa684a0468b6. Report an issue: GitHub.