You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
New rule to only allow boolean statements in logical expressions #253
changed the title [-]Add rule to only allow boolean statements in logical expression[/-][+]New rule to only allow boolean statements in logical expressions[/+]on Oct 6, 2015
See microsoft/TypeScript#9702 as well, although as far as I can tell they haven't decided to implement this yet. This shouldn't be too hard to do now on our end!
I would really like this to help with not coercing promise-like types to booleans, but I think it would be really nice if we could explicitly enable certain types (strings, numbers) for coercion.
Activity
ashwinr commentedon Dec 18, 2014
the "unless expr is a boolean" might be troublesome since we don't use the typing annotations from the compiler yet. we'll need to investigate that.
adidahiya commentedon Apr 24, 2015
I think the new TS APIs have support for type information about nodes. This should be doable.
adidahiya commentedon Oct 6, 2015
blocked on #680
[-]Add rule to only allow boolean statements in logical expression[/-][+]New rule to only allow boolean statements in logical expressions[/+]2 remaining items
jkillian commentedon Aug 19, 2016
See microsoft/TypeScript#9702 as well, although as far as I can tell they haven't decided to implement this yet. This shouldn't be too hard to do now on our end!
Sammons commentedon Aug 19, 2016
I would really like this to help with not coercing promise-like types to booleans, but I think it would be really nice if we could explicitly enable certain types (strings, numbers) for coercion.
radykov commentedon Sep 20, 2016
Would it be able to pick up things such as
x = y || z;?I'm unfamiliar with TS APIs and what was meant by nodes
adidahiya commentedon Sep 20, 2016
@radykov
yes, that check should probably be incorporated into this lint rule.
OliverJAsh commentedon Sep 26, 2016
This would be really handy and catch so many bugs.
adidahiya commentedon Feb 26, 2017
fixed via #1820