unicorn/consistent-template-literal-escape Style
What it does
Enforce consistent style for escaping ${ in template literals.
Why is this bad?
Using \${ instead of ${ can improve readability and prevent confusion.
Examples
Examples of incorrect code for this rule:
js
const foo = `$\{a}`;js
const foo = `\$\{a}`;Examples of correct code for this rule:
js
const foo = `\${a}`;How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"rules": {
"unicorn/consistent-template-literal-escape": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
rules: {
"unicorn/consistent-template-literal-escape": "error",
},
});bash
oxlint --deny unicorn/consistent-template-literal-escapeVersion
This rule was added in v1.60.0.
