sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-promise-all-settled`

Closed

#1,427 opened on Jul 16, 2021

 (9 comments) (1 reaction) (0 assignees)JavaScript (468 forks)user submission
help wantednew rule

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

Description

Recently, I found I'm starting to use Promise.allSettled() instead of Promise.all(). I only use Promise.all() when all promises are 100% sure safe to resolve, but I'm not sure where is the boundary. I'd like to open up a discussion to see if we can do this safely.

Fail

const foo = await Promise.all(promises);

Pass

const foo = await Promise.allSettled(promises);

Contributor guide