Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 754 Bytes

no-octal-escape.md

File metadata and controls

39 lines (23 loc) · 754 Bytes
规则名 规则类型
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