Skip to content

Commit 9a95908

Browse files
committed
update eslint config for jupyter/eslint and eslint 9
1 parent dce860a commit 9a95908

5 files changed

Lines changed: 132 additions & 27 deletions

File tree

.eslintignore

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

.pre-commit-config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ repos:
4343
- id: check-case-conflict
4444
- id: check-executables-have-shebangs
4545
- id: requirements-txt-fixer
46-
- repo: https://github.com/pre-commit/mirrors-eslint
47-
rev: 9158d5162f915488785c296b5d08d6d18be10d32 # frozen: v10.3.0
48-
hooks:
49-
- id: eslint
50-
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
51-
exclude: ipyparallel/nbextension/.*
52-
types: [file]
53-
additional_dependencies:
54-
- "@typescript-eslint/eslint-plugin@2.27.0"
55-
- "@typescript-eslint/parser@2.27.0"
56-
- eslint@^6.0.0
57-
- eslint-config-prettier@6.10.1
58-
- eslint-plugin-prettier@3.1.4
59-
- eslint-plugin-react@7.21.5
60-
- typescript@4.1.3
46+
# - repo: https://github.com/pre-commit/mirrors-eslint
47+
# rev: 9158d5162f915488785c296b5d08d6d18be10d32 # frozen: v10.3.0
48+
# hooks:
49+
# - id: eslint
50+
# files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
51+
# exclude: ipyparallel/nbextension/.*
52+
# types: [file]
53+
# additional_dependencies:
54+
# - "@typescript-eslint/eslint-plugin@8.59.2"
55+
# - "@typescript-eslint/parser@2.27.0"
56+
# - eslint@^6.0.0
57+
# - eslint-config-prettier@6.10.1
58+
# - eslint-plugin-prettier@3.1.4
59+
# - eslint-plugin-react@7.21.5
60+
# - typescript@4.1.3

