sonarjs/label-position
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/label-position": "error",
},
},
];Only "while", "do", "for" and "switch" statements should be labelled
myLabel: if (i % 2 == 0) { // Noncompliant
if (i == 12) {
console.log("12");
break myLabel;
}
console.log("Even number, but not 12");
}myLabel: for (i = 0; i < 10; i++) { // Compliant
console.log("Loop");
break myLabel;
}Examples from the ESLint documentation.
sonarjs/label-position
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/label-position": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
React components should not render non-boolean condition values
Opened windows should not have access to the originating page
Assertion arguments should be passed in the correct order
Links with identical accessible names should have identical targets
JWT should be signed and verified with strong cipher algorithms
"switch" statements should not have too many "case" clauses