eslint-plugin-async
raw JSON → 0.1.1 verified Sat Apr 25 auth: no javascript abandoned
An ESLint plugin providing linting rules for async functions, specifically focusing on missing await expressions. Version 0.1.1 is the latest and only stable release. It is a small, early-stage plugin with limited rules (e.g., 'missing-await-in-async-fn'). No recent updates; development appears stagnant.
Common errors
error Error: ESLint configuration in .eslintrc is invalid: - Unexpected top-level property "async" ↓
cause Putting rule configuration directly under 'async' key instead of inside 'rules' object.
fix
Ensure rules are under 'rules' key: {"rules": {"async/missing-await-in-async-fn": 1}}
error Error: Failed to load plugin 'async' declared in '.eslintrc': Cannot find module 'eslint-plugin-async' ↓
cause Plugin not installed or installed globally but ESLint is local.
fix
Run 'npm install --save-dev eslint-plugin-async' in your project.
Warnings
gotcha The plugin is no longer maintained; it has only one rule and may not work with newer ESLint versions. ↓
fix Consider using eslint-plugin-unicorn's 'no-empty-await' or custom rules instead.
gotcha The rule 'missing-await-in-async-fn' does not check for a common case: promise returned without await inside async function. ↓
fix Alternatively, use ESLint's built-in 'require-await' rule (ESLint >= 3.11.0) which also catches functions that can be synchronous.
Install
npm install eslint-plugin-async yarn add eslint-plugin-async pnpm add eslint-plugin-async Imports
- plugin wrong
plugins: ['eslint-plugin-async']correctplugins: ['async'] - missing-await-in-async-fn wrong
"missing-await-in-async-fn": 1correct"async/missing-await-in-async-fn": 1
Quickstart
// .eslintrc.json
{
"plugins": ["async"],
"rules": {
"async/missing-await-in-async-fn": "error"
}
}
// Example file: test.js
async function doSomething() {
// This will trigger the rule because await is missing
Promise.resolve();
}