πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§π‘ This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.
Passing a single-element array to Promise.all(), Promise.any(), or Promise.race() is likely a mistake.
// β
const foo = await Promise.all([promise]);
// β
const foo = await Promise.any([promise]);
// β
const foo = await Promise.race([promise]);
// β
const foo = await promise;// β
const promise = Promise.all([nonPromise]);
// β
const promise = Promise.resolve(nonPromise);// β
const foo = await Promise.all(promises);// β
const foo = await Promise.any([promise, anotherPromise]);// β
const [{value: foo, reason: error}] = await Promise.allSettled([promise]);