Skip to content

Commit 6b3485c

Browse files
authored
chore: migrate to eslint9 (#1529)
1 parent 24e27b4 commit 6b3485c

File tree

7 files changed

+2376
-5198
lines changed

7 files changed

+2376
-5198
lines changed

.eslintignore

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

.eslintrc

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

eslint.config.mjs

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import tsdoc from "eslint-plugin-tsdoc";
2+
import typescriptParser from "@typescript-eslint/parser";
3+
import scwTypescript from '@scaleway/eslint-config-react/typescript';
4+
5+
6+
const scwPlugins = scwTypescript.reduce((acc, config) => {
7+
return { ...acc, ...config.plugins };
8+
}, {});
9+
10+
export default [
11+
{
12+
ignores: [
13+
"**/node_modules/",
14+
"**/dist/",
15+
"**/examples/",
16+
"**/vite.config.ts",
17+
"packages/clients/.eslintrc.cjs",
18+
"eslint.config.mjs",
19+
"packages/clients/src/vendor/base64/index.js",
20+
"packages/configuration-loader/.eslintrc.cjs",
21+
22+
],
23+
},
24+
{
25+
languageOptions: {
26+
ecmaVersion: 5,
27+
sourceType: "script",
28+
parser: typescriptParser,
29+
parserOptions: {
30+
project: ["tsconfig.json"],
31+
},
32+
},
33+
plugins: {
34+
tsdoc,
35+
...scwPlugins,
36+
},
37+
rules: {
38+
"tsdoc/syntax": "warn",
39+
"@typescript-eslint/naming-convention": [
40+
"error",
41+
{
42+
selector: "enumMember",
43+
format: ["PascalCase"],
44+
},
45+
],
46+
"import/prefer-default-export": "off",
47+
"import/no-default-export": "error",
48+
"no-await-in-loop": "off",
49+
"@typescript-eslint/no-namespace": "off",
50+
},
51+
},
52+
53+
...scwTypescript.map(config => ({
54+
...config,
55+
files: ['**/*.ts', '**/*.tsx'],
56+
rules: {
57+
...config.rules,
58+
//new rules
59+
"no-restricted-syntax": "warn",
60+
"no-useless-escape": "warn",
61+
"max-classes-per-file": "warn",
62+
"no-underscore-dangle": "warn",
63+
"no-await-in-loop": "warn",
64+
"@typescript-eslint/no-unused-vars": "warn",
65+
"@typescript-eslint/consistent-type-definitions": "warn",
66+
"@typescript-eslint/ban-types": "warn",
67+
},
68+
})),
69+
70+
...scwTypescript.map(config => ({
71+
...config,
72+
files: [
73+
"./packages/clients/src/scw/**/*.ts",
74+
"./packages/clients/src/internal/**/*.ts",
75+
],
76+
rules: {
77+
...config.rules,
78+
"@typescript-eslint/no-unused-vars": "off",
79+
"@typescript-eslint/consistent-type-definitions": "off",
80+
},
81+
82+
})),
83+
84+
...scwTypescript.map(config => ({
85+
...config,
86+
files: ["**/*.test.ts", "__tests__/**/*.ts", "**/vite.config.ts"],
87+
rules: {
88+
...config.rules,
89+
"import/no-extraneous-dependencies": "off",
90+
},
91+
92+
})),
93+
94+
...scwTypescript.map(config => ({
95+
...config,
96+
files: ["packages/clients/src/api/dedibox/v1/*.ts"],
97+
rules: {
98+
...config.rules,
99+
"no-use-before-define": "off",
100+
"@typescript-eslint/no-use-before-define": "off",
101+
"@typescript-eslint/no-unused-vars": "off",
102+
"@typescript-eslint/consistent-type-definitions": "off",
103+
"max-classes-per-file": "off",
104+
"no-restricted-syntax": "off",
105+
},
106+
107+
})),
108+
109+
];

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"commit": "npx git-cz -a",
1616
"doc": "typedoc",
1717
"format": "prettier --write '**/*.ts'",
18-
"lint": "eslint --cache --ext ts .",
18+
"lint": "eslint --cache .",
1919
"prepare": "husky",
2020
"test": "vitest run",
2121
"test:coverage": "vitest run --coverage",
@@ -24,7 +24,7 @@
2424
"lint-staged": {
2525
"*.ts": [
2626
"prettier --write",
27-
"eslint --fix --ext ts"
27+
"eslint --fix ."
2828
],
2929
"*.yaml": [
3030
"prettier --write"
@@ -46,7 +46,8 @@
4646
"devDependencies": {
4747
"@commitlint/cli": "19.5.0",
4848
"@commitlint/config-conventional": "19.5.0",
49-
"@scaleway/eslint-config-react": "3.18.4",
49+
"@scaleway/eslint-config-react": "4.0.8",
50+
"@typescript-eslint/eslint-plugin": "latest",
5051
"@vitest/coverage-istanbul": "2.0.5",
5152
"@vitest/coverage-v8": "2.0.5",
5253
"@vitest/ui": "2.0.5",
@@ -56,7 +57,7 @@
5657
"cross-fetch": "4.0.0",
5758
"cz-conventional-changelog": "3.3.0",
5859
"esbuild-plugin-browserslist": "0.14.0",
59-
"eslint": "8.57.0",
60+
"eslint": "9.7.0",
6061
"eslint-plugin-tsdoc": "0.3.0",
6162
"husky": "9.1.6",
6263
"jsdom": "25.0.0",

0 commit comments

Comments
 (0)