Socket
Socket
Sign inDemoInstall

eslint-plugin-ava

Package Overview
Dependencies
95
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-ava

ESLint rules for AVA


Version published
Weekly downloads
154K
decreased by-0.55%
Maintainers
2
Install size
2.45 MB
Created
Weekly downloads
 

Readme

Source

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

Usage

Configure it in package.json.

{
	"name": "my-awesome-project",
	"eslintConfig": {
		"env": {
			"es6": true
		},
		"parserOptions": {
			"ecmaVersion": "latest",
			"sourceType": "module"
		},
		"plugins": [
			"ava"
		],
		"rules": {
			"ava/assertion-arguments": "error",
			"ava/...": "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.

Name                     Description💼⚠️🚫🔧💡
assertion-argumentsEnforce passing correct arguments to assertions.🔧
hooks-orderEnforce test hook ordering.🔧
max-assertsEnforce a limit on the number of assertions in a test.
no-async-fn-without-awaitEnsure that async tests use await.
no-duplicate-modifiersEnsure tests do not have duplicate modifiers.
no-identical-titleEnsure no tests have the same title.
no-ignored-test-filesEnsure no tests are written in ignored files.
no-import-test-filesEnsure no test files are imported anywhere.
no-incorrect-deep-equalDisallow using deepEqual with primitives.🔧
no-inline-assertionsEnsure assertions are not called from inline arrow functions.🔧
no-nested-testsEnsure no tests are nested.
no-only-testEnsure no test.only() are present.🔧💡
no-skip-assertEnsure no assertions are skipped.
no-skip-testEnsure no tests are skipped.🔧💡
no-todo-implementationEnsure test.todo() is not given an implementation function.
no-todo-testEnsure no test.todo() is used.
no-unknown-modifiersDisallow the use of unknown test modifiers.
prefer-async-awaitPrefer using async/await instead of returning a Promise.
prefer-power-assertEnforce the use of the asserts that have no power-assert alternative.
prefer-t-regexPrefer using t.regex() to test regular expressions.🔧
test-titleEnsure tests have a title.
test-title-formatEnsure test titles have a certain format.
use-tEnsure test functions use t as their parameter.
use-t-throws-async-wellEnsure that t.throwsAsync() and t.notThrowsAsync() are awaited.🔧
use-t-wellDisallow the incorrect use of t.🔧
use-testEnsure that AVA is imported with test as the variable name.
use-true-falseEnsure that t.true()/t.false() are used instead of t.truthy()/t.falsy().

This plugin exports a recommended config that enforces good practices.

Enable it in your package.json with the extends option:

{
	"name": "my-awesome-project",
	"eslintConfig": {
		"extends": "plugin:ava/recommended"
	}
}

See the ESLint docs for more information about extending config files.

Note: This config will also enable the correct parser options and environment.

Keywords

FAQs

Last updated on 18 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc