sonarjs/misplaced-loop-counter
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/misplaced-loop-counter": "error",
},
},
];"for" loop increment clauses should modify the loops' counters
for (i = 0; i < 10; j++) { // Noncompliant
// ...
i++;
}for (i = 0; i < 10; i++, j++) {
// ...
}for (i = 0; i < 10; i++) {
// ...
j++;
}Examples from the ESLint documentation.
sonarjs/misplaced-loop-counter
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/misplaced-loop-counter": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Lodash and Underscore.js memoize calls on functions with multiple parameters should use an explicit cache key function
"new" should only be used with functions and classes
"switch" statements should not have too many "case" clauses
All branches in a conditional structure should not have exactly the same implementation
Links with identical accessible names should have identical targets
"Array.prototype.sort()" and "Array.prototype.toSorted()" should use a compare function