Ccodemod

codemod/unicorn-escape-uppercase-sequences

Uppercase lowercase hex digits inside JavaScript and TypeScript string escapes, including template static segments, with an opt-in flag for tagged templates.

javascripttypescripteslintunicornescape-sequences
Public
0 executions

Run locally

npx codemod @codemod/unicorn-escape-uppercase-sequences

@codemod/unicorn-escape-uppercase-sequences

Uppercases lowercase hex digits inside JavaScript and TypeScript escape sequences in string literals and template literal static segments.

It rewrites \\x, \\u, and \\u{} escapes such as "\\x1f" to "\\x1F" and `\\u{dead}` to `\\u{DEAD}` without changing runtime semantics.

What It Changes

  • String literals in *.js, *.jsx, *.cjs, *.mjs, *.ts, and *.tsx
  • Template literal static segments
  • Directive literals such as "use strict" when they contain matching escapes

What It Leaves Alone

  • Regex literals such as /\\x1f/
  • Numeric-only payloads such as "\\x12"
  • Already-uppercase escapes
  • Tagged template raw text by default

Use the include-tagged-templates=true workflow param if you want tagged template static text normalized too.

Example

js

becomes:

js

Installation

bash

Usage

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.