no-lonely-if
Forbid `if` statement as the only statement in an `else` block
INFO
☑️ The predefined configuration "mslint:recommended"
enables this rule.
Rule details
This rule prohibits using if
statements as the sole statement within else
blocks.
Example of incorrect code for this rule:
maniascript
main() {
if (A) {
} else {
if (B) {
}
}
if (A) {
} else {
if (B) {
} else if (C) {
}
}
}
Example of correct code for this rule:
maniascript
main() {
if (A) {
} else if (B) {
}
if (A) {
} else if (B) {
} else if (C) {
}
if (A) {
} else {
if (B) {
}
DoSomehting();
}
}