Skip to content
← Back to rules

eslint/no-nonoctal-decimal-escape Correctness

✅ This rule is turned on by default.
💡 A suggestion is available for this rule.

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 ​

Examples of incorrect code for this rule:

javascript
let x = "\8";
let y = "\9";

Examples of correct code for this rule:

javascript
let x = "8";
let y = "\\9";

How to use ​

To enable this rule using the config file or in the CLI, you can use:

json
{
  "rules": {
    "no-nonoctal-decimal-escape": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  rules: {
    "no-nonoctal-decimal-escape": "error",
  },
});
bash
oxlint --deny no-nonoctal-decimal-escape

Version ​

This rule was added in v0.2.10.

References ​