Is there an ESLint rule that checks the number of logical operators in a conditional expression?

Viewed 82

I am looking for such a rule to see the complexity of the conditional expression.

For example, if the threshold is 5, the following conditional expression would result in an error:

if ((true && false) || ((false || true) && (true || false))) {
  // ...
}

However, the following conditional expression will not produce an error:

if ((true && false) || ((false || true) && true)) {
  // ...
}
1 Answers
Related