✅ The extends: 'recommended' property in a configuration file enables this rule.
It can be hard to reason about negated conditions:
if (not condition)unless (not condition)
Negated conditions can often be avoided or simplified by:
- Flipping
{{if (not condition)}} {{prop1}} {{else}} {{prop2}} {{/if}}to{{if condition}} {{prop2}} {{else}} {{prop1}} {{/if}} - Replacing
if (not condition)withunless condition - Replacing
unless (not condition)withif condition
This rule forbids the following:
And similar examples with non-block forms like:
This rule allows the following:
And similar examples with non-block forms like:
- no-negated-condition from eslint