Skip to content

noOctalEscape

Diagnostic Category: lint/nursery/noOctalEscape

Since: v1.9.3

Sources:

Disallow octal escape sequences in string literals

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";
code-block.js:1:11 lint/nursery/noOctalEscape ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use octal

> 1 │ var foo = “Copyright \251”;
^^^^^^^^^^^^^^^^
2 │

Don’t use octal escape sequences: “Copyright \251”

Use unicode or hexidecimal escape sequences instead.

var foo = "Copyright \u00A9"; // unicode
var foo = "Copyright \xA9"; // hexadecimal