Skip to content

eslint/no-nonoctal-decimal-escape Correctness ​

✅ This rule is turned on by default.
🚧 An auto-fix is still under development.

What it does ​

This rule disallows \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

Example ​

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 in the CLI or using the config file, you can use:

bash
oxlint --deny no-nonoctal-decimal-escape
json
{
  "rules": {
    "no-nonoctal-decimal-escape": "error"
  }
}

References ​

Released under the MIT License.