eslint-plugin-ava
raw JSON → 16.0.1 verified Sat Apr 25 auth: no javascript
An ESLint plugin providing lint rules for the AVA test runner. Current stable version is 16.0.1, released in 2025. It requires Node.js >=20.19 and ESLint >=10 with flat config (ESM-only). Key differentiators: bundled with XO, dedicated to AVA's test API (macros, hooks, assertions), and includes rules like no-conditional-assertion and prefer-t-regex that are specific to AVA's assertion style. Release cadence is irregular with major versions tied to AVA/ESLint breaking changes.
Common errors
error Error: Failed to load plugin 'eslint-plugin-ava' declared in 'plugins': Cannot find module 'eslint-plugin-ava' ↓
cause Missing npm install of eslint-plugin-ava.
fix
Run npm install --save-dev eslint eslint-plugin-ava
error Error: Failed to load plugin 'eslint-plugin-ava' declared in 'plugins': Package 'eslint-plugin-ava' is not ESM (use import instead of require) ↓
cause Using CommonJS require() to load the ESM-only package.
fix
Use import eslintPluginAva from 'eslint-plugin-ava' in an ESM context.
error Error: .eslintrc.js: Configuration for rule 'ava/assertion-arguments' is invalid. Value ["error"] is not a valid severity. ↓
cause Using array syntax for rule severity in flat config (should be string).
fix
Use 'ava/assertion-arguments': 'error' (string) instead of ['error'].
Warnings
breaking v16.0.0: Package is now pure ESM and requires Node.js >=20.19 and ESLint >=10 with flat config. ↓
fix Update to ESM (import, no require) and use ESLint flat config (eslint.config.js).
breaking v15.0.0: Dropped support for Node.js <18 and ESLint <9. ↓
fix Upgrade to Node.js >=18 and ESLint >=9.
breaking v14.0.0: Dropped support for Node.js <14 and ESLint <8. ↓
fix Upgrade to Node.js >=14 and ESLint >=8.
breaking v16.0.0: Move to flat config only; .eslintrc style configs are no longer supported. ↓
fix Migrate to flat config as shown in the quickstart.
deprecated Rules related to callback tests (test.cb()) are deprecated and removed in v13.0.0. ↓
fix Remove callback test patterns; use async tests instead.
Install
npm install eslint-plugin-ava yarn add eslint-plugin-ava pnpm add eslint-plugin-ava Imports
- default wrong
const eslintPluginAva = require('eslint-plugin-ava')correctimport eslintPluginAva from 'eslint-plugin-ava' - configs
import { configs } from 'eslint-plugin-ava' - rules
import { rules } from 'eslint-plugin-ava' - flat config usage wrong
module.exports = { plugins: ['ava'], rules: { 'ava/assertion-arguments': 'error' } }correctimport eslintPluginAva from 'eslint-plugin-ava'; export default [{ plugins: { ava: eslintPluginAva }, rules: { 'ava/assertion-arguments': 'error' } }]
Quickstart
import eslintPluginAva from 'eslint-plugin-ava';
export default [
eslintPluginAva.configs.recommended,
{
rules: {
'ava/assertion-arguments': 'error',
'ava/no-only-test': 'error',
},
},
];