Skip to content

Commit 7df22dc

Browse files
committed
chore: migrate legacy @kleros/kleros-v2-eslint-config to the new ESLINT flat config format
1 parent 8885d11 commit 7df22dc

4 files changed

Lines changed: 131 additions & 53 deletions

File tree

eslint-config/.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
"plugin:prettier/recommended",
1717
"plugin:import/recommended",
1818
],
19-
plugins: ["@typescript-eslint", "prettier", "import"],
19+
plugins: ["@typescript-eslint", "prettier", "import", "n"],
2020
rules: {
2121
"no-unused-vars": [
2222
"error",
@@ -32,13 +32,13 @@ module.exports = {
3232
commonjs: true,
3333
},
3434
],
35-
"node/no-unsupported-features/es-syntax": [
35+
"n/no-unsupported-features/es-syntax": [
3636
"error",
3737
{
3838
ignores: ["modules"],
3939
},
4040
],
41-
"node/no-missing-import": [
41+
"n/no-missing-import": [
4242
"error",
4343
{
4444
tryExtensions: [".js", ".ts", ".json", ".node"],

eslint-config/flat.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//ESLint 9 requires flat config (eslint.config.*) and no longer reads legacy .eslintrc files automatically.
2+
//This file just migrates the legacy @kleros/kleros-v2-eslint-config to the new format, according to the docs.
3+
//For workspaces that don't need custom rules, a simple eslint.config.mjs that just exports:
4+
//export { default } from "@kleros/kleros-v2-eslint-config/flat.mjs";
5+
//is enough to provide access to the default eslint config for that workspace.
6+
import path from "node:path";
7+
import { fileURLToPath } from "node:url";
8+
import js from "@eslint/js";
9+
import { FlatCompat } from "@eslint/eslintrc";
10+
import legacyConfig from "./.eslintrc.js";
11+
12+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
});
17+
18+
export default [...compat.config(legacyConfig)];

eslint-config/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,27 @@
44
"private": true,
55
"main": ".eslintrc.js",
66
"license": "MIT",
7+
"exports": {
8+
".": "./.eslintrc.js",
9+
"./flat.mjs": "./flat.mjs"
10+
},
711
"dependencies": {
12+
"@eslint/eslintrc": "^3.2.0",
13+
"@eslint/js": "^9.15.0",
814
"@typescript-eslint/eslint-plugin": "^8.15.0",
915
"@typescript-eslint/parser": "^8.15.0",
1016
"@typescript-eslint/utils": "^8.15.0",
1117
"eslint": "^9.15.0",
1218
"eslint-config-prettier": "^9.1.0",
1319
"eslint-plugin-import": "^2.31.0",
14-
"eslint-plugin-node": "^11.1.0",
20+
"eslint-plugin-n": "^17.10.0",
1521
"eslint-plugin-prettier": "^5.2.1",
1622
"eslint-plugin-promise": "^6.6.0",
1723
"eslint-plugin-security": "^3.0.1",
1824
"eslint-utils": "^3.0.0",
1925
"prettier": "^3.3.3"
2026
},
2127
"devDependencies": {
22-
"@eslint/eslintrc": "^3.2.0",
23-
"@eslint/js": "^9.15.0",
2428
"globals": "^15.12.0",
2529
"typescript": "^5.6.3"
2630
},

yarn.lock

Lines changed: 103 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,17 @@ __metadata:
43124312
languageName: node
43134313
linkType: hard
43144314

4315+
"@eslint-community/eslint-utils@npm:^4.1.2, @eslint-community/eslint-utils@npm:^4.5.0":
4316+
version: 4.9.1
4317+
resolution: "@eslint-community/eslint-utils@npm:4.9.1"
4318+
dependencies:
4319+
eslint-visitor-keys: "npm:^3.4.3"
4320+
peerDependencies:
4321+
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
4322+
checksum: 10/863b5467868551c9ae34d03eefe634633d08f623fc7b19d860f8f26eb6f303c1a5934253124163bee96181e45ed22bf27473dccc295937c3078493a4a8c9eddd
4323+
languageName: node
4324+
linkType: hard
4325+
43154326
"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0":
43164327
version: 4.4.0
43174328
resolution: "@eslint-community/eslint-utils@npm:4.4.0"
@@ -4330,6 +4341,13 @@ __metadata:
43304341
languageName: node
43314342
linkType: hard
43324343

4344+
"@eslint-community/regexpp@npm:^4.11.0":
4345+
version: 4.12.2
4346+
resolution: "@eslint-community/regexpp@npm:4.12.2"
4347+
checksum: 10/049b280fddf71dd325514e0a520024969431dc3a8b02fa77476e6820e9122f28ab4c9168c11821f91a27982d2453bcd7a66193356ea84e84fb7c8d793be1ba0c
4348+
languageName: node
4349+
linkType: hard
4350+
43334351
"@eslint/compat@npm:^1.2.3":
43344352
version: 1.2.3
43354353
resolution: "@eslint/compat@npm:1.2.3"
@@ -6957,11 +6975,13 @@ __metadata:
69576975
version: 0.0.0-use.local
69586976
resolution: "@kleros/kleros-sdk@workspace:kleros-sdk"
69596977
dependencies:
6978+
"@kleros/kleros-v2-eslint-config": "workspace:^"
69606979
"@reality.eth/reality-eth-lib": "npm:^3.4.15"
69616980
"@types/mustache": "npm:^4.2.5"
69626981
"@types/node": "npm:^20.19.24"
69636982
"@urql/core": "npm:^5.0.8"
69646983
"@vitest/ui": "npm:^1.6.1"
6984+
eslint: "npm:^9.15.0"
69656985
mocha: "npm:^10.8.2"
69666986
mustache: "npm:^4.2.0"
69676987
rimraf: "npm:^6.0.1"
@@ -7049,7 +7069,7 @@ __metadata:
70497069
eslint: "npm:^9.15.0"
70507070
eslint-config-prettier: "npm:^9.1.0"
70517071
eslint-plugin-import: "npm:^2.31.0"
7052-
eslint-plugin-node: "npm:^11.1.0"
7072+
eslint-plugin-n: "npm:^17.10.0"
70537073
eslint-plugin-prettier: "npm:^5.2.1"
70547074
eslint-plugin-promise: "npm:^6.6.0"
70557075
eslint-plugin-security: "npm:^3.0.1"
@@ -19873,6 +19893,16 @@ __metadata:
1987319893
languageName: node
1987419894
linkType: hard
1987519895

19896+
"enhanced-resolve@npm:^5.17.1":
19897+
version: 5.21.0
19898+
resolution: "enhanced-resolve@npm:5.21.0"
19899+
dependencies:
19900+
graceful-fs: "npm:^4.2.4"
19901+
tapable: "npm:^2.3.3"
19902+
checksum: 10/234d37ddd5a190cb30527b8f7c4d440fa3c99a1247cccf60f74696c4f84c8b98a8178a7e97a7809ffcf1d31afb40c6a1d2805ccb19d9bbc8721ad6b4f8af4073
19903+
languageName: node
19904+
linkType: hard
19905+
1987619906
"enquire.js@npm:^2.1.6":
1987719907
version: 2.1.6
1987819908
resolution: "enquire.js@npm:2.1.6"
@@ -20622,6 +20652,17 @@ __metadata:
2062220652
languageName: node
2062320653
linkType: hard
2062420654

20655+
"eslint-compat-utils@npm:^0.5.1":
20656+
version: 0.5.1
20657+
resolution: "eslint-compat-utils@npm:0.5.1"
20658+
dependencies:
20659+
semver: "npm:^7.5.4"
20660+
peerDependencies:
20661+
eslint: ">=6.0.0"
20662+
checksum: 10/ac65ac1c6107cf19f63f5fc17cea361c9cb1336be7356f23dbb0fac10979974b4622e13e950be43cbf431801f2c07f7dab448573181ccf6edc0b86d5b5304511
20663+
languageName: node
20664+
linkType: hard
20665+
2062520666
"eslint-config-next@npm:^15.0.3":
2062620667
version: 15.0.3
2062720668
resolution: "eslint-config-next@npm:15.0.3"
@@ -20729,15 +20770,16 @@ __metadata:
2072920770
languageName: node
2073020771
linkType: hard
2073120772

20732-
"eslint-plugin-es@npm:^3.0.0":
20733-
version: 3.0.1
20734-
resolution: "eslint-plugin-es@npm:3.0.1"
20773+
"eslint-plugin-es-x@npm:^7.8.0":
20774+
version: 7.8.0
20775+
resolution: "eslint-plugin-es-x@npm:7.8.0"
2073520776
dependencies:
20736-
eslint-utils: "npm:^2.0.0"
20737-
regexpp: "npm:^3.0.0"
20777+
"@eslint-community/eslint-utils": "npm:^4.1.2"
20778+
"@eslint-community/regexpp": "npm:^4.11.0"
20779+
eslint-compat-utils: "npm:^0.5.1"
2073820780
peerDependencies:
20739-
eslint: ">=4.19.1"
20740-
checksum: 10/9814e6305183edfdff7d99cbc0f95f0aed1446045cbd1d4f28e7be0903d0013880f0aaf04486a27de96bfb2f5a746bea97cbb238f9b0035cb378d48d179a0a1b
20781+
eslint: ">=8"
20782+
checksum: 10/1df8d52c4fadc06854ce801af05b05f2642aa2deb918fb7d37738596eabd70b7f21a22b150b78ec9104bac6a1b6b4fb796adea2364ede91b01d20964849ce5f7
2074120783
languageName: node
2074220784
linkType: hard
2074320785

@@ -20826,19 +20868,22 @@ __metadata:
2082620868
languageName: node
2082720869
linkType: hard
2082820870

20829-
"eslint-plugin-node@npm:^11.1.0":
20830-
version: 11.1.0
20831-
resolution: "eslint-plugin-node@npm:11.1.0"
20871+
"eslint-plugin-n@npm:^17.10.0":
20872+
version: 17.24.0
20873+
resolution: "eslint-plugin-n@npm:17.24.0"
2083220874
dependencies:
20833-
eslint-plugin-es: "npm:^3.0.0"
20834-
eslint-utils: "npm:^2.0.0"
20835-
ignore: "npm:^5.1.1"
20836-
minimatch: "npm:^3.0.4"
20837-
resolve: "npm:^1.10.1"
20838-
semver: "npm:^6.1.0"
20875+
"@eslint-community/eslint-utils": "npm:^4.5.0"
20876+
enhanced-resolve: "npm:^5.17.1"
20877+
eslint-plugin-es-x: "npm:^7.8.0"
20878+
get-tsconfig: "npm:^4.8.1"
20879+
globals: "npm:^15.11.0"
20880+
globrex: "npm:^0.1.2"
20881+
ignore: "npm:^5.3.2"
20882+
semver: "npm:^7.6.3"
20883+
ts-declaration-location: "npm:^1.0.6"
2083920884
peerDependencies:
20840-
eslint: ">=5.16.0"
20841-
checksum: 10/bda540f390a84d835989f21f56743f3aa8f41fd9b53359d635c116632c86af92d70d8e6449ddd18860e6241f9cef04fc90c37eb192a9047c3c3a46de6145c30c
20885+
eslint: ">=8.23.0"
20886+
checksum: 10/bbff1172f7297288d209f167febb3a31747838d5ed8050aa7d1aa2540a49b4f9932828831529f0306f2909e41ae3ae8848c145238a6990eae5a9d128a59b056c
2084220887
languageName: node
2084320888
linkType: hard
2084420889

@@ -20967,15 +21012,6 @@ __metadata:
2096721012
languageName: node
2096821013
linkType: hard
2096921014

20970-
"eslint-utils@npm:^2.0.0":
20971-
version: 2.1.0
20972-
resolution: "eslint-utils@npm:2.1.0"
20973-
dependencies:
20974-
eslint-visitor-keys: "npm:^1.1.0"
20975-
checksum: 10/a7e43a5154a16a90c021cabeb160c3668cccbcf6474ccb2a7d7762698582398f3b938c5330909b858ef7c21182edfc9786dbf89ed7b294f51b7659a378bf7cec
20976-
languageName: node
20977-
linkType: hard
20978-
2097921015
"eslint-utils@npm:^3.0.0":
2098021016
version: 3.0.0
2098121017
resolution: "eslint-utils@npm:3.0.0"
@@ -20987,21 +21023,14 @@ __metadata:
2098721023
languageName: node
2098821024
linkType: hard
2098921025

20990-
"eslint-visitor-keys@npm:^1.1.0":
20991-
version: 1.3.0
20992-
resolution: "eslint-visitor-keys@npm:1.3.0"
20993-
checksum: 10/595ab230e0fcb52f86ba0986a9a473b9fcae120f3729b43f1157f88f27f8addb1e545c4e3d444185f2980e281ca15be5ada6f65b4599eec227cf30e41233b762
20994-
languageName: node
20995-
linkType: hard
20996-
2099721026
"eslint-visitor-keys@npm:^2.0.0, eslint-visitor-keys@npm:^2.1.0":
2099821027
version: 2.1.0
2099921028
resolution: "eslint-visitor-keys@npm:2.1.0"
2100021029
checksum: 10/db4547eef5039122d518fa307e938ceb8589da5f6e8f5222efaf14dd62f748ce82e2d2becd3ff9412a50350b726bda95dbea8515a471074547daefa58aee8735
2100121030
languageName: node
2100221031
linkType: hard
2100321032

21004-
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1":
21033+
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3":
2100521034
version: 3.4.3
2100621035
resolution: "eslint-visitor-keys@npm:3.4.3"
2100721036
checksum: 10/3f357c554a9ea794b094a09bd4187e5eacd1bc0d0653c3adeb87962c548e6a1ab8f982b86963ae1337f5d976004146536dcee5d0e2806665b193fbfbf1a9231b
@@ -22858,6 +22887,15 @@ __metadata:
2285822887
languageName: node
2285922888
linkType: hard
2286022889

22890+
"get-tsconfig@npm:^4.8.1":
22891+
version: 4.14.0
22892+
resolution: "get-tsconfig@npm:4.14.0"
22893+
dependencies:
22894+
resolve-pkg-maps: "npm:^1.0.0"
22895+
checksum: 10/f5626971905ca386c9ddeb302504e8a2301b9c05641803267223ebd50b7c81aaf9324d29cf9f4e4ff3f245632c3392aa83719dc6cb3e98b4e4a1702a27c5cc5d
22896+
languageName: node
22897+
linkType: hard
22898+
2286122899
"ghost-testrpc@npm:^0.0.2":
2286222900
version: 0.0.2
2286322901
resolution: "ghost-testrpc@npm:0.0.2"
@@ -23133,6 +23171,13 @@ __metadata:
2313323171
languageName: node
2313423172
linkType: hard
2313523173

23174+
"globals@npm:^15.11.0":
23175+
version: 15.15.0
23176+
resolution: "globals@npm:15.15.0"
23177+
checksum: 10/7f561c87b2fd381b27fc2db7df8a4ea7a9bb378667b8a7193e61fd2ca3a876479174e2a303a74345fbea6e1242e16db48915c1fd3bf35adcf4060a795b425e18
23178+
languageName: node
23179+
linkType: hard
23180+
2313623181
"globals@npm:^15.12.0":
2313723182
version: 15.12.0
2313823183
resolution: "globals@npm:15.12.0"
@@ -24452,7 +24497,7 @@ __metadata:
2445224497
languageName: node
2445324498
linkType: hard
2445424499

24455-
"ignore@npm:^5.1.1, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1":
24500+
"ignore@npm:^5.1.1, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1, ignore@npm:^5.3.2":
2445624501
version: 5.3.2
2445724502
resolution: "ignore@npm:5.3.2"
2445824503
checksum: 10/cceb6a457000f8f6a50e1196429750d782afce5680dd878aa4221bd79972d68b3a55b4b1458fc682be978f4d3c6a249046aa0880637367216444ab7b014cfc98
@@ -34093,13 +34138,6 @@ __metadata:
3409334138
languageName: node
3409434139
linkType: hard
3409534140

34096-
"regexpp@npm:^3.0.0":
34097-
version: 3.2.0
34098-
resolution: "regexpp@npm:3.2.0"
34099-
checksum: 10/3310010895a906873262f4b494fc99bcef1e71ef6720a0532c5999ca586498cbd4a284c8e3c2423f9d1d37512fd08d6064b7564e0e59508cf938f76dd15ace84
34100-
languageName: node
34101-
linkType: hard
34102-
3410334141
"regexpu-core@npm:^5.3.1":
3410434142
version: 5.3.2
3410534143
resolution: "regexpu-core@npm:5.3.2"
@@ -34427,7 +34465,7 @@ __metadata:
3442734465
languageName: node
3442834466
linkType: hard
3442934467

34430-
"resolve@npm:^1.1.6, resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.10.1, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:~1.22.1, resolve@npm:~1.22.2":
34468+
"resolve@npm:^1.1.6, resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.2, resolve@npm:^1.22.4, resolve@npm:~1.22.1, resolve@npm:~1.22.2":
3443134469
version: 1.22.8
3443234470
resolution: "resolve@npm:1.22.8"
3443334471
dependencies:
@@ -34469,7 +34507,7 @@ __metadata:
3446934507
languageName: node
3447034508
linkType: hard
3447134509

34472-
"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.1.7#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.1#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.17.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A~1.22.1#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A~1.22.2#optional!builtin<compat/resolve>":
34510+
"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.1.7#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.17.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A~1.22.1#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A~1.22.2#optional!builtin<compat/resolve>":
3447334511
version: 1.22.8
3447434512
resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin<compat/resolve>::version=1.22.8&hash=c3c19d"
3447534513
dependencies:
@@ -35197,7 +35235,7 @@ __metadata:
3519735235
languageName: node
3519835236
linkType: hard
3519935237

35200-
"semver@npm:^6.0.0, semver@npm:^6.1.0, semver@npm:^6.1.2, semver@npm:^6.3.0, semver@npm:^6.3.1":
35238+
"semver@npm:^6.0.0, semver@npm:^6.1.2, semver@npm:^6.3.0, semver@npm:^6.3.1":
3520135239
version: 6.3.1
3520235240
resolution: "semver@npm:6.3.1"
3520335241
bin:
@@ -37039,6 +37077,13 @@ __metadata:
3703937077
languageName: node
3704037078
linkType: hard
3704137079

37080+
"tapable@npm:^2.3.3":
37081+
version: 2.3.3
37082+
resolution: "tapable@npm:2.3.3"
37083+
checksum: 10/21fb64a7ae1a0e11d855a6c33a22ae5ecf7e2f23170c942da673b44bf4c3aae8aa52451ef2792d0ce36c7feca13dceafa4f135105d66fc06912632488c0913fd
37084+
languageName: node
37085+
linkType: hard
37086+
3704237087
"tar-stream@npm:^1.5.2":
3704337088
version: 1.6.2
3704437089
resolution: "tar-stream@npm:1.6.2"
@@ -37577,6 +37622,17 @@ __metadata:
3757737622
languageName: node
3757837623
linkType: hard
3757937624

37625+
"ts-declaration-location@npm:^1.0.6":
37626+
version: 1.0.7
37627+
resolution: "ts-declaration-location@npm:1.0.7"
37628+
dependencies:
37629+
picomatch: "npm:^4.0.2"
37630+
peerDependencies:
37631+
typescript: ">=4.0.0"
37632+
checksum: 10/a7932fc75d41f10c16089f8f5a5c1ea49d6afca30f09c91c1df14d0a8510f72bcb9f8a395c04f060b66b855b6bd7ea4df81b335fb9d21bef402969a672a4afa7
37633+
languageName: node
37634+
linkType: hard
37635+
3758037636
"ts-easing@npm:^0.2.0":
3758137637
version: 0.2.0
3758237638
resolution: "ts-easing@npm:0.2.0"

0 commit comments

Comments
 (0)