no-negated-condition
Forbid negated conditions
INFO
☑️ The predefined configuration "mslint:recommended" enables this rule.
Rule details
This rule prohibits negated conditions in if statements that have an else clause.
Example of incorrect code for this rule:
maniascript
main() {
if (!A) {
DoSomething();
} else {
DoAnotherThing();
}
if (B != C) {
DoSomething();
} else {
DoAnotherThing();
}
}Example of correct code for this rule:
maniascript
main() {
if (!A) {
DoSomething();
}
if (B != C) {
DoSomething();
}
if (!D) {
DoSomething();
} else if (E) {
DoAnotherThing();
}
}