eslint/no-nonoctal-decimal-escape Correctness
作用
此规则不允许在字符串字面量中使用 \8 和 \9 转义序列。
为什么这不好?
ECMAScript 规范将字符串字面量中的 \8 和 \9 视为一种遗留特性
示例
此规则的错误代码示例:
javascript
let x = "\8";
let y = "\9";此规则的正确代码示例:
javascript
let x = "8";
let y = "\\9";如何使用
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版本
此规则已在 v0.2.10 中添加。
