-
Notifications
You must be signed in to change notification settings - Fork 245
/
eslint-config.yaml
253 lines (194 loc) · 5.27 KB
/
eslint-config.yaml
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
---
env:
es2020: true
jest: true
node: true
plugins:
- '@typescript-eslint'
- import
- prettier
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 2020
impliedStrict: true
sourceType: script
project: ./**/tsconfig.json
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:import/typescript
- prettier
- plugin:prettier/recommended
settings:
import/parsers:
'@typescript-eslint/parser': ['.ts', '.tsx']
import/resolver:
node: {}
typescript:
project: ./**/tsconfig.json
ignorePatterns:
# Ignore Jest configuration file (it's excluded from tsconfig.json, so it's problematic!)
- jest.config.ts
rules:
# Custom Configurations
'prettier/prettier':
- error
'@typescript-eslint/array-type':
- error
- default: array-simple
readonly: array-simple
'@typescript-eslint/await-thenable':
- error
'@typescript-eslint/explicit-module-boundary-types':
- off
'@typescript-eslint/explicit-member-accessibility':
- error
'@typescript-eslint/member-ordering':
- error
- default:
- static-field
- static-method
- instance-field
- constructor
- instance-method
'@typescript-eslint/no-empty-function':
- error
- allow: [constructors]
'@typescript-eslint/no-floating-promises':
- error
'@typescript-eslint/no-for-in-array':
- error
'@typescript-eslint/no-misused-promises':
- error
'@typescript-eslint/no-require-imports':
- error
'@typescript-eslint/no-unsafe-assignment':
- off
'@typescript-eslint/no-unsafe-call':
- off
'@typescript-eslint/no-unsafe-member-access':
- off
'@typescript-eslint/no-unsafe-return':
- off
'@typescript-eslint/no-unused-vars':
- error
- args: all
argsIgnorePattern: ^_
caughtErrors: all
vars: all
varsIgnorePattern: ^_
'@typescript-eslint/no-useless-constructor':
- error
'@typescript-eslint/prefer-for-of':
- error
'@typescript-eslint/prefer-nullish-coalescing':
- error
- ignoreMixedLogicalExpressions: true
'@typescript-eslint/prefer-readonly':
- error
'@typescript-eslint/promise-function-async':
- error
- checkArrowFunctions: false
'@typescript-eslint/restrict-template-expressions':
- error
- allowNumber: true
allowBoolean: true
allowAny: true
allowNullish: true
'@typescript-eslint/require-await':
- error
'@typescript-eslint/return-await':
- error
- 'in-try-catch'
'@typescript-eslint/switch-exhaustiveness-check':
- error
'complexity':
- off
'dot-notation':
- error
'eqeqeq':
- error
- always
- null: ignore
'import/no-duplicates':
- error
'import/no-extraneous-dependencies':
- error
- devDependencies: # Only allow importing devDependencies from tests
- '**/test/**'
- '**/*.test.ts'
optionalDependencies: false # Disallow importing optional dependencies (those shouldn't be used here)
peerDependencies: false # Disallow importing peer dependencies (those shouldn't be used here)
'import/no-unresolved':
- error
- ignore:
- '@jsii/check-node/run' # @jsii/check-node uses an export map, which import/resolver does not (yet) support (https://github.com/import-js/eslint-plugin-import/issues/1868)
- worker_threads # This isn't supported in all node versions (import is always guarded)
'import/order':
- error
- alphabetize:
order: asc
caseInsensitive: true
groups:
- [builtin, external]
- [parent, sibling]
- [index, unknown]
newlines-between: always
'no-alert':
- error
'no-await-in-loop':
- error
'no-caller':
- error
'no-else-return':
- error
- allowElseIf: true
'no-eval':
- error
'no-extra-bind':
- error
'no-implied-eval':
- error
'no-lone-blocks':
- error
'no-new-symbol':
- error
'no-proto':
- error
'no-restricted-properties':
- error
- { property: "substr", message: "Use .slice instead of .substr." }
'no-return-await':
- error
'no-unused-expressions':
- error
'no-useless-call':
- error
'no-var':
- error
'prefer-const':
- error
'prefer-template':
- error
'eol-last':
- error
- always
# Disabled rules
'@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/interface-name-prefix': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-use-before-define': off
'@typescript-eslint/unbound-method': off
'no-case-declarations': off
'require-atomic-updates': off
# This is not a bad rule but it got sprung on us and our code loudly fails it
# Disable to get the eslint upgrade to pass.
'@typescript-eslint/no-unsafe-argument': off
# 'consistent-return' actually decreases safety. Its use will enforce useless `throws`
# statements, forcing a runtime error that occlude cases where the TypeScript type
# checker would actually have caught something like a non-exhaustive `switch` statement
# at compile time.
'consistent-return': off