banTruthyFunction
, ban functions from being coerced to boolean in if, switch statements
#7327
jpike88
started this conversation in
Rule suggestion
Replies: 1 comment 2 replies
-
This sounds a lot like typescript-eslint's |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A rule that makes it difficult to accidentaly perform a truthy check on a function is ideal.
We're working with signals where every signal is a function, and it's often normal to do truthy checks on the values of that signal. It's also easy to forget calling the signal to get its actual value.
Yes, this means that it discourages the use of truthy checks if the function is an optional property check (in which case I'd rather have it be the exception, rather than the rule).
Beta Was this translation helpful? Give feedback.
All reactions