Skip to content

unicorn/escape-case Pedantic

🛠️ An auto-fix is available for this rule.

What it does

Enforces defining escape sequence values with uppercase characters rather than lowercase ones. This promotes readability by making the escaped value more distinguishable from the identifier.

Why is this bad?

Examples

Examples of incorrect code for this rule:

javascript
const foo = "\xa9";
const foo = "\ud834";
const foo = "\u{1d306}";
const foo = "\ca";

Examples of correct code for this rule:

javascript
const foo = "\xA9";
const foo = "\uD834";
const foo = "\u{1D306}";
const foo = "\cA";

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny unicorn/escape-case
json
{
  "rules": {
    "unicorn/escape-case": "error"
  }
}

References

Released under the MIT License.