unicorn/escape-case
Require uppercase hexadecimal digits in escape sequences
fixable
"\xa9" and "\xA9" are the same string. With uppercase digits the value stands out from the lowercase x or u before it, and the same character is written the same way everywhere, so you can search for it.
The rule checks \x, \u and \u{...} escapes in strings, template literals and regular expressions, and the letter in \c escapes in regular expressions. String.raw`...` isn't checked.
--fix changes the digits to uppercase.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"unicorn/escape-case" = "error" # or "warn"Examples#
example.js4 problems
const copyright = "\xa9 2026"Use uppercase characters for the value of the escape sequence.;
const price = `${amount}\u00a0EURUse uppercase characters for the value of the escape sequence.`;
const smile = "\u{1f600}"Use uppercase characters for the value of the escape sequence.;
const escape = /\x1b\[\d+m/Use uppercase characters for the value of the escape sequence.;example.jsNo problems
const copyright = "\xA9 2026";
const price = `${amount}\u00A0EUR`;
const smile = "\u{1F600}";
const escape = /\x1B\[\d+m/;example.jsNo problems
const source = String.raw`\xa9`;