ashfaqrafi
ashfaqrafi

Reputation: 500

Error: Unnecessary use of boolean literals in conditional expression

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.

Upvotes: 3

Views: 1681

Answers (1)

Nina Scholz
Nina Scholz

Reputation: 386560

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

return isActiveDate < 0;

Upvotes: 3

Related Questions