-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.mjs
88 lines (87 loc) · 2.47 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
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import storybookPlugin from "eslint-plugin-storybook";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
ignores: ["!.storybook", "dist/", "jaeger-ui/", "storybook-static/"]
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
project: "./tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
ecmaVersion: 2022
}
},
rules: {
"@typescript-eslint/consistent-type-imports": "error"
}
},
{
files: ["**/*.tsx"],
...reactPlugin.configs.flat.recommended,
settings: {
react: {
version: "detect"
}
}
},
{
files: ["**/*.tsx"],
...reactPlugin.configs.flat["jsx-runtime"]
},
// TODO: fix types by updating "eslint-plugin-react-hooks" once the following issue is resolved
// https://github.com/facebook/react/issues/28313
// https://github.com/facebook/react/pull/30774
{
files: ["**/*.{ts,tsx}"],
plugins: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
"react-hooks": reactHooksPlugin
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
rules: reactHooksPlugin.configs.recommended.rules
},
storybookPlugin.configs["flat/recommended"],
eslintConfigPrettier,
// Custom rules
{
rules: {
curly: "error",
"no-console": "error",
"no-useless-return": "error"
}
},
{
files: ["**/*.tsx"],
rules: {
"react/jsx-boolean-value": ["error", "always"],
"react/jsx-curly-brace-presence": [
"error",
{ props: "always", children: "ignore", propElementValues: "always" }
]
}
},
{
files: ["src/components/common/icons/**/*Icon.tsx"],
rules: {
"react/jsx-curly-brace-presence": "off"
}
},
{
files: ["src/redux/services/digmaCodeGen.ts"],
rules: {
"@typescript-eslint/dot-notation": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/consistent-indexed-object-style": "warn",
"@typescript-eslint/consistent-type-definitions": "warn"
}
}
);