sonarjs/prefer-while
eslint-plugin-sonarjs
Safe autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/prefer-while": "error",
},
},
];for (;condition;) { /*...*/ }while (condition) { /*...*/ }Examples from the ESLint documentation.
sonarjs/prefer-while
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/prefer-while": "error",
},
},
];Oxlint does not have this rule.
complexity/useWhile
complexity · since 1.0.0
{
"linter": {
"rules": {
"complexity": {
"useWhile": "error"
}
}
}
}Cognitive Complexity of functions should not be too high
Template literals should not be nested
Alternatives in regular expressions should be grouped when used with anchors
Arguments to built-in functions should match documented types
Callbacks of array methods should have return statements