Skip to content

Commit 1dfad47

Browse files
authored
Merge pull request #998 from sir-gon/develop
Many fixes to upgrade Eslint from 9.x to 10.x
2 parents 50b0b25 + fd601c0 commit 1dfad47

13 files changed

Lines changed: 775 additions & 623 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
19-
node-version: [18.x, 20.x, 22.x]
19+
node-version: [22.x, 24.x, 26.x]
2020
# See supported Node.js release schedule
2121
# at https://nodejs.org/en/about/releases/
2222

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ coverage: test
9595

9696
coverage/html: coverage
9797
@if [ "$$(uname)" = "Darwin" ]; then \
98-
open ./coverage/lcov-report/index.htmll; \
98+
open ./coverage/lcov-report/index.html; \
9999
elif [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "mingw32" ] || [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "mingw64" ] || [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "cygwin" ]; then \
100100
cmd /c start ./coverage/lcov-report/index.htmll; \
101101
else \

eslint.config.mjs

Lines changed: 28 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,52 @@
1-
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
2-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
3-
import _import from 'eslint-plugin-import';
1+
import neostandard from 'neostandard';
2+
import tseslint from 'typescript-eslint';
43
import jest from 'eslint-plugin-jest';
54
import prettier from 'eslint-plugin-prettier';
6-
import tsParser from '@typescript-eslint/parser';
7-
import path from 'node:path';
8-
import { fileURLToPath } from 'node:url';
9-
import js from '@eslint/js';
10-
import { FlatCompat } from '@eslint/eslintrc';
5+
import prettierConfig from 'eslint-config-prettier';
116

12-
const __filename = fileURLToPath(import.meta.url);
13-
const __dirname = path.dirname(__filename);
14-
const compat = new FlatCompat({
15-
baseDirectory: __dirname,
16-
recommendedConfig: js.configs.recommended,
17-
allConfig: js.configs.all
18-
});
19-
20-
export default [
7+
export default tseslint.config(
8+
...neostandard({
9+
ts: true,
10+
}),
2111
{
22-
ignores: ['**/coverage', '**/dist', '**/node_modules', '**/*.js']
12+
ignores: ['**/coverage', '**/dist', '**/node_modules', 'eslint.config.mjs'],
2313
},
24-
...fixupConfigRules(
25-
compat.extends(
26-
'eslint:recommended',
27-
'plugin:@typescript-eslint/eslint-recommended',
28-
'plugin:@typescript-eslint/recommended',
29-
'plugin:@typescript-eslint/recommended-type-checked',
30-
'plugin:@typescript-eslint/stylistic-type-checked',
31-
'airbnb-base',
32-
'prettier',
33-
'plugin:import/recommended',
34-
'plugin:import/errors',
35-
'plugin:import/warnings',
36-
'plugin:jest/all'
37-
)
38-
),
3914
{
40-
plugins: {
41-
'@typescript-eslint': fixupPluginRules(typescriptEslint),
42-
import: fixupPluginRules(_import),
43-
jest: fixupPluginRules(jest),
44-
prettier
45-
},
46-
15+
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'],
4716
languageOptions: {
48-
parser: tsParser,
49-
ecmaVersion: 5,
50-
sourceType: 'script',
51-
5217
parserOptions: {
53-
project: true
54-
}
55-
},
56-
57-
settings: {
58-
'import/parsers': {
59-
'@typescript-eslint/parser': ['.ts', '.tsx']
18+
project: true,
6019
},
61-
62-
'import/resolver': {
63-
typescript: {
64-
alwaysTryTypes: true,
65-
project: '.'
66-
}
67-
}
6820
},
69-
21+
plugins: {
22+
jest,
23+
prettier,
24+
},
7025
rules: {
26+
...jest.configs.all.rules,
27+
...prettierConfig.rules,
7128
'prettier/prettier': ['error'],
72-
73-
'import/extensions': [
74-
'error',
75-
'always',
76-
{
77-
pattern: {
78-
ts: 'never'
79-
}
80-
}
81-
],
82-
8329
'no-restricted-syntax': 0,
8430
'no-console': 'off',
8531
'no-underscore-dangle': 0,
86-
8732
'no-plusplus': [
8833
'error',
8934
{
90-
allowForLoopAfterthoughts: true
91-
}
35+
allowForLoopAfterthoughts: true,
36+
},
9237
],
93-
9438
'no-shadow': 'off',
9539
'@typescript-eslint/no-shadow': 'error',
9640
'no-unused-vars': 'off',
97-
'@typescript-eslint/no-unused-vars': 'error',
41+
'@typescript-eslint/no-unused-vars': [
42+
'error',
43+
{
44+
argsIgnorePattern: '^_',
45+
},
46+
],
9847
'no-use-before-define': 'off',
99-
'@typescript-eslint/no-use-before-define': 'error'
100-
}
101-
},
102-
{
103-
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'],
104-
105-
rules: {
106-
'@typescript-eslint/explicit-function-return-type': 'error'
107-
}
108-
},
109-
{
110-
ignores: ["dist/*", "coverage/*", "node_modules/*", "eslint.config.mjs"]
48+
'@typescript-eslint/no-use-before-define': 'error',
49+
'@typescript-eslint/explicit-function-return-type': 'error',
50+
},
11151
}
112-
];
52+
);

0 commit comments

Comments
 (0)