Enhancement: [strict-boolean-expressions] Check truthiness assertion functions #9009
Open
4 tasks done
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
enhancement: plugin rule option
New rule option for an existing eslint-plugin rule
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/strict-boolean-expressions/
Description
For example,
ok
fromnode:assert
has the following shape:It appears that currently the rule just looks at
value
, seesunknown
, and moves on. So it's possible to write this:Instead, it would be nice if it also looked at the return type and took
asserts value
into account, treating it asif (!value) throw
. There's more toasserts
than just checking truthiness, but handling the simplest case (nois
) would already go a long way, as that covers allok
-like assertion functions out there.Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: