Skip to content

Commit 809f8c2

Browse files
committed
Require Node.js 8
1 parent 60640f0 commit 809f8c2

22 files changed

+65
-75
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: node_js
22
node_js:
3-
- 11
3+
- 12
44
- 10
55
- 8
6-
- 6
76
before_install: npm install --global npm
87
after_success: npx codecov --file=./coverage/lcov.info

create-ava-rule.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function getTestModifierNames(node) {
6060

6161
module.exports = () => {
6262
let isTestFile = false;
63-
let currentTestNode = null;
63+
let currentTestNode;
6464

6565
/* eslint quote-props: [2, "as-needed"] */
6666
const predefinedRules = {
@@ -83,7 +83,7 @@ module.exports = () => {
8383
'CallExpression:exit': node => {
8484
if (currentTestNode === node) {
8585
// Leaving test function
86-
currentTestNode = null;
86+
currentTestNode = undefined;
8787
}
8888
},
8989
'Program:exit': () => {
@@ -92,7 +92,7 @@ module.exports = () => {
9292
};
9393

9494
return {
95-
hasTestModifier: mod => getTestModifierNames(currentTestNode).indexOf(mod) >= 0,
95+
hasTestModifier: mod => getTestModifierNames(currentTestNode).includes(mod),
9696
hasNoHookModifier: () => {
9797
const modifiers = getTestModifierNames(currentTestNode);
9898
return !modifiers.includes('before') &&

docs/rules/no-only-test.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/re
44

55
It's easy to run only one test with `test.only()` and then forget about it. It's visible in the results, but still easily missed. Forgetting to remove `.only`, means only this one test in the whole file will run, and if not caught, can let serious bugs slip into your codebase.
66

7+
This rule is fixable.
8+
79

810
## Fail
911

docs/rules/no-skip-test.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/re
44

55
It's easy to make a test skipped with test.skip() and then forget about it. It's visible in the results, but still easily missed.
66

7+
This rule is fixable.
8+
79

810
## Fail
911

docs/rules/use-t-well.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/re
44

55
Prevent the use of unknown assertion methods and the access to members other than the assertion methods and `context`, as well as some known misuses of `t`.
66

7-
This rule is partly automatically fixable. It will replace misspelled `falsey` with `falsy`.
7+
This rule is partly fixable. It will replace misspelled `falsey` with `falsy`.
88

99

1010
## Fail

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ module.exports = {
4040
'ava/prefer-async-await': 'error',
4141
'ava/prefer-power-assert': 'off',
4242
'ava/test-ended': 'error',
43-
'ava/test-title': [
44-
'error',
45-
'if-multiple'
46-
],
43+
'ava/test-title': 'error',
4744
'ava/use-t-well': 'error',
4845
'ava/use-t': 'error',
4946
'ava/use-test': 'error',

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"repository": "avajs/eslint-plugin-ava",
77
"engines": {
8-
"node": ">=6"
8+
"node": ">=8"
99
},
1010
"scripts": {
1111
"test": "xo && nyc ava"
@@ -29,26 +29,26 @@
2929
"mocha"
3030
],
3131
"dependencies": {
32-
"arrify": "^1.0.1",
32+
"arrify": "^2.0.1",
3333
"deep-strict-equal": "^0.2.0",
3434
"enhance-visitors": "^1.0.0",
35-
"esm": "^3.0.84",
35+
"esm": "^3.2.25",
3636
"espree": "^5.0.0",
3737
"espurify": "^2.0.0",
3838
"import-modules": "^1.1.0",
39-
"is-plain-object": "^2.0.4",
40-
"multimatch": "^3.0.0",
41-
"pkg-up": "^2.0.0"
39+
"is-plain-object": "^3.0.0",
40+
"multimatch": "^4.0.0",
41+
"pkg-up": "^3.1.0"
4242
},
4343
"devDependencies": {
4444
"ava": "^1.0.1",
4545
"babel-eslint": "^10.0.1",
46-
"codecov": "^3.2.0",
46+
"codecov": "^3.5.0",
4747
"eslint": "^5.12.0",
4848
"eslint-ava-rule-tester": "^3.0.0",
49-
"eslint-plugin-eslint-plugin": "^2.0.1",
49+
"eslint-plugin-eslint-plugin": "2.1.0",
5050
"js-combinatorics": "^0.5.4",
51-
"nyc": "^13.1.0",
51+
"nyc": "^14.1.1",
5252
"pify": "^4.0.1",
5353
"xo": "^0.24.0"
5454
},

readme.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ Configure it in `package.json`.
5858
"ava/prefer-async-await": "error",
5959
"ava/prefer-power-assert": "off",
6060
"ava/test-ended": "error",
61-
"ava/test-title": [
62-
"error",
63-
"if-multiple"
64-
],
61+
"ava/test-title": "error",
6562
"ava/use-t-well": "error",
6663
"ava/use-t": "error",
6764
"ava/use-test": "error",

rules/max-asserts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const create = context => {
99
const ava = createAvaRule();
1010
const maxAssertions = context.options[0] || 5;
1111
let assertionCount = 0;
12-
let nodeToReport = null;
12+
let nodeToReport;
1313

1414
return ava.merge({
1515
CallExpression: visitIf([
@@ -50,7 +50,7 @@ const create = context => {
5050
}
5151

5252
assertionCount = 0;
53-
nodeToReport = null;
53+
nodeToReport = undefined;
5454
})
5555
});
5656
};

rules/no-async-fn-without-await.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const util = require('../util');
55

66
const create = context => {
77
const ava = createAvaRule();
8-
let asyncTest = null;
98
let testUsed = false;
9+
let asyncTest;
1010

1111
const registerUseOfAwait = () => {
1212
if (asyncTest) {
@@ -22,8 +22,7 @@ const create = context => {
2222
ava.isTestNode
2323
])(node => {
2424
asyncTest = (isAsync(node.arguments[0]) && node.arguments[0]) ||
25-
(isAsync(node.arguments[1]) && node.arguments[1]) ||
26-
null;
25+
(isAsync(node.arguments[1]) && node.arguments[1]);
2726
}),
2827
AwaitExpression: registerUseOfAwait,
2928
YieldExpression: registerUseOfAwait,
@@ -39,11 +38,11 @@ const create = context => {
3938
start: asyncTest.loc.start,
4039
end: asyncTest.loc.start + 5
4140
},
42-
message: 'Function was declared as `async` but doesn\'t use `await`'
41+
message: 'Function was declared as `async` but doesn\'t use `await`.'
4342
});
4443
}
4544

46-
asyncTest = null;
45+
asyncTest = undefined;
4746
testUsed = false;
4847
})
4948
});

0 commit comments

Comments
 (0)