Skip to main content

no-equal-nested-conditions

added in: 1.7.0

Warns when an if statement contains another if statement with the same condition.

Example

❌ Bad:

if (value == 1) {
// LINT
if (value == 1) {
...
}
}

if (value == 1) {
...

// LINT
if (value == 1) {
...
}
}

✅ Good:

if (value != 1) {
if (value == 1) {
...
}
}

if (value != 1) {
...

if (value == 1) {
...
}
}