no-unnecessary-template-literal
Disallow template literals that contain no expressions.
Targeted pattern scopeโ
This rule matches template literals with zero interpolations:
`plain text``` (empty template)
It reports only when expressions.length === 0.
What this rule reportsโ
This rule reports template literals with zero ${...} expressions.
Why this rule existsโ
Expression-free template literals are typically equivalent to normal string literals but noisier. Requiring plain strings reduces visual overhead.
โ Incorrectโ
const x = `value`;
โ Correctโ
const x = `value ${suffix}`;
const y = "value";
Behavior and migration notesโ
This rule reports only and does not provide an autofix.
Most migrations are straightforward replacements from backticks to single or double-quoted strings.
Optionsโ
This rule has no options.
Additional examplesโ
const title = `Dashboard`;
// โ reported
const title = "Dashboard";
// โ
valid
ESLint flat config exampleโ
import etcMisc from "eslint-plugin-etc-misc";
export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/no-unnecessary-template-literal": "error",
},
},
];
When not to use itโ
Disable this rule if your project intentionally uses expression-free template literals.
Package documentationโ
Rule catalog ID: R048
Further readingโ
Adoption resourcesโ
- Start at warning level in CI, then move to error after cleanup.
- Use focused codemods/autofix batches per package or directory.