{"id":19844,"library":"eslint-plugin-no-await-in-promise","title":"eslint-plugin-no-await-in-promise","description":"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.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/hugo-vrijswijk/eslint-plugin-no-await-in-promise","tags":["javascript","eslint","eslintplugin","eslint-plugin","typescript"],"install":[{"cmd":"npm install eslint-plugin-no-await-in-promise","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-no-await-in-promise","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-no-await-in-promise","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin execution","package":"eslint","optional":false}],"imports":[{"note":"v3+ is ESM-only; CommonJS require() will fail. For ESLint flat config, use default import.","wrong":"const noAwaitInPromise = require('eslint-plugin-no-await-in-promise')","symbol":"plugin","correct":"import noAwaitInPromise from 'eslint-plugin-no-await-in-promise'"},{"note":"Access the recommended flat config via the plugin object. Legacy extends pattern removed in v3.","wrong":"require('eslint-plugin-no-await-in-promise').configs.recommended","symbol":"configs.recommended","correct":"noAwaitInPromise.configs.recommended"},{"note":"Direct rule import is ESM-only. Access rules via `noAwaitInPromise.rules` also works.","wrong":"const { rules } = require('eslint-plugin-no-await-in-promise')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-no-await-in-promise'"}],"quickstart":{"code":"// File: eslint.config.js\nimport noAwaitInPromise from 'eslint-plugin-no-await-in-promise';\n\nexport default [\n  noAwaitInPromise.configs.recommended,\n  { rules: { 'no-await-in-promise/no-await-in-promise': 'error' } }\n];\n\n// Test file: test.js\n// Incorrect: await Promise.all([await fetch('/a'), fetch('/b')]);\n// Correct: await Promise.all([fetch('/a'), fetch('/b')]);","lang":"javascript","description":"Demonstrates flat config usage with recommended config and explicit rule override; shows the pattern the rule flags and the fix."},"warnings":[{"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];`","message":"v3.0.0 drops support for ESLint <9, Node <20, and legacy config (`extends: 'plugin:no-await-in-promise/recommended-legacy'`)","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use `import` syntax and ensure your project's `package.json` has `\"type\": \"module\"` or use `.mjs` extension.","message":"v3.0.0 removes CJS support; package is now ESM-only","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Review helper functions manually or combine with other lint rules (e.g., no-async-promise-executor).","message":"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","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify the fix manually; consider extracting the awaited promise outside the Promise.all call.","message":"The auto-fix simply removes the inner await, which may not be semantically correct if the awaited expression has side effects","severity":"gotcha","affected_versions":">=1.1.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to import: `import noAwaitInPromise from 'eslint-plugin-no-await-in-promise'`","cause":"The plugin is ESM-only (v3+), so CommonJS require() fails.","error":"TypeError: require() of ES Module /path/to/node_modules/eslint-plugin-no-await-in-promise/dist/index.js not supported"},{"fix":"Install: `npm install eslint-plugin-no-await-in-promise --save-dev`","cause":"Plugin not installed, or ESLint cannot resolve it (e.g., missing from package.json dependencies, or nested project structure).","error":"ESLint: Failed to load plugin 'no-await-in-promise': Cannot find module 'eslint-plugin-no-await-in-promise'"},{"fix":"Use numeric severity: `'no-await-in-promise/no-await-in-promise': 'error'` or `['error']`","cause":"Rule severity set to a non-numeric value (string, boolean, etc.)","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"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}