noUselessLabel
诊断类别:lint/complexity/noUselessLabel
¥Diagnostic Category: lint/complexity/noUselessLabel
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
no-extra-label
¥Same as:
no-extra-label
禁止不必要的标签。
¥Disallow unnecessary labels.
如果循环不包含嵌套循环或开关,则无需标记循环。
¥If a loop contains no nested loops or switches, labeling the loop is unnecessary.
¥Examples
¥Invalid
code-block.js:2:11 lint/complexity/noUselessLabel FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unnecessary label.
1 │ loop: while(a) {
> 2 │ break loop;
│ ^^^^
3 │ }
4 │
ℹ Safe fix: Remove the unnecessary label.
You can achieve the same result without the label.
2 │ ····break·loop;
│ -----
¥Valid
¥Related links