eslint-plugin-ava
ESLint rules for AVA
Last updated 5 days ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-ava 
SYNC missed versions from official npm registry.

eslint-plugin-ava Coverage Status

ESLint rules for AVA

Translations: Français

This plugin is bundled in XO. No need to do anything if you're using it.

Propose or contribute a new rule ➡

Install

npm install --save-dev eslint eslint-plugin-ava

Requires ESLint >=10, flat config, and ESM.

Usage

Use a preset config or configure each rule in eslint.config.js.

import eslintPluginAva from 'eslint-plugin-ava';

export default [
	{
		plugins: {
			ava: eslintPluginAva,
		},
		rules: {
			'ava/assertion-arguments': 'error',
			'ava/no-only-test': 'error',
		},
	},
];

Rules

The rules will only activate in test files.

???? Configurations enabled in.
⚠️ Configurations set to warn in.
???? Configurations disabled in.
✅ Set in the recommended configuration.
???? Automatically fixable by the --fix CLI option.
???? Manually fixable by editor suggestions.
❌ Deprecated.

Name Description ???? ⚠️ ???? ???? ????
assertion-arguments Enforce passing correct arguments to assertions. ????
failing-test-url Require a URL in a comment above test.failing().
hooks-order Enforce test hook ordering. ????
max-asserts Limit the number of assertions in a test.
no-async-fn-without-await Require async tests to use await. ????
no-ava-in-dependencies Disallow AVA in dependencies. ????
no-commented-tests Disallow commented-out tests.
no-conditional-assertion Disallow assertions inside conditional statements.
no-duplicate-hooks Disallow duplicate hook declarations.
no-duplicate-modifiers Disallow duplicate test modifiers. ????
no-identical-title Disallow identical test titles.
no-ignored-test-files Disallow tests in ignored files.
no-import-test-files Disallow importing test files.
no-incorrect-deep-equal Disallow using deepEqual with primitives. ????
no-inline-assertions Disallow inline assertions. ????
no-invalid-modifier-chain Disallow invalid modifier chains. ???? ????
no-negated-assertion Disallow negated assertions. ????
no-nested-assertions Disallow nested assertions.
no-nested-tests Disallow nested tests.
no-only-test Disallow test.only(). ????
no-skip-assert Disallow skipping assertions. ????
no-skip-test Disallow skipping tests. ????
no-todo-implementation Disallow giving test.todo() an implementation function. ????
no-todo-test Disallow test.todo(). ????
no-unknown-modifiers Disallow unknown test modifiers. ????
no-useless-t-pass Disallow useless t.pass().
prefer-async-await Prefer async/await over returning a Promise.
prefer-power-assert Enforce using only assertions compatible with power-assert.
prefer-t-regex Prefer t.regex() over RegExp#test() and String#match(). ????
prefer-t-throws Prefer t.throws() or t.throwsAsync() over try/catch.
require-assertion Require that tests contain at least one assertion.
test-title Require tests to have a title. ????
test-title-format Require test titles to match a pattern.
use-t Require test functions to use t as their parameter.
use-t-throws-async-well Require t.throwsAsync() and t.notThrowsAsync() to be awaited. ????
use-t-well Disallow incorrect use of t. ????
use-test Require AVA to be imported as test.
use-true-false Prefer t.true()/t.false() over t.truthy()/t.falsy(). ????

Recommended config

This plugin exports a recommended config that enforces good practices.

import eslintPluginAva from 'eslint-plugin-ava';

export default [
	...eslintPluginAva.configs.recommended,
];

Current Tags

  • 16.0.1                                ...           latest (5 days ago)
  • 7.0.0-rc.1                                ...           next (7 years ago)

62 Versions

  • 16.0.1                                ...           5 days ago
  • 16.0.0                                ...           2 months ago
  • 15.1.0                                ...           9 months ago
  • 15.0.1                                ...           2 years ago
  • 15.0.0                                ...           2 years ago
  • 14.0.0                                ...           3 years ago
  • 13.2.0                                ...           4 years ago
  • 13.1.0                                ...           4 years ago
  • 13.0.0                                ...           5 years ago
  • 12.0.0                                ...           5 years ago
  • 11.0.0                                ...           6 years ago
  • 10.5.0                                ...           6 years ago
  • 10.4.0                                ...           6 years ago
  • 10.3.1                                ...           6 years ago
  • 10.3.0                                ...           6 years ago
  • 10.2.0                                ...           6 years ago
  • 10.1.0                                ...           6 years ago
  • 10.0.1                                ...           6 years ago
  • 10.0.0                                ...           6 years ago
  • 9.0.0                                ...           7 years ago
  • 8.0.0                                ...           7 years ago
  • 7.1.0                                ...           7 years ago
  • 7.0.0                                ...           7 years ago
  • 7.0.0-rc.1                                ...           7 years ago
  • 6.0.0                                ...           7 years ago
  • 5.1.1                                ...           8 years ago
  • 5.1.0                                ...           8 years ago
  • 5.0.0                                ...           8 years ago
  • 4.5.1                                ...           8 years ago
  • 4.5.0                                ...           8 years ago
  • 4.4.0                                ...           8 years ago
  • 4.3.0                                ...           8 years ago
  • 4.2.2                                ...           9 years ago
  • 4.2.1                                ...           9 years ago
  • 4.2.0                                ...           9 years ago
  • 4.1.0                                ...           9 years ago
  • 4.0.1                                ...           9 years ago
  • 4.0.0                                ...           9 years ago
  • 3.1.1                                ...           9 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.5.0                                ...           10 years ago
  • 2.4.0                                ...           10 years ago
  • 2.3.1                                ...           10 years ago
  • 2.3.0                                ...           10 years ago
  • 2.2.1                                ...           10 years ago
  • 2.2.0                                ...           10 years ago
  • 2.1.0                                ...           10 years ago
  • 2.0.1                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.4.1                                ...           10 years ago
  • 1.4.0                                ...           10 years ago
  • 1.3.2                                ...           10 years ago
  • 1.3.1                                ...           10 years ago
  • 1.3.0                                ...           10 years ago
  • 1.2.1                                ...           10 years ago
  • 1.2.0                                ...           10 years ago
  • 1.1.1                                ...           10 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.1.0                                ...           10 years ago
  • 0.0.1                                ...           10 years ago
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 17
Dependencies (7)
Dev Dependencies (14)

Copyright 2013 - present © cnpmjs.org | Home |