Versions

no-octal-escape

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.

const foo = "Copyright 251円";

Rule Details

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.

Examples of incorrect code for this rule:

Open in Playground
/*eslint no-octal-escape: "error"*/
const foo = "Copyright 251円";

Examples of correct code for this rule:

Open in Playground
/*eslint no-octal-escape: "error"*/
const foo = "Copyright \u00A9"; // unicode
const buz = "Copyright \xA9"; // hexadecimal

Version

This rule was introduced in ESLint v0.0.9.

Resources

Edit this page
© OpenJS Foundation and ESLint contributors, www.openjsf.org. Content licensed under MIT License.
Change Language

AltStyle によって変換されたページ (->オリジナル) /