Skip to content

regexLetterCasing

Reports inconsistent letter casing in regex sequences.

✅ This rule is included in the ts stylisticStrict presets.

Consistent letter casing in regex escape sequences improves readability and makes patterns easier to compare. This rule enforces:

  • Lowercase for hexadecimal digits in \x, \u, and \u{} escape sequences
  • Lowercase for literal letters in case-insensitive patterns (with the i flag)
  • Uppercase for control character letters in \c escape sequences
/\u000A/;
/\x0A/;
/\u{1F4A9}/u;
/\ca/u;
/Regexp/i;
/[A-Z]/i;

This rule is not configurable.

If your codebase has an established convention of using uppercase hexadecimal digits in escape sequences, or if you prefer a different casing convention than what this rule enforces, you may want to disable it.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.