escapeSequenceCasing
Reports escape sequences with lowercase hexadecimal characters.
✅ This rule is included in the ts stylisticStrict presets.
Enforces a consistent escaped value style by requiring escape sequence values to use uppercase hexadecimal characters. Uppercase characters promote readability by making the escaped value more distinguishable from the identifier.
Examples
Section titled “Examples”Hexadecimal Escape Sequences
Section titled “Hexadecimal Escape Sequences”const foo = "\xa9";const foo = "\xA9";Unicode Escape Sequences
Section titled “Unicode Escape Sequences”const foo = "\ud834";const foo = "\uD834";Unicode Code Point Escape Sequences
Section titled “Unicode Code Point Escape Sequences”const foo = "\u{1d306}";const foo = "\u{1D306}";Control Character Escape Sequences
Section titled “Control Character Escape Sequences”const foo = "\ca";const foo = "\cA";Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your codebase has an established convention of using lowercase escape sequences, or if you don’t care about the casing of escape sequences, you may disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
unicorn/escape-case - Oxlint:
unicorn/escape-case
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.