-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.json
More file actions
190 lines (170 loc) · 4.13 KB
/
.eslintrc.json
File metadata and controls
190 lines (170 loc) · 4.13 KB
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
184
185
186
187
188
189
190
{
"env": {
"browser": true,
"es2020": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"react-app",
"react-app/jest",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:jest-formatting/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"jest",
"jest-formatting"
],
"rules": {
// EsLint Rules
"semi": ["error", "always"],
"import/extensions": 0,
"import/no-named-as-default-member": 0,
// Require a whitespace at the beginning of a comment
"spaced-comment": ["error", "always"],
// Maximum line length for comments
// Trailing comments allowed beyond maximum line length
"max-len": [
"error",
{
"code": 200,
"comments": 100,
"ignoreTrailingComments": true
}
],
// Require braces around blocks
"curly": ["error", "all"],
// Require parentheses around arrow function arguments
"arrow-parens": ["error", "always"],
// Require blank line before certain statements
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": "*",
"next": "function"
},
{
"blankLine": "always",
"prev": "*",
"next": "class"
},
{
"blankLine": "always",
"prev": "*",
"next": "export"
},
{
// Allow consecutive export statements
"blankLine": "any",
"prev": "export",
"next": "export"
},
{
"blankLine": "always",
"prev": "*",
"next": "return"
},
{
"blankLine": "always",
"prev": "*",
"next": "break"
},
{
"blankLine": "always",
"prev": "*",
"next": "continue"
},
{
"blankLine": "always",
"prev": "*",
"next": "throw"
},
{
"blankLine": "always",
"prev": ["const", "let", "var"],
"next": "*"
},
// Allow consecutive variable declarations
{
"blankLine": "any",
"prev": ["const", "let", "var"],
"next": ["const", "let", "var"]
}
],
// eslint-plugin-react rules
// Suppress errors for missing 'import React' in files
// No need of 'import React' for Reactv17 onwards
"react/react-in-jsx-scope": "off",
// Require props to be sorted
"react/jsx-sort-props": [
"error",
{
"callbacksLast": true,
"shorthandFirst": true
}
],
// Omit boolean prop value when set to true
"react/jsx-boolean-value": ["error", "never"],
// Require self closing tags in JSX/HTML
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
// Require PascalCase for user-defined JSX components
"react/jsx-pascal-case": ["error"],
// Disallow unnecessary curly braces in JSX
"react/jsx-curly-brace-presence": ["error", "never"],
// eslint-plugin-react-hooks rules
// Enforce rules of hooks
"react-hooks/rules-of-hooks": "error",
// Console logs cannot be committed.
"no-console": ["error"],
// eslint-plugin-jest rules
// Prefer "it" over "test"
"jest/consistent-test-it": [
"error",
{
"fn": "it",
"withinDescribe": "it"
}
],
// Disallow skipped/disabled tests
"jest/no-disabled-tests": "error",
// Require blank line before certain statements (ESLint rules don't work with Jest)
"jest-formatting/padding-around-all": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
]
},
"settings": {
"import/resolver": {
"babel-module": {
"root": ["./src"],
"extensions": [".ts", ".tsx", ".png", ".svg"]
}
},
"react": {
"version": "detect"
}
}
}