no-labels
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-labels": "error",
},
},
];label:
while(true) {
// ...
}
label:
while(true) {
break label;
}
label:
while(true) {
continue label;
}
label:
switch (a) {
case 0:
break label;
}
label:
{
break label;
}
label:
if (a) {
break label;
}const f = {
label: "foo"
};
while (true) {
break;
}
while (true) {
continue;
}Examples from the ESLint documentation.
no-labels
eslint
export default [
{
rules: {
"no-labels": "error",
},
},
];no-labels
eslint plugin · style
{
"rules": {
"no-labels": "error"
}
}suspicious/noConfusingLabels
suspicious · since 1.0.0
{
"linter": {
"rules": {
"suspicious": {
"noConfusingLabels": "error"
}
}
}
}Disallow the use of eval()-like methods
Disallow octal escape sequences in string literals
Enforce return statements in callbacks of array methods