Skip to content

Latest commit

Β 

History

History
46 lines (32 loc) Β· 1.11 KB

File metadata and controls

46 lines (32 loc) Β· 1.11 KB

no-await-in-promise-methods

πŸ“ Disallow using await in Promise method parameters.

πŸ’Ό This rule is enabled in the following configs: βœ… recommended, β˜‘οΈ unopinionated.

πŸ’‘ This rule is manually fixable by editor suggestions.

Using await on promises passed as arguments to Promise.all(), Promise.allSettled(), Promise.any(), or Promise.race() is likely a mistake.

Examples

// ❌
Promise.all([await promise, anotherPromise]);

// βœ…
Promise.all([promise, anotherPromise]);
// ❌
Promise.allSettled([await promise, anotherPromise]);

// βœ…
Promise.allSettled([promise, anotherPromise]);
// ❌
Promise.any([await promise, anotherPromise]);

// βœ…
Promise.any([promise, anotherPromise]);
// ❌
Promise.race([await promise, anotherPromise]);

// βœ…
Promise.race([promise, anotherPromise]);