-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.yaml
265 lines (261 loc) · 7.29 KB
/
.eslintrc.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
254
255
256
257
258
259
260
261
262
263
264
265
env:
es2021: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 12
sourceType: module
tsconfigRootDir: ./
project:
- ./tsconfig.json
- ./src/server/tsconfig.json
plugins:
- "@typescript-eslint"
ignorePatterns:
- "*.mjs"
- "*.js"
rules:
# vanilla warn
accessor-pairs:
- warn
- setWithoutGet: true
enforceForClassMembers: true
array-bracket-spacing:
- warn
- always
- objectsInArrays: false
arraysInArrays: false
arrow-spacing: warn
comma-style: warn
dot-location:
- warn
- property
eol-last:
- warn
- always
# dot-notation: "off" (should be fixed with typescript!)
func-call-spacing: warn
grouped-accessor-pairs:
- warn
- getBeforeSet
key-spacing:
- warn
- beforeColon: false
afterColon: true
mode: strict
lines-between-class-members:
- warn
- always
- exceptAfterSingleLine: true
no-alert: warn
no-console: warn
no-empty: warn
no-multi-spaces: warn
no-multiple-empty-lines:
- warn
- max: 1
maxEOF: 0
maxBOF: 0
no-negated-condition: warn
no-trailing-spaces:
- warn
- skipBlankLines: true
no-useless-concat: warn
no-useless-return: warn
no-whitespace-before-property: warn
object-curly-spacing:
- warn
- always
object-shorthand: warn
operator-linebreak:
- warn
- before
padded-blocks:
- warn
- never
prefer-const: warn
semi-spacing:
- warn
- before: false
after: true
semi-style: warn
space-before-blocks: warn
space-before-function-paren:
- warn
- anonymous: always
named: never
asyncArrow: always
space-in-parens: warn
space-infix-ops: warn
spaced-comment:
- warn
- always
switch-colon-spacing: warn
template-curly-spacing: warn
yoda: warn
# vanilla error
array-callback-return: error
arrow-parens: error
curly: error
default-case: error
default-case-last: error
eqeqeq: error
init-declarations: error
linebreak-style:
- error
- unix
new-parens: error
no-caller: error
no-constructor-return: error
no-extend-native: error
no-floating-decimal: error
no-implicit-coercion: error
no-labels: error
no-multi-assign: error
no-new: error
no-new-func: error
no-new-object: error
no-new-wrappers: error
no-param-reassign: error
no-plusplus: error
no-restricted-globals:
- error
- name: parseInt
message: Use Number.parseInt instead.
- name: parseFloat
message: Use Number.parseFloat instead.
- name: NaN
message: Use Number.NaN instead.
- name: Infinity
message: Use Number.Infinity instead.
- name: isFinite
message: Use Number.isFinite instead.
- name: isNaN
message: Use Number.isNaN instead.
- name: globalThis
message: globalThis is not allowed.
- name: require
message: require is not allowed.
no-restricted-syntax:
- error
- selector: BinaryExpression[operator="**"]
message: Unexpected exponential operator, use Math.pow instead.
- selector: UnaryExpression[operator="delete"]
message: Unexpected operator, delete operator is not allowed.
- selector: DoWhileStatement
message: Unexpected statement, do while loop statement is not allowed.
- selector: ForInStatement
message: Unexpected statement, for-in loop statement is not allowed.
- selector: ForOfStatement
message: Unexpected statement, for-of loop statement is not allowed.
- selector: ForStatement
message: Unexpected statement, traditional for loop statement is not allowed.
- selector: ClassExpression
message: Class expression is not allowed, use class definition instead.
- selector: ClassProperty > ArrowFunctionExpression
message: Arrow function expression is not allowed inside class.
- selector: Identifier[optional=true]
message: Optional parameter is not allowed.
- selector: ThrowStatement[argument.type="CallExpression"]
message: Use new keyword when throwing.
- selector: FunctionExpression > AssignmentPattern
message: Default parameter is not allowed.
- selector: MethodDefinition[kind!="set"] > FunctionExpression[params.length=1] > Identifier > TSTypeAnnotation > TSTypeReference > Identifier[name=/Array/]
message: Use spread parameter instead of single array parameter.
- selector: TSAbstractMethodDefinition[accessibility="public"]
message: Abstract method do not explicitly need 'public' keyword.
- selector: ExportDefaultDeclaration[declaration.type!="Identifier"]
message: Export default must not use with declaration statement.
- MemberExpression[object.name="Array"][property.name!="from"]
- ArrayExpression[elements.length=1] > SpreadElement
- MemberExpression[object.name="Object"][property.name!=/values|keys|entries/]
no-sequences: error
no-template-curly-in-string: error
no-throw-literal: error
# no-void: error
no-undefined: error
no-unneeded-ternary:
- error
- defaultAssignment: false
one-var:
- error
- never
prefer-arrow-callback: error
prefer-object-spread: error
prefer-promise-reject-errors: error
prefer-regex-literals: error
prefer-template: error
quote-props:
- error
- as-needed
# typescript warn
comma-spacing: "off"
"@typescript-eslint/comma-spacing":
- warn
- before: false
after: true
no-empty-function: "off"
"@typescript-eslint/no-empty-function": warn
brace-style: "off"
"@typescript-eslint/brace-style":
- warn
- stroustrup
indent: "off"
"@typescript-eslint/indent":
- warn
- 2
keyword-spacing: "off"
"@typescript-eslint/keyword-spacing": warn
"@typescript-eslint/no-empty-interface": warn
"@typescript-eslint/prefer-string-starts-ends-with": warn
"@typescript-eslint/type-annotation-spacing": warn
# typescript error
comma-dangle: "off"
"@typescript-eslint/comma-dangle": error
quotes: "off"
"@typescript-eslint/quotes":
- error
- double
semi: "off"
"@typescript-eslint/semi": error
"@typescript-eslint/array-type":
- error
- default: array
"@typescript-eslint/ban-types":
- error
- types:
undefined:
message: Use null instead
fixWith: "null"
never: It is unsafe
unknown: It is unsafe
const: Use const in variable declaration instead
"@typescript-eslint/member-delimiter-style":
- error
- multiline:
delimiter: semi
requireLast: true
singleline:
delimiter: semi
requireLast: true
"@typescript-eslint/method-signature-style":
- error
- method
"@typescript-eslint/no-explicit-any": error
"@typescript-eslint/no-dynamic-delete": error
"@typescript-eslint/no-invalid-void-type": error
"@typescript-eslint/no-misused-promises":
- error
- checksVoidReturn: false
"@typescript-eslint/no-non-null-assertion": "error"
"@typescript-eslint/no-this-alias": error
"@typescript-eslint/non-nullable-type-assertion-style": error
"@typescript-eslint/restrict-plus-operands":
- error
- checkCompoundAssignments: true
# typescript off
"@typescript-eslint/restrict-template-expressions": "off"
"@typescript-eslint/no-unsafe-argument": "off"