Skip to content

Commit d7f203c

Browse files
authored
chore: migrate to ESLint v9 and update deps (#902)
- Migrate to ESLint flat config - Switch from `eslint-config-standard` to `neostandard` as the former does not support ESLint v9 and seems to be unmaintained. - Conform to the rules of the ESLint plugins/configs. - Update all dependencies to their latest versions.
1 parent 3cb5255 commit d7f203c

24 files changed

+76
-45
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 17 deletions
This file was deleted.

bin/git-node.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ Promise.all(commandFiles.map(importCommand)).then((commands) => {
2727
.epilogue(epilogue)
2828
.help('help')
2929
.parse();
30+
}).catch((err) => {
31+
throw err;
3032
});

components/git/metadata.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,6 @@ export function handler(argv) {
9090
if (status === false) {
9191
throw new Error(IGNORE);
9292
}
93+
return undefined;
9394
}));
9495
}

eslint.config.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import neostandard from 'neostandard';
4+
import nodePlugin from 'eslint-plugin-n';
5+
import pluginPromise from 'eslint-plugin-promise';
6+
import importPlugin from 'eslint-plugin-import';
7+
8+
export default [
9+
pluginJs.configs.recommended,
10+
...neostandard(),
11+
nodePlugin.configs['flat/recommended'],
12+
pluginPromise.configs['flat/recommended'],
13+
importPlugin.flatConfigs.recommended,
14+
{
15+
ignores: [
16+
'**/.git',
17+
'**/.nyc_output',
18+
'coverage/',
19+
'node_modules/',
20+
'lib/wpt/templates/',
21+
],
22+
},
23+
{
24+
languageOptions: {
25+
globals: globals.node,
26+
sourceType: 'module',
27+
ecmaVersion: 'latest',
28+
},
29+
rules: {
30+
'@stylistic/semi': ['error', 'always'],
31+
'@stylistic/space-before-function-paren': ['error', 'never'],
32+
'@stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }],
33+
camelcase: 'off',
34+
'@stylistic/max-len': [
35+
2,
36+
100,
37+
4,
38+
{ ignoreRegExpLiterals: true, ignoreUrls: true },
39+
],
40+
'@stylistic/object-property-newline': 'off',
41+
'promise/always-return': ['error', { ignoreLastCallback: true }],
42+
'n/no-process-exit': 'off',
43+
'n/no-unsupported-features/node-builtins': 'off',
44+
},
45+
},
46+
];

lib/ci/build-types/health_build.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class Health {
2020
formatAsMarkdown() {
2121
const { success, pending, aborted, failed, unstable, count } = this;
2222
const rate = `${(success / (count - pending - aborted) * 100).toFixed(2)}%`;
23-
// eslint-disable-next-line max-len
24-
let result = '| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n';
25-
// eslint-disable-next-line max-len
26-
result += '| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n';
23+
let result =
24+
'| UTC Time | RUNNING | SUCCESS | UNSTABLE | ABORTED | FAILURE | Green Rate |\n';
25+
result +=
26+
'| ---------------- | ------- | ------- | -------- | ------- | ------- | ---------- |\n';
2727
const time = new Date().toISOString().slice(0, 16).replace('T', ' ');
2828
result += `| ${time} | ${pad(pending, 7)} | ${pad(success, 8)}|`;
2929
result += ` ${pad(unstable, 8)} | ${pad(aborted, 7)} | ${pad(failed, 7)} |`;

lib/ci/build-types/test_build.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ export class TestBuild extends Job {
7676
return result;
7777
}
7878
}
79+
80+
return undefined;
7981
}
8082

8183
get commit() {

lib/ci/ci_failure_parser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ const FAILURE_FILTERS = [{
204204
context: { index: 0, contextBefore: 0, contextAfter: 0 }
205205
}, {
206206
pattern:
207-
// eslint-disable-next-line max-len
208207
/error: Your local changes to the following files[\s\S]+Failed to merge in the changes./g,
209208
context: { index: 0, contextBefore: 0, contextAfter: 0 }
210209
}, {

lib/cli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export default class CLI {
8181
return defaultAnswer;
8282
}
8383

84+
// eslint-disable-next-line import/namespace -- Plugin can't validate computed reference here
8485
const answer = await inquirer[questionType]({
8586
message: question,
8687
default: defaultAnswer

lib/collaborators.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,13 @@ function parseCollaborators(readme, cli) {
105105

106106
// We also assume that TSC & TSC Emeriti are also listed as collaborators
107107
CONTACT_RE.lastIndex = tscIndex;
108-
// eslint-disable-next-line no-cond-assign
109108
while ((m = CONTACT_RE.exec(readme)) && CONTACT_RE.lastIndex < tscrIndex) {
110109
const login = m[1].toLowerCase();
111110
const user = new Collaborator(m[1], m[2], m[3], TSC);
112111
collaborators.set(login, user);
113112
}
114113

115114
CONTACT_RE.lastIndex = clIndex;
116-
// eslint-disable-next-line no-cond-assign
117115
while ((m = CONTACT_RE.exec(readme)) &&
118116
CONTACT_RE.lastIndex < cleIndex) {
119117
const login = m[1].toLowerCase();

0 commit comments

Comments
 (0)