oxc-project/oxc · error · OxcDiagnostic

Don't use '{escape_sequence}' escape sequence.

Error message

Don't use '{escape_sequence}' escape sequence.

What it means

Lint diagnostic from eslint/no-nonoctal-decimal-escape: a string or regex contains the \8 or \9 escape. These are legacy non-octal decimal escapes whose behavior differs between sloppy and strict modes and between JS engines; the fixer rewrites them.

Source

Thrown at crates/oxc_linter/src/rules/eslint/no_nonoctal_decimal_escape.rs:15

use lazy_regex::{Captures, Lazy, Regex, lazy_regex};
use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    AstNode,
    context::LintContext,
    fixer::{RuleFix, RuleFixer},
    rule::Rule,
};

fn no_nonoctal_decimal_escape_diagnostic(escape_sequence: &str, span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(format!("Don't use '{escape_sequence}' escape sequence."))
        .with_help("Use the actual character or a valid escape sequence instead.")
        .with_label(span)
}

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

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Disallow `\8` and `\9` escape sequences in string literals.
    ///
    /// ### Why is this bad?
    ///
    /// ECMAScript specification treats `\8` and `\9` in string literals as a legacy feature
    ///
    /// ### Examples
    ///

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Use the actual character or \0 for NUL instead of \8/\9
  2. Apply the rule's autofix
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/eslint/no_nonoctal_decimal_escape.rs:15 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/eb9d11426303e2af. Report an issue: GitHub.