sonarjs/prefer-single-boolean-return
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/prefer-single-boolean-return": "error",
},
},
];Return of boolean expressions should not be wrapped into an "if-then-else" statement
The documentation shows no incorrect example for this rule.
return expression;return !!expression;Examples from the ESLint documentation.
sonarjs/prefer-single-boolean-return
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/prefer-single-boolean-return": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
"RegExp.exec()" should be preferred over "String.match()"
The most specific assertion should be used
Debugging features should not be enabled in production