跳转到内容

noUnusedTemplateLiteral

此内容尚不支持你的语言。

Diagnostic Category: lint/style/noUnusedTemplateLiteral

Since: v1.0.0

Disallow template literals if interpolation and special-character handling are not needed

const foo = `bar`
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

const foo = `bar `
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

const foo = `bar
has newline`;
const foo = `"bar"`
const foo = `'bar'`