规则名 | 规则类型 |
---|---|
no-octal-escape |
suggestion |
As of the ECMAScript 5 specification, octal escape sequences in string literals are deprecated and should not be used. Unicode escape sequences should be used instead.
var foo = "Copyright \251";
This rule disallows octal escape sequences in string literals.
If ESLint parses code in strict mode, the parser (instead of this rule) reports the error.
此规则的 错误 代码实例:
/*eslint no-octal-escape: "error"*/
var foo = "Copyright \251";
此规则的 正确 代码实例:
::: correct
/*eslint no-octal-escape: "error"*/
var foo = "Copyright \u00A9"; // unicode
var foo = "Copyright \xA9"; // hexadecimal