noUselessLabel
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/complexity/noUselessLabel¥Diagnostic Category:
lint/complexity/noUselessLabel -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
-
来源:
¥Sources:
-
与
no-extra-label相同¥Same as
no-extra-label
-
¥How to configure
{ "linter": { "rules": { "complexity": { "noUselessLabel": "error" } } }}¥Description
禁止不必要的标签。
¥Disallow unnecessary labels.
如果循环不包含嵌套循环或开关,则无需标记循环。
¥If a loop contains no nested loops or switches, labeling the loop is unnecessary.
¥Examples
¥Invalid
loop: while(a) { break loop;}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
outer: while(a) { while(b) { break outer; }}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号