Enhancement: [prefer-promise-reject-errors] Extend to AbortSignals #10717
Labels
enhancement: plugin rule option
New rule option for an existing eslint-plugin rule
evaluating community engagement
we're looking for community engagement on this issue to show that this problem is widely important
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/prefer-promise-reject-errors/
Description
Currently, a user can call
AbortSignal.abort("foo")
ornew AbortController().abort("foo")
with anything. But doing so within afetch
request will throw the provided argument. In contrary aAbortSignal.timeout(1234)
andnew AbortController().abort()
will throw aDOMException
.I'd like to ensure that the arguments should be enforced to be instances of
Error
as well.It could make sense to extend rather this rule: https://typescript-eslint.io/rules/only-throw-error
Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: