/
default.yml
340 lines (328 loc) · 12 KB
/
default.yml
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
reportUnusedDisableDirectives: true
extends:
- "eslint:recommended"
- "plugin:n/recommended"
- "plugin:jsdoc/recommended"
- "plugin:eslint-comments/recommended"
plugins:
- unicorn
settings:
jsdoc:
tagNamePreference:
file: "fileoverview"
augments: "extends"
class: "constructor"
preferredTypes:
"*":
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
replacement: "any"
Any:
message: "Use a more precise type or if necessary use `any` or `ArbitraryCallbackResult`"
replacement: "any"
# Function:
# message: "Point to a `@callback` namepath or `GenericCallback` if truly arbitrary in form"
# replacement: "GenericCallback"
# function:
# message: "Point to a `@callback` namepath or `GenericCallback` if truly arbitrary in form"
# replacement: "GenericCallback"
function:
message: "Point to a `@callback` namepath or `Function` if truly arbitrary in form"
replacement: "Function"
Promise:
message: "Specify the specific Promise type, including, if necessary, the type `any`"
".<>":
message: "Prefer type form without dot"
replacement: "<>"
# Object:
# message: "Use the specific object type or `PlainObject` if truly arbitrary"
# replacement: "PlainObject"
# object:
# message: "Use the specific object type or `PlainObject` if truly arbitrary"
# replacement: "PlainObject"
object:
message: "Use the specific object type or `Object` if truly arbitrary"
replacement: "Object"
# Array:
# message: "Use the specific array type or `GenericArray` if it is truly arbitrary."
# replacement: "GenericArray"
# array:
# message: "Use specific array type or `GenericArray` if it is truly arbitrary."
# replacement: "GenericArray"
array: "Array"
rules:
array-bracket-spacing: "error"
array-callback-return: "error"
arrow-body-style: ["error", "as-needed"]
arrow-parens: ["error", "as-needed"]
arrow-spacing: "error"
indent: ["error", 4, { SwitchCase: 1 }]
block-spacing: "error"
brace-style: ["error", "1tbs"]
camelcase: "error"
class-methods-use-this: "error"
comma-dangle: "error"
comma-spacing: "error"
comma-style: ["error", "last"]
computed-property-spacing: "error"
consistent-return: "error"
curly: ["error", "all"]
default-case: "error"
default-case-last: "error"
default-param-last: "error"
dot-location: ["error", "property"]
dot-notation: ["error", { allowKeywords: true }]
eol-last: "error"
eqeqeq: "error"
eslint-comments/disable-enable-pair: ["error"]
eslint-comments/no-unused-disable: "error"
eslint-comments/require-description: "error"
func-call-spacing: "error"
func-style: ["error", "declaration"]
function-call-argument-newline: ["error", "consistent"]
function-paren-newline: ["error", "consistent"]
generator-star-spacing: "error"
grouped-accessor-pairs: "error"
guard-for-in: "error"
# jsdoc: adopt non-recommended rules or change recommended configuration
# jsdoc/check-examples: "error"
# jsdoc/check-indentation: "error" # Revisit if allowing configurable spaces after tag line breaks
jsdoc/check-line-alignment: ["error", "never"]
jsdoc/check-syntax: "error"
# jsdoc/check-types': ["error', { exemptTagContexts: [ { tag: "typedef", types: ["object", "GenericObject"] } ] }
jsdoc/check-values: ["error", { allowedLicenses: true }]
jsdoc/newline-after-description: ["error", "never"]
jsdoc/no-bad-blocks: "error"
jsdoc/require-asterisk-prefix: "error"
jsdoc/require-description: ["error", { checkConstructors: false }]
# jsdoc/require-file-overview: "error"
jsdoc/require-hyphen-before-param-description: ["error", "never"]
jsdoc/require-returns:
["error", { forceRequireReturn: true, forceReturnsWithAsync: true }]
jsdoc/require-throws: "error"
jsdoc/tag-lines:
[
"error",
"never",
{
tags:
{
example: { lines: "always" },
fileoverview: { lines: "any" },
},
},
]
# jsdoc: disable recommended rules
jsdoc/no-undefined-types: "off"
jsdoc/require-yields: "off"
# jsdoc: change recommended rules from warnings into errors
jsdoc/check-access: "error"
jsdoc/check-alignment: "error"
jsdoc/check-param-names: "error"
jsdoc/check-property-names: "error"
jsdoc/check-tag-names: "error"
jsdoc/check-types: "error"
jsdoc/empty-tags: "error"
jsdoc/implements-on-classes: "error"
jsdoc/multiline-blocks: "error"
jsdoc/no-multi-asterisks: "error"
jsdoc/require-jsdoc: ["error", { require: { ClassDeclaration: true } }]
jsdoc/require-param: "error"
jsdoc/require-param-description: "error"
jsdoc/require-param-name: "error"
jsdoc/require-param-type: "error"
jsdoc/require-property: "error"
jsdoc/require-property-description: "error"
jsdoc/require-property-name: "error"
jsdoc/require-property-type: "error"
jsdoc/require-returns-check: "error"
jsdoc/require-returns-description: "error"
jsdoc/require-returns-type: "error"
jsdoc/require-yields-check: "error"
jsdoc/valid-types: "error"
key-spacing: ["error", { beforeColon: false, afterColon: true }]
keyword-spacing: "error"
lines-around-comment:
[
"error",
{
beforeBlockComment: true,
afterBlockComment: false,
beforeLineComment: true,
afterLineComment: false,
},
]
max-len:
[
"error",
160,
{
"ignoreComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
},
]
max-statements-per-line: "error"
new-cap: "error"
new-parens: "error"
no-alert: "error"
no-array-constructor: "error"
no-caller: "error"
no-confusing-arrow: "error"
no-console: "error"
no-constant-binary-expression: "error"
no-constructor-return: "error"
no-else-return: ["error", { allowElseIf: false }]
no-eval: "error"
no-extend-native: "error"
no-extra-bind: "error"
no-floating-decimal: "error"
no-implied-eval: "error"
no-invalid-this: "error"
no-iterator: "error"
no-label-var: "error"
no-labels: "error"
no-lone-blocks: "error"
no-loop-func: "error"
no-mixed-spaces-and-tabs: ["error", false] # Modified from recommended
no-multi-spaces: "error"
no-multi-str: "error"
no-multiple-empty-lines: ["error", { max: 2, maxBOF: 0, maxEOF: 0 }]
no-nested-ternary: "error"
no-new: "error"
no-new-func: "error"
no-new-object: "error"
no-new-wrappers: "error"
no-octal-escape: "error"
no-param-reassign: "error"
no-proto: "error"
no-process-exit: "off"
no-restricted-properties:
[
"error",
{
property: "substring",
message: "Use .slice instead of .substring.",
},
{ property: "substr", message: "Use .slice instead of .substr." },
{
object: "assert",
property: "equal",
message: "Use assert.strictEqual instead of assert.equal.",
},
{
object: "assert",
property: "notEqual",
message: "Use assert.notStrictEqual instead of assert.notEqual.",
},
{
object: "assert",
property: "deepEqual",
message: "Use assert.deepStrictEqual instead of assert.deepEqual.",
},
{
object: "assert",
property: "notDeepEqual",
message: "Use assert.notDeepStrictEqual instead of assert.notDeepEqual.",
},
]
no-return-assign: "error"
no-script-url: "error"
no-self-compare: "error"
no-sequences: "error"
no-shadow: "error"
no-tabs: "error"
no-throw-literal: "error"
no-trailing-spaces: "error"
no-undef: ["error", { typeof: true }] # Modified from recommended
no-undef-init: "error"
no-undefined: "error"
no-underscore-dangle: ["error", { allowAfterThis: true }]
no-unmodified-loop-condition: "error"
no-unneeded-ternary: "error"
no-unreachable-loop: "error"
no-unused-expressions: "error"
no-unused-vars: [
"error",
{ vars: "all", args: "after-used", caughtErrors: "all" },
] # Modified from recommended
no-use-before-define: "error"
no-useless-call: "error"
no-useless-computed-key: "error"
no-useless-concat: "error"
no-useless-constructor: "error"
no-useless-rename: "error"
no-useless-return: "error"
no-whitespace-before-property: "error"
no-var: "error"
n/callback-return: ["error", ["cb", "callback", "next"]]
n/handle-callback-err: ["error", "err"]
n/no-deprecated-api: "error"
n/no-mixed-requires: "error"
n/no-new-require: "error"
n/no-path-concat: "error"
object-curly-newline: ["error", { "consistent": true, "multiline": true }]
object-curly-spacing: ["error", "always"]
object-property-newline: ["error", { "allowAllPropertiesOnSameLine": true }]
object-shorthand: ["error", "always", { "avoidExplicitReturnArrows": true }]
one-var-declaration-per-line: "error"
operator-assignment: "error"
operator-linebreak: "error"
padding-line-between-statements:
[
"error",
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
{
blankLine: "any",
prev: ["const", "let", "var"],
next: ["const", "let", "var"],
},
]
prefer-arrow-callback: "error"
prefer-const: "error"
prefer-exponentiation-operator: "error"
prefer-numeric-literals: "error"
prefer-promise-reject-errors: "error"
prefer-regex-literals: "error"
prefer-rest-params: "error"
prefer-spread: "error"
prefer-template: "error"
quotes: ["error", "double", { avoidEscape: true }]
quote-props: ["error", "as-needed"]
radix: "error"
require-unicode-regexp: "error"
rest-spread-spacing: "error"
semi: "error"
semi-spacing: ["error", { before: false, after: true }]
semi-style: "error"
space-before-blocks: "error"
space-before-function-paren:
[
"error",
{ "anonymous": "never", "named": "never", "asyncArrow": "always" },
]
space-in-parens: "error"
space-infix-ops: "error"
space-unary-ops: ["error", { words: true, nonwords: false }]
spaced-comment: ["error", "always", { exceptions: ["-"] }]
strict: ["error", "global"]
switch-colon-spacing: "error"
symbol-description: "error"
template-curly-spacing: ["error", "never"]
template-tag-spacing: "error"
unicode-bom: "error"
# Selectively-enable unicorn rules since many of its recommended rules are too aggressive/stylistic for us.
unicorn/prefer-array-find: "error"
unicorn/prefer-array-flat-map: "error"
unicorn/prefer-array-flat: "error"
unicorn/prefer-array-index-of: "error"
unicorn/prefer-array-some: "error"
unicorn/prefer-includes: "error"
unicorn/prefer-set-has: "error"
unicorn/prefer-string-slice: "error"
unicorn/prefer-string-starts-ends-with: "error"
unicorn/prefer-string-trim-start-end: "error"
wrap-iife: "error"
yield-star-spacing: "error"
yoda: ["error", "never", { exceptRange: true }]