sonarjs/no-invariant-returns
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-invariant-returns": "error",
},
},
];function foo(a) { // Noncompliant
let b = 12;
if (a) {
return b;
}
return b;
}The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
sonarjs/no-invariant-returns
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-invariant-returns": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Regular expressions should be syntactically valid
Inline snapshots should not contain interpolations