Package Exports
- eslint-plugin-ava
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-ava) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eslint-plugin-ava 
ESLint rules for AVA
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": 6,
"sourceType": "module"
},
"plugins": [
"ava"
],
"rules": {
"ava/max-asserts": [2, 5],
"ava/no-cb-test": 0,
"ava/no-identical-title": 2,
"ava/no-invalid-end": 2,
"ava/no-only-test": 2,
"ava/no-skip-assert": 2,
"ava/no-skip-test": 2,
"ava/no-statement-after-end": 2,
"ava/no-todo-test": 1,
"ava/no-unknown-modifiers": 2,
"ava/prefer-power-assert": 0,
"ava/test-ended": 2,
"ava/test-title": [2, "always"],
"ava/use-t": 2,
"ava/use-test": 2
}
}
}
Rules
The rules will only activate in test files.
- max-asserts - Limit the number of assertions in a test.
- no-cb-test - Ensure no
test.cb()
is used. - no-identical-title - Ensure no tests have the same title.
- no-invalid-end - Ensure
t.end()
is only called insidetest.cb()
. - no-only-test - Ensure no
test.only()
are present. - no-skip-assert - Ensure no assertions are skipped.
- no-skip-test - Ensure no tests are skipped.
- no-statement-after-end - Ensure
t.end()
is the last statement executed. - no-todo-test - Ensure no
test.todo()
is used. - no-unknown-modifiers - Prevent the use of unknown test modifiers.
- prefer-power-assert - Allow only use of the asserts that have no power-assert alternative.
- test-ended - Ensure callback tests are explicitly ended.
- test-title - Ensure tests have a title.
- use-t - Ensure test functions use
t
as their parameter. - use-test - Ensure that AVA is imported with
test
as the variable name.
Recommended configuration
This plugin exports a recommended
configuration that enforces good practices.
To enable this configuration use the extends
property in your package.json
.
{
"name": "my-awesome-project",
"eslintConfig": {
"extends": "plugin:ava/recommended",
"plugins": [
"ava"
]
}
}
See ESLint documentation for more information about extending configuration files.
Note: This configuration will also enable the correct parser options and environment.
Credit
License
MIT © Sindre Sorhus