/
.eslintrc.js
183 lines (182 loc) · 5.29 KB
/
.eslintrc.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
module.exports = {
plugins: ["@typescript-eslint", "react", "react-hooks", "jsx-a11y", "jest"],
extends: [
"eslint:recommended",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:jest/recommended",
"plugin:jsx-a11y/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
},
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
es6: true,
node: true,
},
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
],
"no-restricted-syntax": "off",
"no-await-in-loop": "off",
"no-empty": ["error", { allowEmptyCatch: true }],
"no-case-declarations": "off",
"no-console": "warn",
"no-nested-ternary": "error",
"import/named": "off",
"import/namespace": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"react/jsx-handler-names": [
"error",
{
eventHandlerPrefix: "(handle|on|set)",
checkLocalVariables: true,
checkInlineFunction: true,
},
],
"react/no-multi-comp": ["error", { ignoreStateless: true }],
"react/no-access-state-in-setstate": "error",
"react/no-redundant-should-component-update": "error",
"react/no-this-in-sfc": "error",
"react/no-unused-state": "error",
"react/self-closing-comp": "error",
"react/jsx-no-useless-fragment": "error",
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-sort-props": [
"error",
{
callbacksLast: true,
shorthandFirst: true,
ignoreCase: true,
noSortAlphabetically: true,
reservedFirst: true,
},
],
"react-hooks/rules-of-hooks": "error",
/**
* Disable some `plugin:react/recommended` settings.
*/
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"react/jsx-boolean-value": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/no-array-index-key": "warn",
"react/sort-comp": [
"warn",
{
order: [
"static-methods",
"instance-variables",
"getters",
"setters",
"lifecycle",
"render",
"/^render.+$/",
"instance-methods",
"everything-else",
"/^handle.+$/",
],
},
],
},
overrides: [
{
files: ["*.ts", "*.tsx"],
rules: {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/naming-convention": [
"error",
{ selector: "class", format: ["PascalCase"] },
{ selector: "interface", format: ["PascalCase"] },
{ selector: "enum", format: ["PascalCase"] },
{ selector: "enumMember", format: ["UPPER_CASE"] },
{ selector: "method", format: ["PascalCase", "camelCase"] },
{
selector: "variable",
format: ["PascalCase", "camelCase", "UPPER_CASE"],
},
],
"jsx-a11y/no-autofocus": "off", // We want to use `autoFocus` in a fluct optimized component <MultipleFilter />.
"jsx-a11y/control-has-associated-label": [
"error",
{
depth: 10,
},
],
},
},
{
files: ["*.stories.tsx", "*.test.ts", "*.test.tsx"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "./",
},
{
name: ".",
},
],
},
],
"react/jsx-handler-names": "off",
"no-empty": "off",
"no-console": "off",
"react/jsx-key": "off",
"react/jsx-no-useless-fragment": "off",
"react/no-array-index-key": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"react/no-multi-comp": "off",
// I realize it's silly of me, but I'll turn it off here for the sake of specs for once.
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react-hooks/rules-of-hooks": "off",
},
},
{
files: ["*.js"],
rules: {
"import/no-dynamic-require": "off",
"global-require": "off",
camelcase: "off",
"@typescript-eslint/no-var-requires": "off",
},
},
],
};