menu
no-collapsible-if
Prefer one condition over nested if statements without alternatives
Nested if statements without else branches require both conditions before running the same body.
Instead, you SHOULD join the conditions with && in one if statement.
Reported
1declare function run(): void;2 3function runWhen(ready: boolean, enabled: boolean): void {4 if (ready) {5 if (enabled) {6 run();7 }8 }9}Accepted
1declare function run(): void;2 3function runWhen(ready: boolean, enabled: boolean): void {4 if (ready && enabled) {5 run();6 }7}