Skip to content

Commit 84b36d5

Browse files
committed
Upgrade to ESLint 9
1 parent ee05a76 commit 84b36d5

File tree

4 files changed

+843
-993
lines changed

4 files changed

+843
-993
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,7 @@ module.exports = {
77
sourceType: 'module',
88
},
99

10-
rules: {
11-
// This makes integration tests easier to read by allowing setup code and
12-
// assertions to be grouped together better
13-
'padding-line-between-statements': [
14-
'error',
15-
{
16-
blankLine: 'always',
17-
prev: 'directive',
18-
next: '*',
19-
},
20-
{
21-
blankLine: 'any',
22-
prev: 'directive',
23-
next: 'directive',
24-
},
25-
{
26-
blankLine: 'always',
27-
prev: 'multiline-block-like',
28-
next: '*',
29-
},
30-
{
31-
blankLine: 'always',
32-
prev: '*',
33-
next: 'multiline-block-like',
34-
},
35-
],
36-
// It's common for scripts to access `process.env`
37-
'node/no-process-env': 'off',
38-
},
10+
rules: {},
3911

4012
overrides: [
4113
{

eslint.config.mjs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import base, { createConfig } from '@metamask/eslint-config';
2+
import jest from '@metamask/eslint-config-jest';
3+
import nodejs from '@metamask/eslint-config-nodejs';
4+
import typescript from '@metamask/eslint-config-typescript';
5+
6+
const config = createConfig([
7+
{
8+
ignores: ['dist/', 'docs/', '.yarn/'],
9+
},
10+
11+
{
12+
extends: [base, nodejs],
13+
14+
languageOptions: {
15+
sourceType: 'module',
16+
parserOptions: {
17+
tsconfigRootDir: import.meta.dirname,
18+
project: ['./tsconfig.json'],
19+
},
20+
},
21+
22+
settings: {
23+
'import-x/extensions': ['.js', '.mjs'],
24+
},
25+
26+
rules: {
27+
// This makes integration tests easier to read by allowing setup code and
28+
// assertions to be grouped together better
29+
'padding-line-between-statements': [
30+
'error',
31+
{
32+
blankLine: 'always',
33+
prev: 'directive',
34+
next: '*',
35+
},
36+
{
37+
blankLine: 'any',
38+
prev: 'directive',
39+
next: 'directive',
40+
},
41+
{
42+
blankLine: 'always',
43+
prev: 'multiline-block-like',
44+
next: '*',
45+
},
46+
{
47+
blankLine: 'always',
48+
prev: '*',
49+
next: 'multiline-block-like',
50+
},
51+
],
52+
// It's common for scripts to access `process.env`
53+
'node/no-process-env': 'off',
54+
},
55+
},
56+
57+
{
58+
files: ['**/*.ts'],
59+
extends: typescript,
60+
},
61+
62+
{
63+
files: ['**/*.js', '**/*.cjs'],
64+
65+
languageOptions: {
66+
sourceType: 'script',
67+
},
68+
},
69+
70+
{
71+
files: ['**/*.test.ts', '**/*.test.js'],
72+
extends: [jest, nodejs],
73+
},
74+
]);
75+
76+
export default config;

package.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build": "tsc --project tsconfig.build.json",
1818
"build:clean": "rimraf dist && yarn build",
1919
"lint": "yarn lint:eslint && yarn lint:misc --check",
20-
"lint:eslint": "eslint . --cache --ext js,ts",
20+
"lint:eslint": "eslint . --cache",
2121
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
2222
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
2323
"prepack": "./scripts/prepack.sh",
@@ -43,10 +43,10 @@
4343
"@babel/preset-env": "^7.23.5",
4444
"@babel/preset-typescript": "^7.23.3",
4545
"@lavamoat/allow-scripts": "^3.1.0",
46-
"@metamask/eslint-config": "^10.0.0",
47-
"@metamask/eslint-config-jest": "^10.0.0",
48-
"@metamask/eslint-config-nodejs": "^10.0.0",
49-
"@metamask/eslint-config-typescript": "^10.0.0",
46+
"@metamask/eslint-config": "^14.0.0",
47+
"@metamask/eslint-config-jest": "^14.0.0",
48+
"@metamask/eslint-config-nodejs": "^14.0.0",
49+
"@metamask/eslint-config-typescript": "^14.0.0",
5050
"@types/debug": "^4.1.7",
5151
"@types/jest": "^29.5.10",
5252
"@types/jest-when": "^3.5.2",
@@ -56,27 +56,31 @@
5656
"@types/validate-npm-package-name": "^4.0.2",
5757
"@types/which": "^3.0.0",
5858
"@types/yargs": "^17.0.10",
59-
"@typescript-eslint/eslint-plugin": "^5.62.0",
60-
"@typescript-eslint/parser": "^5.62.0",
59+
"@typescript-eslint/eslint-plugin": "^8.25.0",
60+
"@typescript-eslint/parser": "^8.25.0",
6161
"babel-jest": "^29.7.0",
6262
"deepmerge": "^4.2.2",
63-
"eslint": "^8.27.0",
63+
"eslint": "^9.21.0",
6464
"eslint-config-prettier": "^9.1.0",
65-
"eslint-plugin-import": "^2.26.0",
66-
"eslint-plugin-jest": "^26.9.0",
67-
"eslint-plugin-jsdoc": "^39.6.2",
65+
"eslint-import-resolver-typescript": "^3.8.3",
66+
"eslint-plugin-import-x": "^4.6.1",
67+
"eslint-plugin-jest": "^28.11.0",
68+
"eslint-plugin-jsdoc": "^50.6.3",
69+
"eslint-plugin-n": "^17.15.1",
6870
"eslint-plugin-node": "^11.1.0",
69-
"eslint-plugin-prettier": "^5.2.1",
71+
"eslint-plugin-prettier": "^5.2.3",
72+
"eslint-plugin-promise": "^7.2.1",
7073
"jest": "^29.7.0",
7174
"jest-it-up": "^3.0.0",
7275
"jest-when": "^3.5.2",
7376
"nanoid": "^3.3.4",
74-
"prettier": "^3.3.3",
75-
"prettier-plugin-packagejson": "^2.5.2",
77+
"prettier": "^3.5.2",
78+
"prettier-plugin-packagejson": "^2.5.8",
7679
"rimraf": "^4.0.5",
7780
"stdio-mock": "^1.2.0",
7881
"tsx": "^4.6.1",
79-
"typescript": "~5.1.6"
82+
"typescript": "~5.1.6",
83+
"typescript-eslint": "^8.25.0"
8084
},
8185
"peerDependencies": {
8286
"prettier": ">=3.0.0"

0 commit comments

Comments
 (0)