Registry / testing / eslint-plugin-no-await-in-promise

eslint-plugin-no-await-in-promise

JSON →
library3.0.1jsnpmunverified

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.

npm install eslint-plugin-no-await-in-promise
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-NO-A
E
eslint-plugin-no-await-in-promise
testingjavascriptv3.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
import noAwaitInPromise from 'eslint-plugin-no-await-in-promise'
const noAwaitInPromise = require('eslint-plugin-no-await-in-promise')
v3+ is ESM-only; CommonJS require() will fail. For ESLint flat config, use default import.
configs.recommended
noAwaitInPromise.configs.recommended
require('eslint-plugin-no-await-in-promise').configs.recommended
Access the recommended flat config via the plugin object. Legacy extends pattern removed in v3.
rules
import { rules } from 'eslint-plugin-no-await-in-promise'
const { rules } = require('eslint-plugin-no-await-in-promise')
Direct rule import is ESM-only. Access rules via `noAwaitInPromise.rules` also works.

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')]);
Debug
Known issues
breakingv3.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];`
affects: >=3.0.0
breakingv3.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.
affects: >=3.0.0
gotchaThe 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).
affects: >=1.0.0
gotchaThe 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.
affects: >=1.1.1
Errors
Common errors & fixes
TypeError: require() of ES Module /path/to/node_modules/eslint-plugin-no-await-in-promise/dist/index.js not supported
The plugin is ESM-only (v3+), so CommonJS require() fails.
fix
Switch to import: `import noAwaitInPromise from 'eslint-plugin-no-await-in-promise'`
ESLint: Failed to load plugin 'no-await-in-promise': Cannot find module 'eslint-plugin-no-await-in-promise'
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`
ESLint: Configuration for rule 'no-await-in-promise/no-await-in-promise' is invalid: severity must be one of the following: 0, 1, 2
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']`
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin execution
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-no-await-in-promise — npm install eslint-plugin-no-await-in-promise · libregistry