Skip to content

Commit c0302df

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

4 files changed

Lines changed: 129 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: 101 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"
@@ -7049,7 +7067,7 @@ __metadata:
70497067
eslint: "npm:^9.15.0"
70507068
eslint-config-prettier: "npm:^9.1.0"
70517069
eslint-plugin-import: "npm:^2.31.0"
7052-
eslint-plugin-node: "npm:^11.1.0"
7070+
eslint-plugin-n: "npm:^17.10.0"
70537071
eslint-plugin-prettier: "npm:^5.2.1"
70547072
eslint-plugin-promise: "npm:^6.6.0"
70557073
eslint-plugin-security: "npm:^3.0.1"
@@ -19873,6 +19891,16 @@ __metadata:
1987319891
languageName: node
1987419892
linkType: hard
1987519893

19894+
"enhanced-resolve@npm:^5.17.1":
19895+
version: 5.21.0
19896+
resolution: "enhanced-resolve@npm:5.21.0"
19897+
dependencies:
19898+
graceful-fs: "npm:^4.2.4"
19899+
tapable: "npm:^2.3.3"
19900+
checksum: 10/234d37ddd5a190cb30527b8f7c4d440fa3c99a1247cccf60f74696c4f84c8b98a8178a7e97a7809ffcf1d31afb40c6a1d2805ccb19d9bbc8721ad6b4f8af4073
19901+
languageName: node
19902+
linkType: hard
19903+
1987619904
"enquire.js@npm:^2.1.6":
1987719905
version: 2.1.6
1987819906
resolution: "enquire.js@npm:2.1.6"
@@ -20622,6 +20650,17 @@ __metadata:
2062220650
languageName: node
2062320651
linkType: hard
2062420652

20653+
"eslint-compat-utils@npm:^0.5.1":
20654+
version: 0.5.1
20655+
resolution: "eslint-compat-utils@npm:0.5.1"
20656+
dependencies:
20657+
semver: "npm:^7.5.4"
20658+
peerDependencies:
20659+
eslint: ">=6.0.0"
20660+
checksum: 10/ac65ac1c6107cf19f63f5fc17cea361c9cb1336be7356f23dbb0fac10979974b4622e13e950be43cbf431801f2c07f7dab448573181ccf6edc0b86d5b5304511
20661+
languageName: node
20662+
linkType: hard
20663+
2062520664
"eslint-config-next@npm:^15.0.3":
2062620665
version: 15.0.3
2062720666
resolution: "eslint-config-next@npm:15.0.3"
@@ -20729,15 +20768,16 @@ __metadata:
2072920768
languageName: node
2073020769
linkType: hard
2073120770

20732-
"eslint-plugin-es@npm:^3.0.0":
20733-
version: 3.0.1
20734-
resolution: "eslint-plugin-es@npm:3.0.1"
20771+
"eslint-plugin-es-x@npm:^7.8.0":
20772+
version: 7.8.0
20773+
resolution: "eslint-plugin-es-x@npm:7.8.0"
2073520774
dependencies:
20736-
eslint-utils: "npm:^2.0.0"
20737-
regexpp: "npm:^3.0.0"
20775+
"@eslint-community/eslint-utils": "npm:^4.1.2"
20776+
"@eslint-community/regexpp": "npm:^4.11.0"
20777+
eslint-compat-utils: "npm:^0.5.1"
2073820778
peerDependencies:
20739-
eslint: ">=4.19.1"
20740-
checksum: 10/9814e6305183edfdff7d99cbc0f95f0aed1446045cbd1d4f28e7be0903d0013880f0aaf04486a27de96bfb2f5a746bea97cbb238f9b0035cb378d48d179a0a1b
20779+
eslint: ">=8"
20780+
checksum: 10/1df8d52c4fadc06854ce801af05b05f2642aa2deb918fb7d37738596eabd70b7f21a22b150b78ec9104bac6a1b6b4fb796adea2364ede91b01d20964849ce5f7
2074120781
languageName: node
2074220782
linkType: hard
2074320783

@@ -20826,19 +20866,22 @@ __metadata:
2082620866
languageName: node
2082720867
linkType: hard
2082820868

20829-
"eslint-plugin-node@npm:^11.1.0":
20830-
version: 11.1.0
20831-
resolution: "eslint-plugin-node@npm:11.1.0"
20869+
"eslint-plugin-n@npm:^17.10.0":
20870+
version: 17.24.0
20871+
resolution: "eslint-plugin-n@npm:17.24.0"
2083220872
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"
20873+
"@eslint-community/eslint-utils": "npm:^4.5.0"
20874+
enhanced-resolve: "npm:^5.17.1"
20875+
eslint-plugin-es-x: "npm:^7.8.0"
20876+
get-tsconfig: "npm:^4.8.1"
20877+
globals: "npm:^15.11.0"
20878+
globrex: "npm:^0.1.2"
20879+
ignore: "npm:^5.3.2"
20880+
semver: "npm:^7.6.3"
20881+
ts-declaration-location: "npm:^1.0.6"
2083920882
peerDependencies:
20840-
eslint: ">=5.16.0"
20841-
checksum: 10/bda540f390a84d835989f21f56743f3aa8f41fd9b53359d635c116632c86af92d70d8e6449ddd18860e6241f9cef04fc90c37eb192a9047c3c3a46de6145c30c
20883+
eslint: ">=8.23.0"
20884+
checksum: 10/bbff1172f7297288d209f167febb3a31747838d5ed8050aa7d1aa2540a49b4f9932828831529f0306f2909e41ae3ae8848c145238a6990eae5a9d128a59b056c
2084220885
languageName: node
2084320886
linkType: hard
2084420887

@@ -20967,15 +21010,6 @@ __metadata:
2096721010
languageName: node
2096821011
linkType: hard
2096921012

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-
2097921013
"eslint-utils@npm:^3.0.0":
2098021014
version: 3.0.0
2098121015
resolution: "eslint-utils@npm:3.0.0"
@@ -20987,21 +21021,14 @@ __metadata:
2098721021
languageName: node
2098821022
linkType: hard
2098921023

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-
2099721024
"eslint-visitor-keys@npm:^2.0.0, eslint-visitor-keys@npm:^2.1.0":
2099821025
version: 2.1.0
2099921026
resolution: "eslint-visitor-keys@npm:2.1.0"
2100021027
checksum: 10/db4547eef5039122d518fa307e938ceb8589da5f6e8f5222efaf14dd62f748ce82e2d2becd3ff9412a50350b726bda95dbea8515a471074547daefa58aee8735
2100121028
languageName: node
2100221029
linkType: hard
2100321030

21004-
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1":
21031+
"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3":
2100521032
version: 3.4.3
2100621033
resolution: "eslint-visitor-keys@npm:3.4.3"
2100721034
checksum: 10/3f357c554a9ea794b094a09bd4187e5eacd1bc0d0653c3adeb87962c548e6a1ab8f982b86963ae1337f5d976004146536dcee5d0e2806665b193fbfbf1a9231b
@@ -22858,6 +22885,15 @@ __metadata:
2285822885
languageName: node
2285922886
linkType: hard
2286022887

22888+
"get-tsconfig@npm:^4.8.1":
22889+
version: 4.14.0
22890+
resolution: "get-tsconfig@npm:4.14.0"
22891+
dependencies:
22892+
resolve-pkg-maps: "npm:^1.0.0"
22893+
checksum: 10/f5626971905ca386c9ddeb302504e8a2301b9c05641803267223ebd50b7c81aaf9324d29cf9f4e4ff3f245632c3392aa83719dc6cb3e98b4e4a1702a27c5cc5d
22894+
languageName: node
22895+
linkType: hard
22896+
2286122897
"ghost-testrpc@npm:^0.0.2":
2286222898
version: 0.0.2
2286322899
resolution: "ghost-testrpc@npm:0.0.2"
@@ -23133,6 +23169,13 @@ __metadata:
2313323169
languageName: node
2313423170
linkType: hard
2313523171

23172+
"globals@npm:^15.11.0":
23173+
version: 15.15.0
23174+
resolution: "globals@npm:15.15.0"
23175+
checksum: 10/7f561c87b2fd381b27fc2db7df8a4ea7a9bb378667b8a7193e61fd2ca3a876479174e2a303a74345fbea6e1242e16db48915c1fd3bf35adcf4060a795b425e18
23176+
languageName: node
23177+
linkType: hard
23178+
2313623179
"globals@npm:^15.12.0":
2313723180
version: 15.12.0
2313823181
resolution: "globals@npm:15.12.0"
@@ -24452,7 +24495,7 @@ __metadata:
2445224495
languageName: node
2445324496
linkType: hard
2445424497

24455-
"ignore@npm:^5.1.1, ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1":
24498+
"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":
2445624499
version: 5.3.2
2445724500
resolution: "ignore@npm:5.3.2"
2445824501
checksum: 10/cceb6a457000f8f6a50e1196429750d782afce5680dd878aa4221bd79972d68b3a55b4b1458fc682be978f4d3c6a249046aa0880637367216444ab7b014cfc98
@@ -34093,13 +34136,6 @@ __metadata:
3409334136
languageName: node
3409434137
linkType: hard
3409534138

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-
3410334139
"regexpu-core@npm:^5.3.1":
3410434140
version: 5.3.2
3410534141
resolution: "regexpu-core@npm:5.3.2"
@@ -34427,7 +34463,7 @@ __metadata:
3442734463
languageName: node
3442834464
linkType: hard
3442934465

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":
34466+
"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":
3443134467
version: 1.22.8
3443234468
resolution: "resolve@npm:1.22.8"
3443334469
dependencies:
@@ -34469,7 +34505,7 @@ __metadata:
3446934505
languageName: node
3447034506
linkType: hard
3447134507

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>":
34508+
"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>":
3447334509
version: 1.22.8
3447434510
resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin<compat/resolve>::version=1.22.8&hash=c3c19d"
3447534511
dependencies:
@@ -35197,7 +35233,7 @@ __metadata:
3519735233
languageName: node
3519835234
linkType: hard
3519935235

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":
35236+
"semver@npm:^6.0.0, semver@npm:^6.1.2, semver@npm:^6.3.0, semver@npm:^6.3.1":
3520135237
version: 6.3.1
3520235238
resolution: "semver@npm:6.3.1"
3520335239
bin:
@@ -37039,6 +37075,13 @@ __metadata:
3703937075
languageName: node
3704037076
linkType: hard
3704137077

37078+
"tapable@npm:^2.3.3":
37079+
version: 2.3.3
37080+
resolution: "tapable@npm:2.3.3"
37081+
checksum: 10/21fb64a7ae1a0e11d855a6c33a22ae5ecf7e2f23170c942da673b44bf4c3aae8aa52451ef2792d0ce36c7feca13dceafa4f135105d66fc06912632488c0913fd
37082+
languageName: node
37083+
linkType: hard
37084+
3704237085
"tar-stream@npm:^1.5.2":
3704337086
version: 1.6.2
3704437087
resolution: "tar-stream@npm:1.6.2"
@@ -37577,6 +37620,17 @@ __metadata:
3757737620
languageName: node
3757837621
linkType: hard
3757937622

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

0 commit comments

Comments
 (0)