-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.mjs
114 lines (112 loc) · 2.81 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
110
111
112
113
114
import love from "eslint-config-love";
import jsxA11y from "eslint-plugin-jsx-a11y";
import regexp from "eslint-plugin-regexp";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
const files = ["**/*.js", "**/*.ts", "**/*.tsx"];
export default [
{
...love,
files,
},
{
...jsxA11y.flatConfigs.recommended,
files,
},
{
...jsxA11y.flatConfigs.strict,
files,
},
{
...regexp.configs["flat/recommended"],
files,
},
{
...react.configs.flat.recommended,
files,
},
{
...react.configs.flat["jsx-runtime"],
files,
},
{
languageOptions: {
parserOptions: {
project: "./tsconfig.json",
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
"react-hooks": reactHooks,
},
rules: {
...reactHooks.configs.recommended.rules,
// import order
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
alphabetize: {
order: "asc",
},
"newlines-between": "always",
},
],
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1, maxBOF: 0 }],
// prop-types is not used because use typescript
"react/prop-types": "off",
// unnecessary import react because use new JSX transform
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
// prefer import type / export type
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
// Disabled for guarding in Typescript.
"react/no-unknown-property": "off",
// Feature should be imported from the index.ts file
"no-restricted-imports": [
"error",
{
patterns: ["@/features/*/*"],
},
],
// TODO: Remove this rule when the following issue is resolved.
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/unbound-method": "warn",
// Tentatively changed from error to warn due to migration
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/only-throw-error": "warn",
"@typescript-eslint/prefer-destructuring": "warn",
complexity: ["warn", 5],
},
settings: {
react: {
version: "detect",
},
},
files,
},
{
ignores: [
".cache/",
"pnpm-lock.yaml",
"public/",
"src/generated/",
"static/",
"content/",
],
},
];