unicorn/no-hex-escape Pedantic
What it does
Enforces a convention of using Unicode escapes instead of hexadecimal escapes for consistency and clarity.
Why is this bad?
Using hexadecimal escapes can be less readable and harder to understand when compared to Unicode escapes.
Examples
Examples of incorrect code for this rule:
javascript
const foo = "\x1B";
const foo = `\x1B${bar}`;Examples of correct code for this rule:
javascript
const foo = "\u001B";
const foo = `\u001B${bar}`;How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"rules": {
"unicorn/no-hex-escape": "error"
}
}bash
oxlint --deny unicorn/no-hex-escape