Error: Unnecessary use of boolean literals in conditional expression

Viewed 469

I am trying this code with ESLint

Code snippet:

if (disableFutureDates) {
    return isActiveDate < 0 ? true : false; //error
  }

Got this ESLint error: error Unnecessary use of boolean literals in conditional expression.

1 Answers

Just return the result of the condition. The comparison returns a boolean value.

return isActiveDate < 0;
Related