Description
I am probably missing something, but reading through all of comments in original PR (#699) I couldn't find a reason to include ignoreRhs
option. It probably made sense for strict-boolean-expressions
, but I can't think of any cases where I'd want return items.length && items[0].toUpperCase()
to be reported, since there is no condition part.
At the same time I think RHS should always be reported when used in a condition, like:
function test(foo: { bar: true } | undefined) {
if (foo && foo.bar) {}
// ^^^^^^^
}
(note: items.length && items[0].toUpperCase()
from docs isn't correct example for this rule, since toUpperCase
returns possibly falsy value)
EDIT: Actually, I think it might make sense for this to be behavior for strict-boolean-expressions
as well. Looks like that option was added just to avoid breaking change, see palantir/tslint#4447.