unicorn/escape-case
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/escape-case": "error",
},
},
];Require escape sequences to use uppercase or lowercase values.
const foo = '\xa9';const foo = '\ud834';const foo = '\u{1d306}';const foo = '\xA9';const foo = '\uD834';const foo = '\u{1D306}';Examples from the ESLint documentation.
unicorn/escape-case
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/escape-case": "error",
},
},
];unicorn/escape-case
unicorn plugin · pedantic
{
"rules": {
"unicorn/escape-case": "error"
}
}Biome does not have this rule.
Prefer .includes() over .indexOf(), .lastIndexOf(), and Array#some() when checking for existence or non-existence.
Disallow instanceof with built-in objects
Require new when creating an error.
Enforce the use of Buffer.from() and Buffer.alloc() instead of the deprecated new Buffer().
Prefer Number static methods over global functions and optionally static properties over global constants.
Enforce throwing TypeError in type checking conditions.