npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

eslint-plugin-ava

16.0.1

@sindresorhus

npmHomeRepoSnykSocket
Downloads:14801180
$ npm install eslint-plugin-ava
DailyWeeklyMonthlyYearly

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-argumentsEnforce passing correct arguments to assertions.βœ…πŸ”§
failing-test-urlRequire a URL in a comment above test.failing().βœ…
hooks-orderEnforce test hook ordering.βœ…πŸ”§
max-assertsLimit the number of assertions in a test.βœ…
no-async-fn-without-awaitRequire async tests to use await.βœ…πŸ’‘
no-ava-in-dependenciesDisallow AVA in dependencies.βœ…πŸ”§
no-commented-testsDisallow commented-out tests.βœ…
no-conditional-assertionDisallow assertions inside conditional statements.βœ…
no-duplicate-hooksDisallow duplicate hook declarations.βœ…
no-duplicate-modifiersDisallow duplicate test modifiers.βœ…πŸ”§βŒ
no-identical-titleDisallow identical test titles.βœ…
no-ignored-test-filesDisallow tests in ignored files.βœ…
no-import-test-filesDisallow importing test files.βœ…
no-incorrect-deep-equalDisallow using deepEqual with primitives.βœ…πŸ”§
no-inline-assertionsDisallow inline assertions.βœ…πŸ”§
no-invalid-modifier-chainDisallow invalid modifier chains.βœ…πŸ”§πŸ’‘
no-negated-assertionDisallow negated assertions.βœ…πŸ”§
no-nested-assertionsDisallow nested assertions.βœ…
no-nested-testsDisallow nested tests.βœ…
no-only-testDisallow test.only().βœ…πŸ’‘
no-skip-assertDisallow skipping assertions.βœ…πŸ’‘
no-skip-testDisallow skipping tests.βœ…πŸ’‘
no-todo-implementationDisallow giving test.todo() an implementation function.βœ…πŸ’‘
no-todo-testDisallow test.todo().βœ…πŸ’‘
no-unknown-modifiersDisallow unknown test modifiers.βœ…πŸ’‘βŒ
no-useless-t-passDisallow useless t.pass().βœ…
prefer-async-awaitPrefer async/await over returning a Promise.βœ…
prefer-power-assertEnforce using only assertions compatible with power-assert.βœ…
prefer-t-regexPrefer t.regex() over RegExp#test() and String#match().βœ…πŸ”§
prefer-t-throwsPrefer t.throws() or t.throwsAsync() over try/catch.βœ…
require-assertionRequire that tests contain at least one assertion.βœ…
test-titleRequire tests to have a title.βœ…πŸ”§
test-title-formatRequire test titles to match a pattern.βœ…
use-tRequire test functions to use t as their parameter.βœ…
use-t-throws-async-wellRequire t.throwsAsync() and t.notThrowsAsync() to be awaited.βœ…πŸ”§
use-t-wellDisallow incorrect use of t.βœ…πŸ”§
use-testRequire AVA to be imported as test.βœ…
use-true-falsePrefer 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,
];