no-label-var
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-label-var": "error",
},
},
];var x = foo;
function bar() {
x:
for (;;) {
break x;
}
}// The variable that has the same name as the label is not in scope.
function foo() {
var q = t;
}
function bar() {
q:
for(;;) {
break q;
}
}Examples from the ESLint documentation.
no-label-var
eslint
export default [
{
rules: {
"no-label-var": "error",
},
},
];no-label-var
eslint plugin · style
{
"rules": {
"no-label-var": "error"
}
}suspicious/noLabelVar
suspicious · since 1.0.0
{
"linter": {
"rules": {
"suspicious": {
"noLabelVar": "error"
}
}
}
}Require constructor names to begin with a capital letter
Disallow initializing variables to undefined
Enforce default clauses in switch statements to be last