Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESLint rules for AVA

License

NotificationsYou must be signed in to change notification settings

avajs/eslint-plugin-ava

Repository files navigation

ESLint rules forAVA

Translations:Français

This plugin is bundled inXO. 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 inpackage.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 therecommendedconfiguration.
🔧 Automatically fixable by the--fix CLI option.
💡 Manually fixable byeditor 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 useawait.
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 usingdeepEqual with primitives.🔧
no-inline-assertionsEnsure assertions are not called from inline arrow functions.🔧
no-nested-testsEnsure no tests are nested.
no-only-testEnsure notest.only() are present.🔧💡
no-skip-assertEnsure no assertions are skipped.
no-skip-testEnsure no tests are skipped.🔧💡
no-todo-implementationEnsuretest.todo() is not given an implementation function.
no-todo-testEnsure notest.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 nopower-assert alternative.
prefer-t-regexPrefer usingt.regex() to test regular expressions.🔧
test-titleEnsure tests have a title.
test-title-formatEnsure test titles have a certain format.
use-tEnsure test functions uset as their parameter.
use-t-throws-async-wellEnsure thatt.throwsAsync() andt.notThrowsAsync() are awaited.🔧
use-t-wellDisallow the incorrect use oft.🔧
use-testEnsure that AVA is imported withtest as the variable name.
use-true-falseEnsure thatt.true()/t.false() are used instead oft.truthy()/t.falsy().

Recommended config

This plugin exports arecommended config that enforces good practices.

Enable it in yourpackage.json with theextends option:

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

See theESLint docs for more information about extending config files.

Note: This config will also enable the correctparser options andenvironment.


[8]ページ先頭

©2009-2025 Movatter.jp