noUnusedTemplateLiteral
诊断类别:lint/style/noUnusedTemplateLiteral
¥Diagnostic Category: lint/style/noUnusedTemplateLiteral
自从:v1.0.0
¥Since: v1.0.0
如果不需要插值和特殊字符处理,则禁止使用模板文字
¥Disallow template literals if interpolation and special-character handling are not needed
¥Examples
¥Invalid
code-block.js:1:13 lint/style/noUnusedTemplateLiteral FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not use template literals if interpolation and special-character handling are not needed.
> 1 │ const foo = bar
│ ^^^^^
2 │
ℹ Unsafe fix: Replace with string literal
1 │ - const·foo·=·</strong></span><span style="color: Tomato;">b</span><span style="color: Tomato;">a</span><span style="color: Tomato;">r</span><span style="color: Tomato;"><strong>
1 │ + const·foo·=·“bar”
2 2 │
code-block.js:1:13 lint/style/noUnusedTemplateLiteral FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not use template literals if interpolation and special-character handling are not needed.
> 1 │ const foo = bar
│ ^^^^^^
2 │
ℹ Unsafe fix: Replace with string literal
1 │ - const·foo·=·</strong></span><span style="color: Tomato;">b</span><span style="color: Tomato;">a</span><span style="color: Tomato;">r</span><span style="color: Tomato;"><span style="opacity: 0.8;">·</span></span><span style="color: Tomato;"><strong>
1 │ + const·foo·=·“bar·”
2 2 │
¥Valid
¥Related links