sonarjs/no-redundant-boolean
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-redundant-boolean": "error",
},
},
];let someValue = "0";
// ...
if (someValue == true) { /* ... */ }
if (someBooleanValue != true) { /* ... */ }
doSomething(!false);if (someValue && someValue != "0") { /* ... */ }
if (!someBooleanValue) { /* ... */ }
doSomething(true);Examples from the ESLint documentation.
sonarjs/no-redundant-boolean
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-redundant-boolean": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Wrapper objects should not be used for primitive types
Optional properties should not redundantly include 'undefined'
Initial values of parameters, caught exceptions, and loop variables should not be ignored
HTTP Referrer-Policy should not be set to an unsafe value