This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
strict-boolean-expressions should ignore RHS of &&
and ||
#4158
Labels
&&
and ||
#4158
Idiomatic JavaScript / TypeScript typically treat
||
or&&
operators such that only the left operand is considered a "boolean expression" whereas the RHS might be any value that would be used as a result.Currently an expression like
process.env.PORT || 8080
gives an error withstrict-boolean-expressions
because it rejects the RHS for being "always truthy". This is a common enough pattern it should be accomodated by this rule.This has already been discussed to some degree in #3279 but it doesn't have its own issue tracking it and I'm not sure what it's status is at this point.
I suggest an option to enable checking of the rhs of these operations, default would be not to check.
The text was updated successfully, but these errors were encountered: