@bhsd/code-standard 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint.mjs +1102 -0
- package/eslintrc.cjs +1 -1
- package/package.json +21 -13
package/eslint.mjs
ADDED
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
3
|
+
import promise from 'eslint-plugin-promise';
|
|
4
|
+
import regexp from 'eslint-plugin-regexp';
|
|
5
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
6
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
7
|
+
import eslintComments from 'eslint-plugin-eslint-comments';
|
|
8
|
+
import jsonc from 'eslint-plugin-jsonc';
|
|
9
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
10
|
+
import n from 'eslint-plugin-n';
|
|
11
|
+
import esX from 'eslint-plugin-es-x';
|
|
12
|
+
import globals from 'globals';
|
|
13
|
+
|
|
14
|
+
const tsRecommended = typescriptEslint.configs['flat/recommended-type-checked'],
|
|
15
|
+
files = ['**/*.ts'];
|
|
16
|
+
const getConfig = rules => ({
|
|
17
|
+
languageOptions: {
|
|
18
|
+
globals: globals.browser,
|
|
19
|
+
},
|
|
20
|
+
plugins: {'es-x': esX},
|
|
21
|
+
settings: {
|
|
22
|
+
'es-x': {
|
|
23
|
+
aggressive: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
rules,
|
|
27
|
+
});
|
|
28
|
+
export const ignores = {
|
|
29
|
+
ignores: [
|
|
30
|
+
'**/dist/',
|
|
31
|
+
'**/build/',
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
general = [
|
|
35
|
+
js.configs.recommended,
|
|
36
|
+
promise.configs['flat/recommended'],
|
|
37
|
+
regexp.configs['flat/recommended'],
|
|
38
|
+
{
|
|
39
|
+
languageOptions: {
|
|
40
|
+
ecmaVersion: 'latest',
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
'array-callback-return': 2,
|
|
44
|
+
'no-cond-assign': [
|
|
45
|
+
2,
|
|
46
|
+
'always',
|
|
47
|
+
],
|
|
48
|
+
'no-constant-binary-expression': 2,
|
|
49
|
+
'no-constructor-return': 2,
|
|
50
|
+
'no-fallthrough': 2,
|
|
51
|
+
'no-inner-declarations': [
|
|
52
|
+
2,
|
|
53
|
+
'both',
|
|
54
|
+
],
|
|
55
|
+
'no-irregular-whitespace': [
|
|
56
|
+
2,
|
|
57
|
+
{
|
|
58
|
+
skipStrings: false,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
'no-promise-executor-return': 2,
|
|
62
|
+
'no-self-compare': 2,
|
|
63
|
+
'no-template-curly-in-string': 2,
|
|
64
|
+
'no-unassigned-vars': 2,
|
|
65
|
+
'no-undef': [
|
|
66
|
+
2,
|
|
67
|
+
{
|
|
68
|
+
typeof: true,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
'no-unmodified-loop-condition': 2,
|
|
72
|
+
'no-unreachable-loop': 2,
|
|
73
|
+
'no-unsafe-negation': [
|
|
74
|
+
2,
|
|
75
|
+
{
|
|
76
|
+
enforceForOrderingRelations: true,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
'no-unsafe-optional-chaining': [
|
|
80
|
+
2,
|
|
81
|
+
{
|
|
82
|
+
disallowArithmeticOperators: true,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
'no-unused-private-class-members': 2,
|
|
86
|
+
'no-unused-vars': [
|
|
87
|
+
2,
|
|
88
|
+
{
|
|
89
|
+
args: 'all',
|
|
90
|
+
argsIgnorePattern: '^_+$',
|
|
91
|
+
caughtErrors: 'all',
|
|
92
|
+
ignoreRestSiblings: true,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
'no-use-before-define': [
|
|
96
|
+
2,
|
|
97
|
+
{
|
|
98
|
+
functions: false,
|
|
99
|
+
variables: false,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
'no-useless-assignment': 2,
|
|
103
|
+
'require-atomic-updates': [
|
|
104
|
+
2,
|
|
105
|
+
{
|
|
106
|
+
allowProperties: true,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
'use-isnan': [
|
|
110
|
+
2,
|
|
111
|
+
{
|
|
112
|
+
enforceForIndexOf: true,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
'valid-typeof': [
|
|
116
|
+
2,
|
|
117
|
+
{
|
|
118
|
+
requireStringLiterals: true,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
'accessor-pairs': 2,
|
|
122
|
+
'arrow-body-style': 2,
|
|
123
|
+
'block-scoped-var': 2,
|
|
124
|
+
camelcase: 2,
|
|
125
|
+
'class-methods-use-this': 2,
|
|
126
|
+
'consistent-return': 2,
|
|
127
|
+
curly: 2,
|
|
128
|
+
'default-case': 2,
|
|
129
|
+
'default-case-last': 2,
|
|
130
|
+
'default-param-last': 2,
|
|
131
|
+
'dot-notation': 2,
|
|
132
|
+
eqeqeq: 2,
|
|
133
|
+
'func-name-matching': [
|
|
134
|
+
2,
|
|
135
|
+
{
|
|
136
|
+
considerPropertyDescriptor: true,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
'func-names': [
|
|
140
|
+
2,
|
|
141
|
+
'never',
|
|
142
|
+
],
|
|
143
|
+
'func-style': 2,
|
|
144
|
+
'grouped-accessor-pairs': [
|
|
145
|
+
2,
|
|
146
|
+
'getBeforeSet',
|
|
147
|
+
],
|
|
148
|
+
'guard-for-in': 2,
|
|
149
|
+
'logical-assignment-operators': [
|
|
150
|
+
2,
|
|
151
|
+
'always',
|
|
152
|
+
{
|
|
153
|
+
enforceForIfStatements: true,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
'new-cap': 2,
|
|
157
|
+
'no-alert': 2,
|
|
158
|
+
'no-array-constructor': 2,
|
|
159
|
+
'no-bitwise': 2,
|
|
160
|
+
'no-caller': 2,
|
|
161
|
+
'no-else-return': 2,
|
|
162
|
+
'no-empty': [
|
|
163
|
+
2,
|
|
164
|
+
{
|
|
165
|
+
allowEmptyCatch: true,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
'no-empty-function': [
|
|
169
|
+
2,
|
|
170
|
+
{
|
|
171
|
+
allow: ['arrowFunctions'],
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
'no-empty-static-block': 2,
|
|
175
|
+
'no-eval': 2,
|
|
176
|
+
'no-extend-native': 2,
|
|
177
|
+
'no-extra-bind': 2,
|
|
178
|
+
'no-extra-boolean-cast': [
|
|
179
|
+
2,
|
|
180
|
+
{
|
|
181
|
+
enforceForLogicalOperands: true,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
'no-implicit-coercion': 2,
|
|
185
|
+
'no-implicit-globals': 2,
|
|
186
|
+
'no-implied-eval': 2,
|
|
187
|
+
'no-invalid-this': [
|
|
188
|
+
2,
|
|
189
|
+
{
|
|
190
|
+
capIsConstructor: false,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
'no-lone-blocks': 2,
|
|
194
|
+
'no-lonely-if': 2,
|
|
195
|
+
'no-loop-func': 2,
|
|
196
|
+
'no-multi-assign': 2,
|
|
197
|
+
'no-multi-str': 2,
|
|
198
|
+
'no-nested-ternary': 2,
|
|
199
|
+
'no-new': 2,
|
|
200
|
+
'no-new-func': 2,
|
|
201
|
+
'no-new-object': 2,
|
|
202
|
+
'no-new-wrappers': 2,
|
|
203
|
+
'no-octal-escape': 2,
|
|
204
|
+
'no-param-reassign': 2,
|
|
205
|
+
'no-return-assign': [
|
|
206
|
+
2,
|
|
207
|
+
'always',
|
|
208
|
+
],
|
|
209
|
+
'no-return-await': 2,
|
|
210
|
+
'no-script-url': 2,
|
|
211
|
+
'no-sequences': [
|
|
212
|
+
2,
|
|
213
|
+
{
|
|
214
|
+
allowInParentheses: false,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
'no-shadow': [
|
|
218
|
+
2,
|
|
219
|
+
{
|
|
220
|
+
builtinGlobals: true,
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
'no-throw-literal': 2,
|
|
224
|
+
'no-undef-init': 2,
|
|
225
|
+
'no-underscore-dangle': [
|
|
226
|
+
2,
|
|
227
|
+
{
|
|
228
|
+
allow: [
|
|
229
|
+
'_',
|
|
230
|
+
'__',
|
|
231
|
+
],
|
|
232
|
+
enforceInMethodNames: true,
|
|
233
|
+
enforceInClassFields: true,
|
|
234
|
+
allowInArrayDestructuring: false,
|
|
235
|
+
allowInObjectDestructuring: false,
|
|
236
|
+
allowFunctionParams: false,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
'no-unneeded-ternary': [
|
|
240
|
+
2,
|
|
241
|
+
{
|
|
242
|
+
defaultAssignment: false,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
'no-unused-expressions': 2,
|
|
246
|
+
'no-useless-call': 2,
|
|
247
|
+
'no-useless-computed-key': [
|
|
248
|
+
2,
|
|
249
|
+
{
|
|
250
|
+
enforceForClassMembers: true,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
'no-useless-concat': 2,
|
|
254
|
+
'no-useless-constructor': 2,
|
|
255
|
+
'no-useless-return': 2,
|
|
256
|
+
'no-var': 2,
|
|
257
|
+
'no-void': [
|
|
258
|
+
2,
|
|
259
|
+
{
|
|
260
|
+
allowAsStatement: true,
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
'object-shorthand': 2,
|
|
264
|
+
'operator-assignment': 2,
|
|
265
|
+
'prefer-arrow-callback': 2,
|
|
266
|
+
'prefer-const': 2,
|
|
267
|
+
'prefer-destructuring': [
|
|
268
|
+
2,
|
|
269
|
+
{
|
|
270
|
+
VariableDeclarator: {
|
|
271
|
+
array: true,
|
|
272
|
+
object: true,
|
|
273
|
+
},
|
|
274
|
+
AssignmentExpression: {
|
|
275
|
+
array: true,
|
|
276
|
+
object: true,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
'prefer-exponentiation-operator': 2,
|
|
281
|
+
'prefer-numeric-literals': 2,
|
|
282
|
+
'prefer-object-has-own': 2,
|
|
283
|
+
'prefer-object-spread': 2,
|
|
284
|
+
'prefer-regex-literals': [
|
|
285
|
+
2,
|
|
286
|
+
{
|
|
287
|
+
disallowRedundantWrapping: true,
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
'prefer-rest-params': 2,
|
|
291
|
+
'prefer-spread': 2,
|
|
292
|
+
'prefer-template': 2,
|
|
293
|
+
radix: [
|
|
294
|
+
2,
|
|
295
|
+
'as-needed',
|
|
296
|
+
],
|
|
297
|
+
'require-await': 2,
|
|
298
|
+
'require-unicode-regexp': 2,
|
|
299
|
+
strict: 2,
|
|
300
|
+
'symbol-description': 2,
|
|
301
|
+
'vars-on-top': 2,
|
|
302
|
+
yoda: 2,
|
|
303
|
+
'promise/always-return': [
|
|
304
|
+
2,
|
|
305
|
+
{
|
|
306
|
+
ignoreLastCallback: true,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
'promise/catch-or-return': [
|
|
310
|
+
2,
|
|
311
|
+
{
|
|
312
|
+
allowThen: true,
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
'promise/no-multiple-resolved': 2,
|
|
316
|
+
'promise/prefer-await-to-then': 2,
|
|
317
|
+
'promise/spec-only': 2,
|
|
318
|
+
'regexp/no-dupe-disjunctions': [
|
|
319
|
+
2,
|
|
320
|
+
{
|
|
321
|
+
report: 'interesting',
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
'regexp/no-misleading-capturing-group': [
|
|
325
|
+
2,
|
|
326
|
+
{
|
|
327
|
+
reportBacktrackingEnds: false,
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
'regexp/no-super-linear-move': 2,
|
|
331
|
+
'regexp/no-octal': 2,
|
|
332
|
+
'regexp/no-standalone-backslash': 2,
|
|
333
|
+
'regexp/no-useless-character-class': [
|
|
334
|
+
2,
|
|
335
|
+
{
|
|
336
|
+
ignores: [],
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
'regexp/prefer-escape-replacement-dollar-char': 2,
|
|
340
|
+
'regexp/prefer-quantifier': 2,
|
|
341
|
+
'regexp/prefer-regexp-exec': 2,
|
|
342
|
+
'regexp/prefer-regexp-test': 2,
|
|
343
|
+
'regexp/hexadecimal-escape': 2,
|
|
344
|
+
'regexp/letter-case': [
|
|
345
|
+
2,
|
|
346
|
+
{
|
|
347
|
+
unicodeEscape: 'uppercase',
|
|
348
|
+
hexadecimalEscape: 'uppercase',
|
|
349
|
+
controlEscape: 'uppercase',
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
'regexp/prefer-character-class': [
|
|
353
|
+
2,
|
|
354
|
+
{
|
|
355
|
+
minAlternatives: 2,
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
'regexp/prefer-lookaround': [
|
|
359
|
+
2,
|
|
360
|
+
{
|
|
361
|
+
lookbehind: false,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
'regexp/unicode-property': 2,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
plugins: {'@stylistic': stylistic},
|
|
369
|
+
rules: {
|
|
370
|
+
'@stylistic/array-bracket-newline': [
|
|
371
|
+
2,
|
|
372
|
+
{
|
|
373
|
+
multiline: true,
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
'@stylistic/array-bracket-spacing': 2,
|
|
377
|
+
'@stylistic/array-element-newline': [
|
|
378
|
+
2,
|
|
379
|
+
'consistent',
|
|
380
|
+
],
|
|
381
|
+
'@stylistic/arrow-parens': [
|
|
382
|
+
2,
|
|
383
|
+
'as-needed',
|
|
384
|
+
],
|
|
385
|
+
'@stylistic/arrow-spacing': 2,
|
|
386
|
+
'@stylistic/block-spacing': [
|
|
387
|
+
2,
|
|
388
|
+
'never',
|
|
389
|
+
],
|
|
390
|
+
'@stylistic/brace-style': 2,
|
|
391
|
+
'@stylistic/comma-dangle': [
|
|
392
|
+
2,
|
|
393
|
+
'always-multiline',
|
|
394
|
+
],
|
|
395
|
+
'@stylistic/comma-spacing': 2,
|
|
396
|
+
'@stylistic/comma-style': 2,
|
|
397
|
+
'@stylistic/computed-property-spacing': 2,
|
|
398
|
+
'@stylistic/dot-location': [
|
|
399
|
+
2,
|
|
400
|
+
'property',
|
|
401
|
+
],
|
|
402
|
+
'@stylistic/eol-last': 2,
|
|
403
|
+
'@stylistic/function-call-argument-newline': [
|
|
404
|
+
2,
|
|
405
|
+
'consistent',
|
|
406
|
+
],
|
|
407
|
+
'@stylistic/function-call-spacing': 2,
|
|
408
|
+
'@stylistic/function-paren-newline': [
|
|
409
|
+
2,
|
|
410
|
+
'multiline-arguments',
|
|
411
|
+
],
|
|
412
|
+
'@stylistic/indent': [
|
|
413
|
+
2,
|
|
414
|
+
'tab',
|
|
415
|
+
{
|
|
416
|
+
SwitchCase: 1,
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
'@stylistic/indent-binary-ops': [
|
|
420
|
+
2,
|
|
421
|
+
'tab',
|
|
422
|
+
],
|
|
423
|
+
'@stylistic/key-spacing': 2,
|
|
424
|
+
'@stylistic/keyword-spacing': 2,
|
|
425
|
+
'@stylistic/linebreak-style': 2,
|
|
426
|
+
'@stylistic/lines-around-comment': [
|
|
427
|
+
2,
|
|
428
|
+
{
|
|
429
|
+
allowBlockStart: true,
|
|
430
|
+
ignorePattern: String.raw`^\* @`,
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
'@stylistic/lines-between-class-members': [
|
|
434
|
+
2,
|
|
435
|
+
'always',
|
|
436
|
+
{
|
|
437
|
+
exceptAfterSingleLine: true,
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
'@stylistic/max-len': [
|
|
441
|
+
2,
|
|
442
|
+
{
|
|
443
|
+
code: 120,
|
|
444
|
+
},
|
|
445
|
+
],
|
|
446
|
+
'@stylistic/multiline-comment-style': [
|
|
447
|
+
2,
|
|
448
|
+
'separate-lines',
|
|
449
|
+
],
|
|
450
|
+
'@stylistic/multiline-ternary': [
|
|
451
|
+
2,
|
|
452
|
+
'always-multiline',
|
|
453
|
+
],
|
|
454
|
+
'@stylistic/new-parens': 2,
|
|
455
|
+
'@stylistic/newline-per-chained-call': [
|
|
456
|
+
2,
|
|
457
|
+
{
|
|
458
|
+
ignoreChainWithDepth: 4,
|
|
459
|
+
},
|
|
460
|
+
],
|
|
461
|
+
'@stylistic/no-extra-parens': [
|
|
462
|
+
2,
|
|
463
|
+
'all',
|
|
464
|
+
{
|
|
465
|
+
allowParensAfterCommentPattern: '@type',
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
'@stylistic/no-extra-semi': 2,
|
|
469
|
+
'@stylistic/no-floating-decimal': 2,
|
|
470
|
+
'@stylistic/no-mixed-spaces-and-tabs': 2,
|
|
471
|
+
'@stylistic/no-multi-spaces': [
|
|
472
|
+
2,
|
|
473
|
+
{
|
|
474
|
+
exceptions: {},
|
|
475
|
+
},
|
|
476
|
+
],
|
|
477
|
+
'@stylistic/no-multiple-empty-lines': [
|
|
478
|
+
2,
|
|
479
|
+
{
|
|
480
|
+
max: 1,
|
|
481
|
+
maxBOF: 0,
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
'@stylistic/no-tabs': [
|
|
485
|
+
2,
|
|
486
|
+
{
|
|
487
|
+
allowIndentationTabs: true,
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
'@stylistic/no-trailing-spaces': 2,
|
|
491
|
+
'@stylistic/no-whitespace-before-property': 2,
|
|
492
|
+
'@stylistic/object-curly-newline': [
|
|
493
|
+
2,
|
|
494
|
+
{
|
|
495
|
+
multiline: true,
|
|
496
|
+
consistent: true,
|
|
497
|
+
},
|
|
498
|
+
],
|
|
499
|
+
'@stylistic/object-curly-spacing': 2,
|
|
500
|
+
'@stylistic/object-property-newline': [
|
|
501
|
+
2,
|
|
502
|
+
{
|
|
503
|
+
allowAllPropertiesOnSameLine: true,
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
'@stylistic/one-var-declaration-per-line': 2,
|
|
507
|
+
'@stylistic/operator-linebreak': [
|
|
508
|
+
2,
|
|
509
|
+
'before',
|
|
510
|
+
{
|
|
511
|
+
overrides: {
|
|
512
|
+
'=': 'after',
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
],
|
|
516
|
+
'@stylistic/padded-blocks': [
|
|
517
|
+
2,
|
|
518
|
+
'never',
|
|
519
|
+
],
|
|
520
|
+
'@stylistic/quote-props': [
|
|
521
|
+
2,
|
|
522
|
+
'as-needed',
|
|
523
|
+
],
|
|
524
|
+
'@stylistic/quotes': [
|
|
525
|
+
2,
|
|
526
|
+
'single',
|
|
527
|
+
{
|
|
528
|
+
allowTemplateLiterals: 'avoidEscape',
|
|
529
|
+
avoidEscape: true,
|
|
530
|
+
},
|
|
531
|
+
],
|
|
532
|
+
'@stylistic/rest-spread-spacing': 2,
|
|
533
|
+
'@stylistic/semi': 2,
|
|
534
|
+
'@stylistic/semi-spacing': 2,
|
|
535
|
+
'@stylistic/semi-style': 2,
|
|
536
|
+
'@stylistic/space-before-blocks': 2,
|
|
537
|
+
'@stylistic/space-before-function-paren': [
|
|
538
|
+
2,
|
|
539
|
+
{
|
|
540
|
+
anonymous: 'never',
|
|
541
|
+
named: 'never',
|
|
542
|
+
asyncArrow: 'always',
|
|
543
|
+
},
|
|
544
|
+
],
|
|
545
|
+
'@stylistic/space-in-parens': 2,
|
|
546
|
+
'@stylistic/space-infix-ops': 2,
|
|
547
|
+
'@stylistic/space-unary-ops': 2,
|
|
548
|
+
'@stylistic/spaced-comment': 2,
|
|
549
|
+
'@stylistic/switch-colon-spacing': 2,
|
|
550
|
+
'@stylistic/template-curly-spacing': 2,
|
|
551
|
+
'@stylistic/wrap-iife': [
|
|
552
|
+
2,
|
|
553
|
+
'inside',
|
|
554
|
+
],
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
plugins: {unicorn},
|
|
559
|
+
rules: {
|
|
560
|
+
'unicorn/catch-error-name': [
|
|
561
|
+
2,
|
|
562
|
+
{
|
|
563
|
+
name: 'e',
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
'unicorn/consistent-assert': 2,
|
|
567
|
+
'unicorn/consistent-date-clone': 2,
|
|
568
|
+
'unicorn/consistent-existence-index-check': 2,
|
|
569
|
+
'unicorn/consistent-function-scoping': [
|
|
570
|
+
2,
|
|
571
|
+
{
|
|
572
|
+
checkArrowFunctions: false,
|
|
573
|
+
},
|
|
574
|
+
],
|
|
575
|
+
'unicorn/empty-brace-spaces': 2,
|
|
576
|
+
'unicorn/error-message': 2,
|
|
577
|
+
'unicorn/explicit-length-check': 2,
|
|
578
|
+
'unicorn/new-for-builtins': 2,
|
|
579
|
+
'unicorn/no-abusive-eslint-disable': 2,
|
|
580
|
+
'unicorn/no-accessor-recursion': 2,
|
|
581
|
+
'unicorn/no-array-for-each': 2,
|
|
582
|
+
'unicorn/no-array-method-this-argument': 2,
|
|
583
|
+
'unicorn/no-array-reduce': 2,
|
|
584
|
+
'unicorn/no-await-in-promise-methods': 2,
|
|
585
|
+
'unicorn/no-immediate-mutation': 2,
|
|
586
|
+
'unicorn/no-instanceof-builtins': 2,
|
|
587
|
+
'unicorn/no-invalid-remove-event-listener': 2,
|
|
588
|
+
'unicorn/no-lonely-if': 2,
|
|
589
|
+
'unicorn/no-named-default': 2,
|
|
590
|
+
'unicorn/no-negated-condition': 2,
|
|
591
|
+
'unicorn/no-negation-in-equality-check': 2,
|
|
592
|
+
'unicorn/no-object-as-default-parameter': 2,
|
|
593
|
+
'unicorn/no-single-promise-in-promise-methods': 2,
|
|
594
|
+
'unicorn/no-static-only-class': 2,
|
|
595
|
+
'unicorn/no-this-assignment': 2,
|
|
596
|
+
'unicorn/no-typeof-undefined': [
|
|
597
|
+
2,
|
|
598
|
+
{
|
|
599
|
+
checkGlobalVariables: true,
|
|
600
|
+
},
|
|
601
|
+
],
|
|
602
|
+
'unicorn/no-unnecessary-array-flat-depth': 2,
|
|
603
|
+
'unicorn/no-unnecessary-array-splice-count': 2,
|
|
604
|
+
'unicorn/no-unreadable-iife': 2,
|
|
605
|
+
'unicorn/no-unused-properties': 2,
|
|
606
|
+
'unicorn/no-useless-collection-argument': 2,
|
|
607
|
+
'unicorn/no-useless-fallback-in-spread': 2,
|
|
608
|
+
'unicorn/no-useless-length-check': 2,
|
|
609
|
+
'unicorn/no-useless-spread': 2,
|
|
610
|
+
'unicorn/no-useless-switch-case': 2,
|
|
611
|
+
'unicorn/number-literal-case': 2,
|
|
612
|
+
'unicorn/numeric-separators-style': 2,
|
|
613
|
+
'unicorn/prefer-array-find': 2,
|
|
614
|
+
'unicorn/prefer-array-flat': 2,
|
|
615
|
+
'unicorn/prefer-array-flat-map': 2,
|
|
616
|
+
'unicorn/prefer-array-index-of': 2,
|
|
617
|
+
'unicorn/prefer-array-some': 2,
|
|
618
|
+
'unicorn/prefer-bigint-literals': 2,
|
|
619
|
+
'unicorn/prefer-class-fields': 2,
|
|
620
|
+
'unicorn/prefer-code-point': 2,
|
|
621
|
+
'unicorn/prefer-default-parameters': 2,
|
|
622
|
+
'unicorn/prefer-global-this': 2,
|
|
623
|
+
'unicorn/prefer-includes': 2,
|
|
624
|
+
'unicorn/prefer-keyboard-event-key': 2,
|
|
625
|
+
'unicorn/prefer-logical-operator-over-ternary': 2,
|
|
626
|
+
'unicorn/prefer-math-min-max': 2,
|
|
627
|
+
'unicorn/prefer-native-coercion-functions': 2,
|
|
628
|
+
'unicorn/prefer-negative-index': 2,
|
|
629
|
+
'unicorn/prefer-optional-catch-binding': 2,
|
|
630
|
+
'unicorn/prefer-prototype-methods': 2,
|
|
631
|
+
'unicorn/prefer-single-call': 2,
|
|
632
|
+
'unicorn/prefer-spread': 2,
|
|
633
|
+
'unicorn/prefer-string-raw': 2,
|
|
634
|
+
'unicorn/prefer-string-starts-ends-with': 2,
|
|
635
|
+
'unicorn/prefer-switch': 2,
|
|
636
|
+
'unicorn/prefer-ternary': 2,
|
|
637
|
+
'unicorn/require-module-attributes': 2,
|
|
638
|
+
'unicorn/switch-case-braces': [
|
|
639
|
+
2,
|
|
640
|
+
'avoid',
|
|
641
|
+
],
|
|
642
|
+
'unicorn/text-encoding-identifier-case': 2,
|
|
643
|
+
'unicorn/throw-new-error': 2,
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
plugins: {'eslint-comments': eslintComments},
|
|
648
|
+
rules: {
|
|
649
|
+
...eslintComments.configs.recommended.rules,
|
|
650
|
+
'eslint-comments/disable-enable-pair': [
|
|
651
|
+
2,
|
|
652
|
+
{
|
|
653
|
+
allowWholeFile: true,
|
|
654
|
+
},
|
|
655
|
+
],
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
],
|
|
659
|
+
jsDoc = {
|
|
660
|
+
plugins: {jsdoc},
|
|
661
|
+
rules: {
|
|
662
|
+
'jsdoc/check-alignment': 1,
|
|
663
|
+
'jsdoc/check-indentation': [
|
|
664
|
+
1,
|
|
665
|
+
{
|
|
666
|
+
excludeTags: ['description'],
|
|
667
|
+
},
|
|
668
|
+
],
|
|
669
|
+
'jsdoc/check-param-names': [
|
|
670
|
+
1,
|
|
671
|
+
{
|
|
672
|
+
disableMissingParamChecks: true,
|
|
673
|
+
},
|
|
674
|
+
],
|
|
675
|
+
'jsdoc/check-tag-names': 1,
|
|
676
|
+
'jsdoc/check-types': 1,
|
|
677
|
+
'jsdoc/multiline-blocks': 1,
|
|
678
|
+
'jsdoc/no-bad-blocks': [
|
|
679
|
+
1,
|
|
680
|
+
{
|
|
681
|
+
preventAllMultiAsteriskBlocks: true,
|
|
682
|
+
},
|
|
683
|
+
],
|
|
684
|
+
'jsdoc/no-multi-asterisks': 1,
|
|
685
|
+
'jsdoc/require-asterisk-prefix': 1,
|
|
686
|
+
'jsdoc/require-description': [
|
|
687
|
+
1,
|
|
688
|
+
{
|
|
689
|
+
exemptedBy: [
|
|
690
|
+
'license',
|
|
691
|
+
'type',
|
|
692
|
+
],
|
|
693
|
+
checkConstructors: false,
|
|
694
|
+
checkSetters: false,
|
|
695
|
+
},
|
|
696
|
+
],
|
|
697
|
+
'jsdoc/require-hyphen-before-param-description': [
|
|
698
|
+
1,
|
|
699
|
+
'never',
|
|
700
|
+
],
|
|
701
|
+
'jsdoc/require-jsdoc': [
|
|
702
|
+
1,
|
|
703
|
+
{
|
|
704
|
+
contexts: [
|
|
705
|
+
'FunctionDeclaration:not(TSDeclareFunction + FunctionDeclaration)',
|
|
706
|
+
'TSDeclareFunction:not(TSDeclareFunction + TSDeclareFunction)',
|
|
707
|
+
'MethodDefinition:not('
|
|
708
|
+
+ 'MethodDefinition:has(TSEmptyBodyFunctionExpression) + MethodDefinition,'
|
|
709
|
+
+ "[kind='get'] + [kind='set'],"
|
|
710
|
+
+ '[override=true]'
|
|
711
|
+
+ ')',
|
|
712
|
+
],
|
|
713
|
+
exemptEmptyConstructors: true,
|
|
714
|
+
checkGetters: true,
|
|
715
|
+
checkSetters: 'no-getter',
|
|
716
|
+
},
|
|
717
|
+
],
|
|
718
|
+
'jsdoc/require-param-description': 1,
|
|
719
|
+
'jsdoc/require-param-name': 1,
|
|
720
|
+
'jsdoc/require-param': [
|
|
721
|
+
1,
|
|
722
|
+
{
|
|
723
|
+
checkConstructors: false,
|
|
724
|
+
},
|
|
725
|
+
],
|
|
726
|
+
'jsdoc/require-throws': 1,
|
|
727
|
+
},
|
|
728
|
+
settings: {
|
|
729
|
+
jsdoc: {
|
|
730
|
+
tagNamePreference: {
|
|
731
|
+
augments: 'extends',
|
|
732
|
+
},
|
|
733
|
+
ignorePrivate: true,
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
json = [
|
|
738
|
+
...jsonc.configs['flat/recommended-with-json'],
|
|
739
|
+
{
|
|
740
|
+
files: ['**/*.json'],
|
|
741
|
+
rules: {
|
|
742
|
+
'jsonc/array-bracket-newline': [
|
|
743
|
+
2,
|
|
744
|
+
{
|
|
745
|
+
minItems: 1,
|
|
746
|
+
},
|
|
747
|
+
],
|
|
748
|
+
'jsonc/array-bracket-spacing': 2,
|
|
749
|
+
'jsonc/array-element-newline': [
|
|
750
|
+
2,
|
|
751
|
+
'always',
|
|
752
|
+
],
|
|
753
|
+
'jsonc/comma-style': 2,
|
|
754
|
+
'jsonc/indent': [
|
|
755
|
+
2,
|
|
756
|
+
'tab',
|
|
757
|
+
],
|
|
758
|
+
'jsonc/key-spacing': 2,
|
|
759
|
+
'jsonc/no-irregular-whitespace': 2,
|
|
760
|
+
'jsonc/no-octal-escape': 2,
|
|
761
|
+
'jsonc/object-curly-newline': [
|
|
762
|
+
2,
|
|
763
|
+
{
|
|
764
|
+
minProperties: 1,
|
|
765
|
+
},
|
|
766
|
+
],
|
|
767
|
+
'jsonc/object-curly-spacing': 2,
|
|
768
|
+
'jsonc/object-property-newline': [
|
|
769
|
+
2,
|
|
770
|
+
{
|
|
771
|
+
allowAllPropertiesOnSameLine: false,
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
'@stylistic/max-len': 0,
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
],
|
|
778
|
+
ts = [
|
|
779
|
+
...tsRecommended,
|
|
780
|
+
{
|
|
781
|
+
languageOptions: {
|
|
782
|
+
parserOptions: {
|
|
783
|
+
project: './tsconfig.json',
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
rules: {
|
|
787
|
+
'class-methods-use-this': 0,
|
|
788
|
+
'@typescript-eslint/class-methods-use-this': [
|
|
789
|
+
2,
|
|
790
|
+
{
|
|
791
|
+
ignoreOverrideMethods: true,
|
|
792
|
+
},
|
|
793
|
+
],
|
|
794
|
+
'default-param-last': 0,
|
|
795
|
+
'@typescript-eslint/default-param-last': 2,
|
|
796
|
+
'dot-notation': 0,
|
|
797
|
+
'@typescript-eslint/dot-notation': [
|
|
798
|
+
2,
|
|
799
|
+
{
|
|
800
|
+
allowIndexSignaturePropertyAccess: true,
|
|
801
|
+
},
|
|
802
|
+
],
|
|
803
|
+
'no-empty-function': 0,
|
|
804
|
+
'@typescript-eslint/no-empty-function': [
|
|
805
|
+
2,
|
|
806
|
+
{
|
|
807
|
+
allow: ['arrowFunctions'],
|
|
808
|
+
},
|
|
809
|
+
],
|
|
810
|
+
'no-invalid-this': 0,
|
|
811
|
+
'@typescript-eslint/no-invalid-this': [
|
|
812
|
+
2,
|
|
813
|
+
{
|
|
814
|
+
capIsConstructor: false,
|
|
815
|
+
},
|
|
816
|
+
],
|
|
817
|
+
'no-loop-func': 0,
|
|
818
|
+
'@typescript-eslint/no-loop-func': 2,
|
|
819
|
+
'no-redeclare': 0,
|
|
820
|
+
'@typescript-eslint/no-redeclare': 2,
|
|
821
|
+
'no-shadow': 0,
|
|
822
|
+
'@typescript-eslint/no-shadow': [
|
|
823
|
+
2,
|
|
824
|
+
{
|
|
825
|
+
builtinGlobals: true,
|
|
826
|
+
},
|
|
827
|
+
],
|
|
828
|
+
'no-use-before-define': 0,
|
|
829
|
+
'@typescript-eslint/no-use-before-define': [
|
|
830
|
+
2,
|
|
831
|
+
{
|
|
832
|
+
functions: false,
|
|
833
|
+
variables: false,
|
|
834
|
+
},
|
|
835
|
+
],
|
|
836
|
+
'no-useless-constructor': 0,
|
|
837
|
+
'@typescript-eslint/no-useless-constructor': 2,
|
|
838
|
+
'prefer-destructuring': 0,
|
|
839
|
+
'@typescript-eslint/prefer-destructuring': [
|
|
840
|
+
2,
|
|
841
|
+
{
|
|
842
|
+
VariableDeclarator: {
|
|
843
|
+
array: true,
|
|
844
|
+
object: true,
|
|
845
|
+
},
|
|
846
|
+
AssignmentExpression: {
|
|
847
|
+
array: true,
|
|
848
|
+
object: true,
|
|
849
|
+
},
|
|
850
|
+
},
|
|
851
|
+
],
|
|
852
|
+
'unicorn/prefer-string-starts-ends-with': 0,
|
|
853
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 2,
|
|
854
|
+
'@typescript-eslint/consistent-generic-constructors': 2,
|
|
855
|
+
'@typescript-eslint/consistent-indexed-object-style': 2,
|
|
856
|
+
'@typescript-eslint/consistent-type-assertions': 2,
|
|
857
|
+
'@typescript-eslint/consistent-type-definitions': 2,
|
|
858
|
+
'@typescript-eslint/consistent-type-exports': 2,
|
|
859
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
860
|
+
2,
|
|
861
|
+
{
|
|
862
|
+
disallowTypeAnnotations: false,
|
|
863
|
+
},
|
|
864
|
+
],
|
|
865
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
866
|
+
2,
|
|
867
|
+
{
|
|
868
|
+
allowIIFEs: true,
|
|
869
|
+
},
|
|
870
|
+
],
|
|
871
|
+
'@typescript-eslint/method-signature-style': [
|
|
872
|
+
2,
|
|
873
|
+
'method',
|
|
874
|
+
],
|
|
875
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 2,
|
|
876
|
+
'@typescript-eslint/no-confusing-void-expression': 2,
|
|
877
|
+
'@typescript-eslint/no-dupe-class-members': 2,
|
|
878
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
879
|
+
2,
|
|
880
|
+
{
|
|
881
|
+
allowInterfaces: 'with-single-extends',
|
|
882
|
+
},
|
|
883
|
+
],
|
|
884
|
+
'@typescript-eslint/no-explicit-any': [
|
|
885
|
+
2,
|
|
886
|
+
{
|
|
887
|
+
ignoreRestArgs: true,
|
|
888
|
+
},
|
|
889
|
+
],
|
|
890
|
+
'@typescript-eslint/no-floating-promises': [
|
|
891
|
+
2,
|
|
892
|
+
{
|
|
893
|
+
ignoreIIFE: true,
|
|
894
|
+
},
|
|
895
|
+
],
|
|
896
|
+
'@typescript-eslint/no-invalid-void-type': [
|
|
897
|
+
2,
|
|
898
|
+
{
|
|
899
|
+
allowAsThisParameter: true,
|
|
900
|
+
},
|
|
901
|
+
],
|
|
902
|
+
'@typescript-eslint/no-misused-spread': 2,
|
|
903
|
+
'@typescript-eslint/no-namespace': [
|
|
904
|
+
2,
|
|
905
|
+
{
|
|
906
|
+
allowDeclarations: true,
|
|
907
|
+
},
|
|
908
|
+
],
|
|
909
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 2,
|
|
910
|
+
'@typescript-eslint/no-this-alias': [
|
|
911
|
+
2,
|
|
912
|
+
{
|
|
913
|
+
allowedNames: ['self'],
|
|
914
|
+
},
|
|
915
|
+
],
|
|
916
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2,
|
|
917
|
+
'@typescript-eslint/no-unnecessary-condition': [
|
|
918
|
+
2,
|
|
919
|
+
{
|
|
920
|
+
allowConstantLoopConditions: true,
|
|
921
|
+
},
|
|
922
|
+
],
|
|
923
|
+
'@typescript-eslint/no-unnecessary-qualifier': 2,
|
|
924
|
+
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
925
|
+
'@typescript-eslint/no-unsafe-call': 0,
|
|
926
|
+
'@typescript-eslint/no-unsafe-return': 0,
|
|
927
|
+
'@typescript-eslint/no-useless-empty-export': 2,
|
|
928
|
+
'@typescript-eslint/no-unused-vars': [
|
|
929
|
+
2,
|
|
930
|
+
{
|
|
931
|
+
args: 'all',
|
|
932
|
+
argsIgnorePattern: '^_+$',
|
|
933
|
+
caughtErrors: 'all',
|
|
934
|
+
ignoreRestSiblings: true,
|
|
935
|
+
},
|
|
936
|
+
],
|
|
937
|
+
'@typescript-eslint/no-var-requires': 0,
|
|
938
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 2,
|
|
939
|
+
'@typescript-eslint/prefer-for-of': 2,
|
|
940
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 2,
|
|
941
|
+
'@typescript-eslint/prefer-return-this-type': 2,
|
|
942
|
+
'@typescript-eslint/related-getter-setter-pairs': 2,
|
|
943
|
+
'@typescript-eslint/switch-exhaustiveness-check': [
|
|
944
|
+
2,
|
|
945
|
+
{
|
|
946
|
+
considerDefaultExhaustiveForUnions: true,
|
|
947
|
+
},
|
|
948
|
+
],
|
|
949
|
+
'@typescript-eslint/unified-signatures': 2,
|
|
950
|
+
'func-style': 0,
|
|
951
|
+
'@stylistic/member-delimiter-style': [
|
|
952
|
+
2,
|
|
953
|
+
{
|
|
954
|
+
singleline: {
|
|
955
|
+
delimiter: 'comma',
|
|
956
|
+
},
|
|
957
|
+
},
|
|
958
|
+
],
|
|
959
|
+
'@stylistic/type-annotation-spacing': [
|
|
960
|
+
2,
|
|
961
|
+
{
|
|
962
|
+
before: false,
|
|
963
|
+
after: true,
|
|
964
|
+
overrides: {
|
|
965
|
+
arrow: {
|
|
966
|
+
before: true,
|
|
967
|
+
},
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
],
|
|
971
|
+
'@stylistic/type-generic-spacing': 2,
|
|
972
|
+
'@stylistic/type-named-tuple-spacing': 2,
|
|
973
|
+
'jsdoc/check-types': 0,
|
|
974
|
+
},
|
|
975
|
+
},
|
|
976
|
+
].map(obj => ({files, ...obj})),
|
|
977
|
+
node = [
|
|
978
|
+
n.configs['flat/recommended-script'],
|
|
979
|
+
{
|
|
980
|
+
files: [
|
|
981
|
+
'**/*.mjs',
|
|
982
|
+
'**/*.ts',
|
|
983
|
+
],
|
|
984
|
+
languageOptions: {
|
|
985
|
+
sourceType: 'module',
|
|
986
|
+
},
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
rules: {
|
|
990
|
+
'n/exports-style': [
|
|
991
|
+
2,
|
|
992
|
+
'module.exports',
|
|
993
|
+
],
|
|
994
|
+
'n/no-missing-import': [
|
|
995
|
+
2,
|
|
996
|
+
{
|
|
997
|
+
ignoreTypeImport: true,
|
|
998
|
+
},
|
|
999
|
+
],
|
|
1000
|
+
'n/no-mixed-requires': 2,
|
|
1001
|
+
'n/no-new-require': 2,
|
|
1002
|
+
'n/no-path-concat': 2,
|
|
1003
|
+
'n/no-unsupported-features/node-builtins': [
|
|
1004
|
+
2,
|
|
1005
|
+
{
|
|
1006
|
+
ignores: ['fetch'],
|
|
1007
|
+
},
|
|
1008
|
+
],
|
|
1009
|
+
},
|
|
1010
|
+
settings: {
|
|
1011
|
+
n: {
|
|
1012
|
+
tryExtensions: [
|
|
1013
|
+
'.js',
|
|
1014
|
+
'.json',
|
|
1015
|
+
'.ts',
|
|
1016
|
+
],
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
],
|
|
1021
|
+
browser = getConfig({
|
|
1022
|
+
'prefer-object-has-own': 0,
|
|
1023
|
+
'es-x/no-array-prototype-at': 2,
|
|
1024
|
+
'es-x/no-array-prototype-findlast-findlastindex': 2,
|
|
1025
|
+
'es-x/no-array-prototype-toreversed': 2,
|
|
1026
|
+
'es-x/no-array-prototype-tosorted': 2,
|
|
1027
|
+
'es-x/no-array-prototype-tospliced': 2,
|
|
1028
|
+
'es-x/no-array-prototype-with': 2,
|
|
1029
|
+
'es-x/no-dataview-prototype-getfloat16-setfloat16': 2,
|
|
1030
|
+
'es-x/no-error-cause': 2,
|
|
1031
|
+
'es-x/no-float16array': 2,
|
|
1032
|
+
'es-x/no-iterator': 2,
|
|
1033
|
+
'es-x/no-iterator-prototype-drop': 2,
|
|
1034
|
+
'es-x/no-iterator-prototype-take': 2,
|
|
1035
|
+
'es-x/no-iterator-prototype-toarray': 2,
|
|
1036
|
+
'es-x/no-map-groupby': 2,
|
|
1037
|
+
'es-x/no-math-f16round': 2,
|
|
1038
|
+
'es-x/no-object-groupby': 2,
|
|
1039
|
+
'es-x/no-object-hasown': 2,
|
|
1040
|
+
'es-x/no-promise-any': 2,
|
|
1041
|
+
'es-x/no-promise-try': 2,
|
|
1042
|
+
'es-x/no-promise-withresolvers': 2,
|
|
1043
|
+
'es-x/no-regexp-d-flag': 2,
|
|
1044
|
+
'es-x/no-regexp-duplicate-named-capturing-groups': 2,
|
|
1045
|
+
'es-x/no-regexp-escape': 2,
|
|
1046
|
+
'es-x/no-regexp-lookbehind-assertions': 2,
|
|
1047
|
+
'es-x/no-regexp-modifiers': 2,
|
|
1048
|
+
'es-x/no-regexp-v-flag': 2,
|
|
1049
|
+
'es-x/no-set-prototype-difference': 2,
|
|
1050
|
+
'es-x/no-set-prototype-intersection': 2,
|
|
1051
|
+
'es-x/no-set-prototype-isdisjointfrom': 2,
|
|
1052
|
+
'es-x/no-set-prototype-issubsetof': 2,
|
|
1053
|
+
'es-x/no-set-prototype-issupersetof': 2,
|
|
1054
|
+
'es-x/no-set-prototype-symmetricdifference': 2,
|
|
1055
|
+
'es-x/no-set-prototype-union': 2,
|
|
1056
|
+
'es-x/no-string-prototype-at': 2,
|
|
1057
|
+
'es-x/no-string-prototype-iswellformed': 2,
|
|
1058
|
+
'es-x/no-string-prototype-replaceall': 2,
|
|
1059
|
+
'es-x/no-string-prototype-towellformed': 2,
|
|
1060
|
+
}),
|
|
1061
|
+
dist = getConfig({
|
|
1062
|
+
...esX.configs['flat/restrict-to-es2020'].rules,
|
|
1063
|
+
'es-x/no-iterator-prototype-every': 0,
|
|
1064
|
+
'es-x/no-iterator-prototype-filter': 0,
|
|
1065
|
+
'es-x/no-iterator-prototype-find': 0,
|
|
1066
|
+
'es-x/no-iterator-prototype-flatmap': 0,
|
|
1067
|
+
'es-x/no-iterator-prototype-foreach': 0,
|
|
1068
|
+
'es-x/no-iterator-prototype-map': 0,
|
|
1069
|
+
'es-x/no-iterator-prototype-reduce': 0,
|
|
1070
|
+
'es-x/no-iterator-prototype-some': 0,
|
|
1071
|
+
'es-x/no-regexp-lookbehind-assertions': 2,
|
|
1072
|
+
'es-x/no-regexp-unicode-property-escapes-2020': 2,
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* 添加ESLint配置项
|
|
1077
|
+
* @param {...import('eslint').Linter.Config} args ESLint配置项
|
|
1078
|
+
* @throws `TypeError` 不支持传入配置数组
|
|
1079
|
+
* @throws `RangeError` 未知的配置项类型
|
|
1080
|
+
*/
|
|
1081
|
+
export const extend = (...args) => {
|
|
1082
|
+
if (args.some(arg => Array.isArray(arg))) {
|
|
1083
|
+
throw new TypeError('只支持传入单个配置对象,禁止传入配置数组!');
|
|
1084
|
+
}
|
|
1085
|
+
const moreIgnores = args.filter(({files: f, ignores: i}) => !f && i),
|
|
1086
|
+
moreGeneral = args.filter(({files: f, rules, plugins}) => !f && (rules || plugins)),
|
|
1087
|
+
moreFiles = args.filter(({files: f}) => f);
|
|
1088
|
+
if (moreIgnores.length + moreGeneral.length + moreFiles.length !== args.length) {
|
|
1089
|
+
throw new RangeError('传入的配置项只能是忽略项、通用规则项或文件规则项三种之一!');
|
|
1090
|
+
}
|
|
1091
|
+
return [
|
|
1092
|
+
ignores,
|
|
1093
|
+
...moreIgnores,
|
|
1094
|
+
...general,
|
|
1095
|
+
...moreGeneral,
|
|
1096
|
+
...json,
|
|
1097
|
+
...ts,
|
|
1098
|
+
...moreFiles,
|
|
1099
|
+
];
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
export default extend(jsDoc);
|
package/eslintrc.cjs
CHANGED
|
@@ -689,6 +689,7 @@ module.exports = {
|
|
|
689
689
|
parser: 'eslint-plugin-json-es',
|
|
690
690
|
extends: ['plugin:eslint-plugin-json-es/recommended'],
|
|
691
691
|
rules: {
|
|
692
|
+
strict: 0,
|
|
692
693
|
'@stylistic/array-bracket-newline': [
|
|
693
694
|
2,
|
|
694
695
|
{
|
|
@@ -721,7 +722,6 @@ module.exports = {
|
|
|
721
722
|
],
|
|
722
723
|
'@stylistic/quote-props': 0,
|
|
723
724
|
'@stylistic/quotes': 0,
|
|
724
|
-
strict: 0,
|
|
725
725
|
'unicorn/prefer-string-raw': 0,
|
|
726
726
|
'unicorn/numeric-separators-style': 0,
|
|
727
727
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/code-standard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"homepage": "https://github.com/bhsd-harry/code-standard#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/bhsd-harry/code-standard/issues"
|
|
@@ -8,24 +8,32 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"author": "Bhsd",
|
|
10
10
|
"files": [
|
|
11
|
-
"*.
|
|
12
|
-
"
|
|
11
|
+
"*.[cm]js",
|
|
12
|
+
"!eslint.config.mjs"
|
|
13
13
|
],
|
|
14
|
+
"main": "eslint.mjs",
|
|
14
15
|
"scripts": {
|
|
15
16
|
"lint:ts": "eslint --cache .",
|
|
16
17
|
"lint": "npm run lint:ts"
|
|
17
18
|
},
|
|
18
|
-
"
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"eslint": "^8.
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@eslint/js": "^8.57.1",
|
|
21
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
23
|
+
"eslint-plugin-es-x": "^9.1.2",
|
|
22
24
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
23
|
-
"eslint-plugin-jsdoc": "^
|
|
24
|
-
"eslint-plugin-
|
|
25
|
-
"eslint-plugin-n": "^17.
|
|
25
|
+
"eslint-plugin-jsdoc": "^61.1.11",
|
|
26
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
27
|
+
"eslint-plugin-n": "^17.23.1",
|
|
26
28
|
"eslint-plugin-promise": "^7.2.1",
|
|
27
|
-
"eslint-plugin-regexp": "^2.
|
|
28
|
-
"eslint-plugin-unicorn": "^
|
|
29
|
-
"
|
|
29
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
30
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
31
|
+
"globals": "^16.5.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^24.9.2",
|
|
35
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
36
|
+
"eslint": "^9.38.0",
|
|
37
|
+
"stylelint-plugin-use-baseline": "^1.0.3"
|
|
30
38
|
}
|
|
31
39
|
}
|