New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@typescript-eslint/strict-boolean-expressions overly strict #4
Comments
My motivation for enabling this rule is that I’ve encountered production bugs due to javascript’s implicit boolean casting, particularly easy to overlook when mapping over values where values like So things like this lead to bugs (Here third cell will incorrectly claim to be an empty cell): const cells = [42, 15, 0, 12]
cells.map(cell => (
<td>{cell ? cell : “Empty cell”}</td>
)) We dealt with it by using Lodash’s Some of the options do make it easier to breathe, but I would hesitate to disable the rule for new projects without knowing when/if those options will be added, since it’s easier to add these validations when writing the code rather than after the fact as you saw with Encoda. |
Yeah, I can definitely see the use of this rule for |
Originally posted by @alex-ketch in #63 (comment) |
I find the
@typescript-eslint/strict-boolean-expressions
lint rule a bit painful and have turned it off in Encoda because it makes heavy use of expressions likevariable && variable.prop
andvariable || 'default'
.I cant' find a good rationale for this rule, especially for
null
andundefined
. The TSLint docs, whence this rule came, offer no insight: https://palantir.github.io/tslint/rules/strict-boolean-expressions/.Others also think this rule is too strict by default typescript-eslint/typescript-eslint#698. I suggest that until some of those options are available that we remove this rule.
The text was updated successfully, but these errors were encountered: