sonarjs/no-nested-conditional
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-nested-conditional": "error",
},
},
];function getReadableStatus(job) {
return job.isRunning() ? "Running" : job.hasErrors() ? "Failed" : "Succeeded "; // Noncompliant
}function getReadableStatus(job) {
if (job.isRunning()) {
return "Running";
}
return job.hasErrors() ? "Failed" : "Succeeded";
}Examples from the ESLint documentation.
sonarjs/no-nested-conditional
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-nested-conditional": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Assignments should not be made from within sub-expressions
Reactive state should not be unconditionally mutated inside Vue's "updated" lifecycle hook
OS commands should not rely on PATH resolution
Unicode Grapheme Clusters should be avoided inside regex character classes
Initial values of parameters, caught exceptions, and loop variables should not be ignored