sindresorhus/eslint-plugin-unicorn

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

Chiusa

#1427 aperta il 16 lug 2021

 (9 commenti) (1 reazione) (0 assegnatari)JavaScript (468 fork)user submission
help wantednew rule

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 4h 30m) (26 PR mergiate in 30 g)

Descrizione

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);

Guida contributor