noUnusedTemplateLiteral (since v0.7.0)
This rule is recommended by Rome.
Disallow template literals if interpolation and special-character handling are not needed
Examples
Invalid
const foo = `bar` error[js/noUnusedTemplateLiteral]: Do not use template literals if interpolation and special-character handling are not needed.
┌─ js/noUnusedTemplateLiteral.js:1:13
│
1 │ const foo = `bar`
│ ^^^^^
Suggested fix: Replace with string literal
| @@ -1 +1 @@
0 | - const foo = `bar`
0 | + const foo = "bar"
const foo = `bar ` error[js/noUnusedTemplateLiteral]: Do not use template literals if interpolation and special-character handling are not needed.
┌─ js/noUnusedTemplateLiteral.js:1:13
│
1 │ const foo = `bar `
│ ^^^^^^
Suggested fix: Replace with string literal
| @@ -1 +1 @@
0 | - const foo = `bar `
0 | + const foo = "bar "
Valid
const foo = `bar
has newline`; const foo = `"bar"` const foo = `'bar'`