Enhancement: [no-unnecessary-condition] Check truthiness assertion functions #9076
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/no-unnecessary-condition/
Description
This is spinoff from the corresponding issue for strict-boolean-expressions.
Following the conversation from #9009 (comment), it is proposed that strict-boolean-expressions also check the asserting argument of an assertion function as a boolean context for an unnecessary condition.
However, for this rule, that behavior should definitely be behind an option, since assertion functions can often be used to assert that something which appears to be true according to the types actually is true at runtime. Codebases that do so regularly will probably want to disable this behavior.
Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: