close

no-await-in-promise-methods

Unreleased

Configuration

PresetConfigured Value
✅ unicornPlugin.configs.recommended"error"
rslint.config.ts
import { defineConfig, unicornPlugin } from '@rslint/core';

export default defineConfig([
  unicornPlugin.configs.recommended,
  {
    rules: {
      'unicorn/no-await-in-promise-methods': 'error',
    },
  },
]);

Rule Details

Disallow using await on promises passed directly to Promise.all(), Promise.allSettled(), Promise.any(), or Promise.race(). Awaiting an individual promise before passing it to one of these methods prevents that promise from running concurrently with the others and is likely a mistake.

Examples of incorrect code for this rule:

Promise.all([await promise, anotherPromise]);
Promise.allSettled([await promise, anotherPromise]);
Promise.any([await promise, anotherPromise]);
Promise.race([await promise, anotherPromise]);

Examples of correct code for this rule:

Promise.all([promise, anotherPromise]);
Promise.allSettled([promise, anotherPromise]);
Promise.any([promise, anotherPromise]);
Promise.race([promise, anotherPromise]);

Original Documentation