eslint.config.mjs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import js from "@eslint/js";
2+
import { defineConfig } from "eslint/config";
3+
import tseslint from "typescript-eslint";
4+
import prettierRecommended from "eslint-plugin-prettier/recommended";
5+
import globals from "globals";
6+
import jupyterPlugin from "@jupyter/eslint-plugin";
7+
8+
// workaround: plugin recommended config doesn't enable itself
9+
for (var cfg of jupyterPlugin.configs.recommended) {
10+
cfg.plugins = {
11+
jupyter: jupyterPlugin,
12+
};
13+
}
14+
15+
export default defineConfig([
16+
{
17+
ignores: ["node_modules", "dist", "coverage", "**/*.js", "**/*.d.ts"],
18+
},
19+
js.configs.recommended,
20+
tseslint.configs.recommended,
21+
jupyterPlugin.configs.recommended,
22+
{
23+
files: ["**/*.ts", "**/*.tsx"],
24+
plugins: {
25+
jupyter: jupyterPlugin,
26+
},
27+
languageOptions: {
28+
globals: {
29+
...globals.browser,
30+
...globals.es2015,
31+
...globals.node,
32+
},
33+
parserOptions: {
34+
project: "tsconfig.eslint.json",
35+
sourceType: "module",
36+
},
37+
},
38+
rules: {
39+
"@typescript-eslint/naming-convention": [
40+
"error",
41+
{
42+
selector: "interface",
43+
format: ["PascalCase"],
44+
custom: {
45+
regex: "^I[A-Z]",
46+
match: true,
47+
},
48+
},
49+
],
50+
"@typescript-eslint/no-unused-vars": ["warn", { args: "none" }],
51+
"@typescript-eslint/no-explicit-any": "off",
52+
"@typescript-eslint/no-namespace": "off",
53+
"@typescript-eslint/no-use-before-define": "off",
54+
"@typescript-eslint/quotes": [
55+
"error",
56+
"single",
57+
{ avoidEscape: true, allowTemplateLiterals: false },
58+
],
59+
curly: ["error", "all"],
60+
eqeqeq: "error",
61+
"prefer-arrow-callback": "error",
62+
},
63+
},
64+
prettierRecommended,
65+
]);

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
"react-dom": "^18.2.0"
7373
},
7474
"devDependencies": {
75+
"@eslint/js": "^9.0.0",
76+
"@jupyter/eslint-plugin": "^1.0.0",
7577
"@jupyterlab/builder": "^4.5.7",
7678
"@types/react": "^18.0.26",
7779
"@types/react-dom": "~18.3.7",
@@ -81,10 +83,12 @@
8183
"eslint-config-prettier": "^9",
8284
"eslint-plugin-prettier": "^5.5.5",
8385
"eslint-plugin-react": "^7.37.5",
86+
"jsonc-eslint-parser": "^3.1.0",
8487
"npm-run-all2": "^8.0.4",
8588
"prettier": "^3.8.3",
8689
"rimraf": "^6.1.3",
87-
"typescript": "~6.0.3"
90+
"typescript": "~6.0.3",
91+
"typescript-eslint": "^8.59.3"
8892
},
8993
"resolutions": {
9094
"@types/react": "^18.0.26"

yarn.lock

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ __metadata:
374374
languageName: node
375375
linkType: hard
376376

377-
"@eslint/js@npm:9.39.4":
377+
"@eslint/js@npm:9.39.4, @eslint/js@npm:^9.0.0":
378378
version: 9.39.4
379379
resolution: "@eslint/js@npm:9.39.4"
380380
checksum: 5b1cd1e6c13bc119c92911e6cef7cf886d942c9e047db0c923bbdd539ed6b9820d986b4559be1f2e24836de7fbad95bbfe268b2bf3d1fef76de37bdc8fae19d8
@@ -557,6 +557,17 @@ __metadata:
557557
languageName: node
558558
linkType: hard
559559

560+
"@jupyter/eslint-plugin@npm:^1.0.0":
561+
version: 1.0.0
562+
resolution: "@jupyter/eslint-plugin@npm:1.0.0"
563+
dependencies:
564+
"@typescript-eslint/utils": ^8.54.0
565+
peerDependencies:
566+
eslint: ">=9.0.0"
567+
checksum: ec35bf023677646777d573566ac9110d6c8f23ed9663d4835728b25452e8c4250e28b5662375318bf0eea098401cf9b74ef507a0bb01cab9aca2d1e0d73081bf
568+
languageName: node
569+
linkType: hard
570+
560571
"@jupyter/react-components@npm:^0.16.6":
561572
version: 0.16.7
562573
resolution: "@jupyter/react-components@npm:0.16.7"
@@ -2127,7 +2138,7 @@ __metadata:
21272138
languageName: node
21282139
linkType: hard
21292140

2130-
"@typescript-eslint/eslint-plugin@npm:^8.59.2":
2141+
"@typescript-eslint/eslint-plugin@npm:8.59.3, @typescript-eslint/eslint-plugin@npm:^8.59.2":
21312142
version: 8.59.3
21322143
resolution: "@typescript-eslint/eslint-plugin@npm:8.59.3"
21332144
dependencies:
@@ -2147,7 +2158,7 @@ __metadata:
21472158
languageName: node
21482159
linkType: hard
21492160

2150-
"@typescript-eslint/parser@npm:^8.59.2":
2161+
"@typescript-eslint/parser@npm:8.59.3, @typescript-eslint/parser@npm:^8.59.2":
21512162
version: 8.59.3
21522163
resolution: "@typescript-eslint/parser@npm:8.59.3"
21532164
dependencies:
@@ -2237,7 +2248,7 @@ __metadata:
22372248
languageName: node
22382249
linkType: hard
22392250

2240-
"@typescript-eslint/utils@npm:8.59.3":
2251+
"@typescript-eslint/utils@npm:8.59.3, @typescript-eslint/utils@npm:^8.54.0":
22412252
version: 8.59.3
22422253
resolution: "@typescript-eslint/utils@npm:8.59.3"
22432254
dependencies:
@@ -2519,7 +2530,7 @@ __metadata:
25192530
languageName: node
25202531
linkType: hard
25212532

2522-
"acorn@npm:^8.1.0, acorn@npm:^8.11.0, acorn@npm:^8.15.0, acorn@npm:^8.16.0, acorn@npm:^8.8.1":
2533+
"acorn@npm:^8.1.0, acorn@npm:^8.11.0, acorn@npm:^8.15.0, acorn@npm:^8.16.0, acorn@npm:^8.5.0, acorn@npm:^8.8.1":
25232534
version: 8.16.0
25242535
resolution: "acorn@npm:8.16.0"
25252536
bin:
@@ -4808,6 +4819,8 @@ __metadata:
48084819
version: 0.0.0-use.local
48094820
resolution: "ipyparallel-labextension@workspace:."
48104821
dependencies:
4822+
"@eslint/js": ^9.0.0
4823+
"@jupyter/eslint-plugin": ^1.0.0
48114824
"@jupyterlab/application": ^4.5.7
48124825
"@jupyterlab/apputils": ^4.6.7
48134826
"@jupyterlab/builder": ^4.5.7
@@ -4837,12 +4850,14 @@ __metadata:
48374850
eslint-config-prettier: ^9
48384851
eslint-plugin-prettier: ^5.5.5
48394852
eslint-plugin-react: ^7.37.5
4853+
jsonc-eslint-parser: ^3.1.0
48404854
npm-run-all2: ^8.0.4
48414855
prettier: ^3.8.3
48424856
react: ^18.2.0
48434857
react-dom: ^18.2.0
48444858
rimraf: ^6.1.3
48454859
typescript: ~6.0.3
4860+
typescript-eslint: ^8.59.3
48464861
languageName: unknown
48474862
linkType: soft
48484863

@@ -5346,6 +5361,17 @@ __metadata:
53465361
languageName: node
53475362
linkType: hard
53485363

5364+
"jsonc-eslint-parser@npm:^3.1.0":
5365+
version: 3.1.0
5366+
resolution: "jsonc-eslint-parser@npm:3.1.0"
5367+
dependencies:
5368+
acorn: ^8.5.0
5369+
eslint-visitor-keys: ^5.0.0
5370+
semver: ^7.3.5
5371+
checksum: 23e86c3ae850564311e31cf3e28f12b423d57a97fc5e163fcd4861047806950df827036e21642fb5afa5ec5d490f493001d13829124cedc35cbc26cf6bb1ecf1
5372+
languageName: node
5373+
linkType: hard
5374+
53495375
"jsonfile@npm:^6.0.1":
53505376
version: 6.2.1
53515377
resolution: "jsonfile@npm:6.2.1"
@@ -6616,7 +6642,7 @@ __metadata:
66166642
languageName: node
66176643
linkType: hard
66186644

6619-
"semver@npm:^7.5.4, semver@npm:^7.7.3":
6645+
"semver@npm:^7.3.5, semver@npm:^7.5.4, semver@npm:^7.7.3":
66206646
version: 7.8.0
66216647
resolution: "semver@npm:7.8.0"
66226648
bin:
@@ -7178,6 +7204,21 @@ __metadata:
71787204
languageName: node
71797205
linkType: hard
71807206

7207+
"typescript-eslint@npm:^8.59.3":
7208+
version: 8.59.3
7209+
resolution: "typescript-eslint@npm:8.59.3"
7210+
dependencies:
7211+
"@typescript-eslint/eslint-plugin": 8.59.3
7212+
"@typescript-eslint/parser": 8.59.3
7213+
"@typescript-eslint/typescript-estree": 8.59.3
7214+
"@typescript-eslint/utils": 8.59.3
7215+
peerDependencies:
7216+
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
7217+
typescript: ">=4.8.4 <6.1.0"
7218+
checksum: b2780972ab673250edef0758886b1a2cfed68f0037afc0541c51c2abf1b03cd628ebb6f9638e21fbd9336a08b2e13161a139f1d7e5b576a9c827fc1979fdae7c
7219+
languageName: node
7220+
linkType: hard
7221+
71817222
"typescript@npm:~6.0.3":
71827223
version: 6.0.3
71837224
resolution: "typescript@npm:6.0.3"

0 commit comments

Comments
 (0)