This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Rule proposal: require async
for Promise
returning methods.
#1699
Milestone
I'd like to have a lint rule that requires the
async
modifier be attached to any method that returns aPromise
.Reasoning:
foo(): Promise<T>
can (technically) either return a rejected promise or bubble a standard synchronous Error object. No sane API is designed to use both error paths, because it requires any consumer use two separate error handling constructs at any exception handling point.In my codebase I'd like to require that any method that returns a
Promise
also be markedasync
, becauseasync
methods automatically catch synchronous exceptions and convert them into rejected promises. This would prevent accidental synchronous exceptions in async codepaths.The text was updated successfully, but these errors were encountered: