Skip to content

Commit 44e1521

Browse files
chore: migrate eslint to flat config (#2212)
Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com>
1 parent 25d2c8f commit 44e1521

30 files changed

+694
-772
lines changed

.eslintignore

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

.eslintrc.js

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

eslint.config.mjs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js'
4+
import tseslint from 'typescript-eslint'
5+
import eslintConfigPrettier from 'eslint-config-prettier'
6+
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'
7+
8+
export default tseslint.config(
9+
eslint.configs.recommended,
10+
eslintConfigPrettier,
11+
...tseslint.configs.recommended,
12+
{
13+
languageOptions: {
14+
parserOptions: {
15+
ecmaVersion: 2020,
16+
sourceType: 'module',
17+
},
18+
},
19+
ignores: ['/lib', '/node', '/native', '/config', 'test'],
20+
rules: {
21+
'no-console': [
22+
'error',
23+
{
24+
allow: ['warn', 'error', 'group', 'groupCollapsed', 'groupEnd'],
25+
},
26+
],
27+
'no-async-promise-executor': 'off',
28+
'require-yield': 'off',
29+
'no-empty-pattern': 'off',
30+
'no-control-regex': 'off',
31+
'@typescript-eslint/prefer-ts-expect-error': 'error',
32+
'@typescript-eslint/no-explicit-any': 'off',
33+
'@typescript-eslint/explicit-module-boundary-types': 'off',
34+
'@typescript-eslint/ban-ts-comment': 'off',
35+
'@typescript-eslint/no-namespace': [
36+
'error',
37+
{
38+
allowDeclarations: true,
39+
},
40+
],
41+
'@typescript-eslint/no-var-requires': 'off',
42+
'@typescript-eslint/no-unused-vars': [
43+
'error',
44+
{
45+
varsIgnorePattern: '^_',
46+
argsIgnorePattern: '^_',
47+
},
48+
],
49+
},
50+
},
51+
// Unused variables are useful in test files, and type test files
52+
{
53+
files: [
54+
'**/*.test.ts',
55+
'**/*.test-d.ts',
56+
'**/*.mocks.ts',
57+
'**/*.setup.ts',
58+
'**/*.config.ts',
59+
],
60+
rules: {
61+
'no-console': 'off',
62+
'@typescript-eslint/no-unused-vars': 'off',
63+
},
64+
},
65+
{
66+
files: ['**/*.test-d.ts'],
67+
rules: {
68+
'@typescript-eslint/no-unused-expressions': 'off',
69+
},
70+
},
71+
eslintPluginPrettier,
72+
)

package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"scripts": {
172172
"start": "tsup --watch",
173173
"clean": "rimraf ./lib",
174-
"lint": "eslint \"{cli,src}/**/*.ts\"",
174+
"lint": "eslint \"{cli,src,test}/**/*.ts\"",
175175
"build": "pnpm clean && cross-env NODE_ENV=production tsup && pnpm patch:dts",
176176
"patch:dts": "node \"./config/scripts/patch-ts.js\"",
177177
"publint": "publint",
@@ -259,31 +259,35 @@
259259
"devDependencies": {
260260
"@commitlint/cli": "^18.4.4",
261261
"@commitlint/config-conventional": "^18.4.4",
262-
"@graphql-typed-document-node/core": "^3.2.0",
262+
"@eslint/eslintrc": "^3.3.1",
263+
"@eslint/js": "^9.34.0",
263264
"@fastify/websocket": "^8.3.1",
265+
"@graphql-typed-document-node/core": "^3.2.0",
264266
"@open-draft/test-server": "^0.4.2",
265267
"@ossjs/release": "^0.8.1",
266268
"@playwright/test": "^1.48.0",
269+
"@swc/core": "^1.13.5",
270+
"@types/eslint__js": "^8.42.3",
267271
"@types/express": "^4.17.21",
268272
"@types/json-bigint": "^1.0.4",
269-
"@types/node": "~18.19.28",
270-
"@types/serviceworker": "^0.0.136",
271-
"@typescript-eslint/eslint-plugin": "^8.8.1",
272-
"@typescript-eslint/parser": "^8.8.1",
273-
"@web/dev-server": "^0.4.6",
274-
"axios": "^1.7.7",
273+
"@types/node": "18.x",
274+
"@typescript-eslint/eslint-plugin": "^8.42.0",
275+
"@typescript-eslint/parser": "^8.42.0",
276+
"@web/dev-server": "^0.1.38",
277+
"axios": "^1.6.5",
275278
"babel-minify": "^0.5.1",
276279
"commitizen": "^4.3.1",
277280
"cross-env": "^7.0.3",
278281
"cross-fetch": "^4.0.0",
279282
"cz-conventional-changelog": "3.3.0",
280283
"esbuild": "^0.25.3",
281284
"esbuild-loader": "^4.2.2",
282-
"eslint": "^8.57.0",
283-
"eslint-config-prettier": "^9.1.0",
284-
"eslint-plugin-prettier": "^5.2.1",
285+
"eslint": "^9.34.0",
286+
"eslint-config-prettier": "^10.1.8",
287+
"eslint-plugin-prettier": "^5.5.4",
285288
"express": "^5.0.0",
286289
"fastify": "^4.26.0",
290+
"fs-extra": "^11.2.0",
287291
"fs-teardown": "^0.3.0",
288292
"glob": "^11.0.0",
289293
"jsdom": "^25.0.1",
@@ -292,13 +296,14 @@
292296
"lint-staged": "^15.2.10",
293297
"msw": "workspace:*",
294298
"page-with": "^0.6.1",
295-
"prettier": "^3.4.2",
299+
"prettier": "^3.6.2",
296300
"publint": "^0.3.12",
297301
"regenerator-runtime": "^0.14.1",
298302
"rimraf": "^6.0.1",
299303
"simple-git-hooks": "^2.9.0",
300304
"tsup": "^8.4.0",
301305
"typescript": "^5.9.2",
306+
"typescript-eslint": "^8.42.0",
302307
"undici": "^6.20.0",
303308
"url-loader": "^4.1.1",
304309
"vitest": "^3.1.4",

0 commit comments

Comments
 (0)