Skip to content

Commit 78353e7

Browse files
diemolclaude
andcommitted
Migrate to ESLint flat config and unblock ESLint 10 upgrade
eslint-plugin-import has no release supporting ESLint 10 (peer range caps at ^9), and ESLint 10 removed legacy .eslintrc.js support entirely. Replace .eslintrc.js/.eslintignore with a flat eslint.config.js and swap eslint-plugin-import for the actively maintained eslint-plugin-import-x fork. Fix issues the migration surfaced: stale import/no-unresolved disable comments (old plugin namespace), missing error causes on rethrown errors and an unused var/binding flagged by new rules in ESLint's expanded recommended set, and a pre-existing test:lint glob bug where `./src/**/*.js` wasn't expanding recursively under sh, silently skipping top-level src files in CI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 66a099d commit 78353e7

9 files changed

Lines changed: 1051 additions & 549 deletions

File tree

.eslintignore

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

.eslintrc.js

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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ tests/typings/dist
6262

6363
build
6464
/*.js
65-
!.eslintrc.js
65+
!eslint.config.js
6666
!jest.config.js
6767
!babel.config.js
6868
.idea/

eslint.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const js = require('@eslint/js');
2+
const importX = require('eslint-plugin-import-x');
3+
const prettierConfig = require('eslint-config-prettier');
4+
const globals = require('globals');
5+
6+
module.exports = [
7+
{
8+
ignores: [
9+
'**/node_modules/**',
10+
'**/*.mustache',
11+
'**/*.snap',
12+
'build/**',
13+
'.husky/**',
14+
'**/*.html',
15+
'coverage/**',
16+
'.vscode/**',
17+
'**/dist/**',
18+
],
19+
},
20+
js.configs.recommended,
21+
importX.flatConfigs.errors,
22+
importX.flatConfigs.warnings,
23+
{
24+
languageOptions: {
25+
ecmaVersion: 'latest',
26+
sourceType: 'module',
27+
globals: {
28+
...globals.node,
29+
...globals.es2015,
30+
},
31+
},
32+
rules: {
33+
'import-x/no-unresolved': [2, {commonjs: true, amd: true}],
34+
},
35+
},
36+
{
37+
files: ['tests/**/*.js'],
38+
languageOptions: {
39+
globals: {
40+
...globals.jest,
41+
},
42+
},
43+
},
44+
prettierConfig,
45+
];

0 commit comments

Comments
 (0)