Replies: 1 comment
-
As per our discussions contributing guide (linked in the discussion template) we don't use discussions for rule proposals. Please file this as an issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
RFC
Given a new rule or
no-floating-promises
rule, when anawait
is encountered AND there are more than one pending promises, the rule will suggest to useawait Promise.allSettled
or to append.catch()
to prevent unexpected behavior that may result in uncaught errors.Additional Info
(Migrated from eslint/eslint#17824 (comment))
In a situation like this, when a promise is awaited (and later fails), while another has already failed, it results in an uncaught error.
In the example below, the failed promise is at the line
const r2 = await p2
, when it throws, the following code never runs and therefore the remaining promises are never awaited.More explanation https://stackoverflow.com/a/69644993/985454
Strangely enough, the
no-floating-promises
rule does not catch these casesBefore you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you!
Beta Was this translation helpful? Give feedback.
All reactions