sonarjs/too-many-break-or-continue-in-loop
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/too-many-break-or-continue-in-loop": "error",
},
},
];Loops should not contain more than a single "break" or "continue" statement
for (var i = 1; i <= 10; i++) { // Noncompliant - 2 continue - one might be tempted to add some logic in between
if (i % 2 == 0) {
continue;
}
if (i % 3 == 0) {
continue;
}
alert("i = " + i);
}The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/too-many-break-or-continue-in-loop
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/too-many-break-or-continue-in-loop": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Regular expressions using Unicode character classes or property escapes should enable the unicode flag
Shorthand object properties should be grouped at the beginning or end of an object declaration
Values not convertible to numbers should not be used in numeric comparisons
Local variables should not be declared and then immediately returned or thrown