-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
158 lines (155 loc) · 4.57 KB
/
eslint.config.js
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import { default as eslint } from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import tailwind from "eslint-plugin-tailwindcss";
import globals from "globals";
import tseslint from "typescript-eslint";
const reactRuleOverrides = {
disabled: {
"react/require-default-props": "off",
"react/jsx-no-literals": "off",
"react/forbid-component-props": "off",
"react/no-multi-comp": "off",
"react/destructuring-assignment": "off",
"react/function-component-definition": "off",
"react/prop-types": "off",
},
warn: {
"react/no-unused-prop-types": "warn",
"react/jsx-max-depth": "warn",
"react/no-array-index-key": "warn",
"react/jsx-no-bind": "warn",
"react/button-has-type": "warn",
"react/hook-use-state": "warn",
"react/jsx-no-useless-fragment": "warn",
"react/jsx-props-no-spreading": [
"warn",
{
html: "ignore",
},
],
},
};
const typescriptRuleOverrides = {
disabled: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/no-duplicate-type-constituents": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/prefer-reduce-type-parameter": "off",
},
warn: {
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/unbound-method": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/prefer-find": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/use-unknown-in-catch-callback-variable": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/return-await": "warn",
"@typescript-eslint/no-dynamic-delete": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unnecessary-type-parameters": "warn",
"@typescript-eslint/restrict-template-expressions": [
"warn",
{
allowNumber: true,
},
],
},
};
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.stylisticTypeChecked,
...tseslint.configs.strictTypeChecked,
...tailwind.configs["flat/recommended"],
eslintPluginPrettierRecommended,
{
ignores: [
"node_modules/",
"dist/",
"build/",
"storybook-static/",
"coverage/",
".nx/",
"gen/",
"docs/",
"coverage/",
"browser.js",
"packages/*/node_modules/",
"packages/*/dist/",
"packages/*/build/",
"packages/*/storybook-static/",
"packages/*/coverage/",
"packages/*/gen/",
"packages/*/docs/",
"packages/*/.storybook/",
"packages/document-drive/test/*",
],
},
{
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
tailwindcss: {
callees: [
"classnames",
"clsx",
"ctl",
"twMerge",
"twJoin",
"mergeClassNameProps",
"cn",
],
},
},
rules: {
...typescriptRuleOverrides.disabled,
...typescriptRuleOverrides.warn,
},
},
{
files: ["**/*.tsx"],
...reactPlugin.configs.flat.all,
...reactPlugin.configs.flat["jsx-runtime"],
settings: {
react: {
version: "detect",
},
},
plugins: {
react: reactPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
...reactRuleOverrides.disabled,
...reactRuleOverrides.warn,
},
},
);