Skip to content

Commit bd8c4c6

Browse files
committed
Require Node.js 14 and ESLint 8
1 parent 33dbbc7 commit bd8c4c6

21 files changed

+46
-47
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
node-version: [^12.22, ^14.17, ^16.4]
16+
node-version: [^14.17, ^16.4]
1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v2
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-node@v3
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222
- run: npm install --no-audit
2323
- run: npm test
24-
- uses: codecov/codecov-action@v2
24+
- uses: codecov/codecov-action@v3
2525

2626
integration:
2727
name: Integration tests
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v2
31-
- uses: actions/setup-node@v2
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
3232
- run: npm install --no-audit
3333
- run: npm run integration
34-
- uses: codecov/codecov-action@v2
34+
- uses: codecov/codecov-action@v3

create-ava-rule.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,36 +188,36 @@ module.exports = () => {
188188

189189
/* eslint quote-props: [2, "as-needed"] */
190190
const predefinedRules = {
191-
ImportDeclaration: node => {
191+
ImportDeclaration(node) {
192192
if (!isTestFile && avaImportDeclarationAsts.some(ast => isDeepStrictEqual(espurify(node), ast))) {
193193
isTestFile = true;
194194
}
195195
},
196-
VariableDeclarator: node => {
196+
VariableDeclarator(node) {
197197
if (!isTestFile && avaVariableDeclaratorAsts.some(ast => isDeepStrictEqual(espurify(node), ast))) {
198198
isTestFile = true;
199199
}
200200
},
201-
CallExpression: node => {
201+
CallExpression(node) {
202202
if (isTestFunctionCall(node.callee)) {
203203
// Entering test function
204204
currentTestNode = node;
205205
}
206206
},
207-
'CallExpression:exit': node => {
207+
'CallExpression:exit'(node) {
208208
if (currentTestNode === node) {
209209
// Leaving test function
210210
currentTestNode = undefined;
211211
}
212212
},
213-
'Program:exit': () => {
213+
'Program:exit'() {
214214
isTestFile = false;
215215
},
216216
};
217217

218218
return {
219219
hasTestModifier: mod => getTestModifierNames(currentTestNode).includes(mod),
220-
hasNoUtilityModifier: () => {
220+
hasNoUtilityModifier() {
221221
const modifiers = getTestModifierNames(currentTestNode);
222222
return !modifiers.includes('before')
223223
&& !modifiers.includes('beforeEach')

package.json

Lines changed: 5 additions & 5 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": ">=12.22 <13 || >=14.17 <15 || >=16.4"
8+
"node": ">=14.17 <15 || >=16.4"
99
},
1010
"scripts": {
1111
"test": "xo && c8 ava",
@@ -45,18 +45,18 @@
4545
"c8": "^7.7.3",
4646
"chalk": "^4.1.1",
4747
"del": "^6.0.0",
48-
"eslint": "^8.0.1",
48+
"eslint": "^8.26.0",
4949
"eslint-ava-rule-tester": "^4.0.0",
50-
"eslint-plugin-eslint-plugin": "^4.0.1",
50+
"eslint-plugin-eslint-plugin": "^5.0.6",
5151
"execa": "^5.1.1",
5252
"listr": "^0.14.3",
5353
"outdent": "^0.8.0",
5454
"pify": "^5.0.0",
5555
"tempy": "^1.0.1",
56-
"xo": "^0.46.4"
56+
"xo": "^0.52.4"
5757
},
5858
"peerDependencies": {
59-
"eslint": ">=7.22.0"
59+
"eslint": ">=8.26.0"
6060
},
6161
"ava": {
6262
"files": [

rules/assertion-arguments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function isString(node) {
211211

212212
const create = context => {
213213
const ava = createAvaRule();
214-
const options = context.options[0] || {};
214+
const options = context.options[0] ?? {};
215215
const enforcesMessage = Boolean(options.message);
216216
const shouldHaveMessage = options.message !== 'never';
217217

@@ -285,7 +285,7 @@ const create = context => {
285285
const variable = findVariable(context.getScope(), lastArg);
286286
let value;
287287
for (const ref of variable.references) {
288-
value = ref.writeExpr || value;
288+
value = ref.writeExpr ?? value;
289289
}
290290

291291
lastArg = value;

rules/hooks-order.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const buildOrders = names => {
2222
};
2323

2424
const buildMessage = (name, orders, visited) => {
25-
const checks = orders[name] || [];
25+
const checks = orders[name] ?? [];
2626

2727
for (const check of checks) {
2828
const nodeEarlier = visited[check];
@@ -90,7 +90,7 @@ const create = context => {
9090
const sourceCode = context.getSourceCode();
9191

9292
// TODO: Remove `.reduce()` usage.
93-
// eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-object-from-entries
93+
// eslint-disable-next-line unicorn/no-array-reduce
9494
const selectors = checks.reduce((result, check) => {
9595
result[check.selector] = visitIf([
9696
ava.isInTestFile,
@@ -106,10 +106,10 @@ const create = context => {
106106
node,
107107
messageId: message.messageId,
108108
data: message.data,
109-
fix: fixer => {
109+
fix(fixer) {
110110
const tokensBetween = sourceCode.getTokensBetween(nodeEarlier.parent, node.parent);
111111

112-
if (tokensBetween && tokensBetween.length > 0) {
112+
if (tokensBetween?.length > 0) {
113113
return;
114114
}
115115

rules/max-asserts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const create = context => {
1212
const ava = createAvaRule();
1313
// TODO: Convert options to object JSON Schema default works properly
1414
// https://github.com/avajs/eslint-plugin-ava/issues/260
15-
const maxAssertions = context.options[0] || MAX_ASSERTIONS_DEFAULT;
15+
const maxAssertions = context.options[0] ?? MAX_ASSERTIONS_DEFAULT;
1616
let assertionCount = 0;
1717
let nodeToReport;
1818

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const create = context => {
1515
}
1616
};
1717

18-
const isAsync = node => Boolean(node && node.async);
18+
const isAsync = node => Boolean(node?.async);
1919

2020
return ava.merge({
2121
CallExpression: visitIf([

rules/no-identical-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const create = context => {
5252

5353
usedTitleNodes.push(purify(titleNode));
5454
}),
55-
'Program:exit': () => {
55+
'Program:exit'() {
5656
usedTitleNodes = [];
5757
},
5858
});

rules/no-ignored-test-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const create = context => {
2222
])(() => {
2323
hasTestCall = true;
2424
}),
25-
'Program:exit': node => {
25+
'Program:exit'(node) {
2626
if (!hasTestCall) {
2727
return;
2828
}

rules/no-import-test-files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const create = context => {
4747
};
4848

4949
return {
50-
ImportDeclaration: node => {
50+
ImportDeclaration(node) {
5151
validateImportPath(node, node.source.value);
5252
},
53-
CallExpression: node => {
53+
CallExpression(node) {
5454
if (!(node.callee.type === 'Identifier' && node.callee.name === 'require')) {
5555
return;
5656
}

0 commit comments

Comments
 (0)