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