Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

strict-boolean-expressions wrongly reports on short-circuit expressions #4

Open
karfau opened this issue Sep 5, 2017 · 3 comments
Open

Comments

@karfau
Copy link
Member

karfau commented Sep 5, 2017

In our current code base we can not use v0.0.4, because the rule strict-boolean-expressions (wich is useful to prevent issues when using strings and numbers as part of boolean expressions,) doesn't know about short-circuit syntax that is heavily used in JSX.
It reports that the last part of the expression is always true.

We either want to fix the tslint rule or create a more lightweight one that just reports usages of number and string values in such expressions.

@karfau
Copy link
Member Author

karfau commented Sep 5, 2017

@YEver please check if the description is matching with what we discussed, or if you want to add anything.

@saurabh2590 saurabh2590 mentioned this issue Oct 23, 2017
@karfau
Copy link
Member Author

karfau commented Feb 28, 2019

PR #81 contains the following:

  • [new-rule-option]strict-boolean-expressions accepts ignore-rhs option to disable checking the right-hand side of the && and || operators as strictly boolean. (#​4159)

Which would allow us to close this issue

@karfau
Copy link
Member Author

karfau commented Mar 15, 2019

The issue can not be closed, the rule still reports all kinds of cases that we believe are not a problem due too the fact that objects and functions are truthy compared to null or undefined, this doesn't seem to be configurable right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant