eslint-plugin-no-await-in-promise

raw JSON →
3.0.1 verified Sat Apr 25 auth: no javascript

ESLint plugin that flags and auto-fixes usage of `await` inside `Promise.all`, `Promise.race`, `Promise.allSettled`, and `Promise.any` callbacks. Version 3.0.1 requires ESLint ≥9 and Node ≥20, ships TypeScript types, and uses ESM flat config exclusively (no legacy `.eslintrc` support). Differentiates from generic promise linters by focusing solely on this footgun pattern, providing a single highly specific rule with a recommended config and automatic fix.

error TypeError: require() of ES Module /path/to/node_modules/eslint-plugin-no-await-in-promise/dist/index.js not supported
cause The plugin is ESM-only (v3+), so CommonJS require() fails.
fix
Switch to import: import noAwaitInPromise from 'eslint-plugin-no-await-in-promise'
error ESLint: Failed to load plugin 'no-await-in-promise': Cannot find module 'eslint-plugin-no-await-in-promise'
cause Plugin not installed, or ESLint cannot resolve it (e.g., missing from package.json dependencies, or nested project structure).
fix
Install: npm install eslint-plugin-no-await-in-promise --save-dev
error ESLint: Configuration for rule 'no-await-in-promise/no-await-in-promise' is invalid: severity must be one of the following: 0, 1, 2
cause Rule severity set to a non-numeric value (string, boolean, etc.)
fix
Use numeric severity: 'no-await-in-promise/no-await-in-promise': 'error' or ['error']
breaking v3.0.0 drops support for ESLint <9, Node <20, and legacy config (`extends: 'plugin:no-await-in-promise/recommended-legacy'`)
fix Upgrade to at least ESLint 9 and Node 20. Use flat config: `import plugin from 'eslint-plugin-no-await-in-promise'; export default [plugin.configs.recommended];`
breaking v3.0.0 removes CJS support; package is now ESM-only
fix Use `import` syntax and ensure your project's `package.json` has `"type": "module"` or use `.mjs` extension.
gotcha The rule only checks await directly inside Promise methods – it does not catch cases where await is in a helper function called within Promise.all
fix Review helper functions manually or combine with other lint rules (e.g., no-async-promise-executor).
gotcha The auto-fix simply removes the inner await, which may not be semantically correct if the awaited expression has side effects
fix Verify the fix manually; consider extracting the awaited promise outside the Promise.all call.
npm install eslint-plugin-no-await-in-promise
yarn add eslint-plugin-no-await-in-promise
pnpm add eslint-plugin-no-await-in-promise

Demonstrates flat config usage with recommended config and explicit rule override; shows the pattern the rule flags and the fix.

// File: eslint.config.js
import noAwaitInPromise from 'eslint-plugin-no-await-in-promise';

export default [
  noAwaitInPromise.configs.recommended,
  { rules: { 'no-await-in-promise/no-await-in-promise': 'error' } }
];

// Test file: test.js
// Incorrect: await Promise.all([await fetch('/a'), fetch('/b')]);
// Correct: await Promise.all([fetch('/a'), fetch('/b')]);