noUnusedLabels
诊断类别:lint/correctness/noUnusedLabels
¥Diagnostic Category: lint/correctness/noUnusedLabels
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
no-unused-labels
¥Same as:
no-unused-labels
禁止未使用的标签。
¥Disallow unused labels.
声明但从未使用的标签很可能是由于重构不完整而导致的错误。
¥Labels that are declared and never used are most likely an error due to incomplete refactoring.
该规则忽略 Svelte 组件中的反应式 Svelte 语句。
¥The rule ignores reactive Svelte statements in Svelte components.
¥Examples
¥Invalid
code-block.js:1:1 lint/correctness/noUnusedLabels FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unused label.
> 1 │ LOOP: for (const x of xs) {
│ ^^^^
2 │ if (x > 0) {
3 │ break;
ℹ The label is not used by any break statement and continue statement.
ℹ Safe fix: Remove the unused label.
1 │ LOOP:·for·(const·x·of·xs)·{
│ ------
¥Valid
¥Related links