@bhsd/common 0.0.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.
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const config = require('@bhsd/common/eslintrc.cjs');
4
+
5
+ module.exports = {
6
+ ...config,
7
+ env: {
8
+ ...config.env,
9
+ browser: true,
10
+ },
11
+ plugins: [
12
+ ...config.plugins,
13
+ 'es-x',
14
+ ],
15
+ rules: {
16
+ ...config.rules,
17
+ 'prefer-object-has-own': 0,
18
+ 'es-x/no-array-prototype-at': 2,
19
+ 'es-x/no-global-this': 2,
20
+ 'es-x/no-object-fromentries': 2,
21
+ 'es-x/no-object-hasown': 2,
22
+ 'es-x/no-regexp-lookbehind-assertions': 2,
23
+ 'es-x/no-string-prototype-at': 2,
24
+ 'es-x/no-string-prototype-matchall': 2,
25
+ 'es-x/no-string-prototype-replaceall': 2,
26
+ },
27
+ settings: {
28
+ ...config.settings,
29
+ 'es-x': {
30
+ aggressive: true,
31
+ },
32
+ },
33
+ };
package/eslintrc.cjs ADDED
@@ -0,0 +1,941 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ root: true,
5
+ env: {
6
+ es2022: true,
7
+ },
8
+ plugins: [
9
+ '@stylistic',
10
+ 'promise',
11
+ 'regexp',
12
+ 'unicorn',
13
+ 'jsdoc',
14
+ ],
15
+ extends: [
16
+ 'eslint:recommended',
17
+ 'plugin:promise/recommended',
18
+ 'plugin:regexp/recommended',
19
+ 'plugin:eslint-comments/recommended',
20
+ ],
21
+ parserOptions: {
22
+ ecmaVersion: 13,
23
+ },
24
+ ignorePatterns: [
25
+ 'dist/',
26
+ ],
27
+ rules: {
28
+ 'array-callback-return': 2,
29
+ 'no-cond-assign': [
30
+ 2,
31
+ 'always',
32
+ ],
33
+ 'no-constant-binary-expression': 2,
34
+ 'no-constructor-return': 2,
35
+ 'no-fallthrough': 2,
36
+ 'no-inner-declarations': [
37
+ 2,
38
+ 'both',
39
+ ],
40
+ 'no-irregular-whitespace': [
41
+ 2,
42
+ {
43
+ skipStrings: false,
44
+ },
45
+ ],
46
+ 'no-promise-executor-return': 2,
47
+ 'no-self-compare': 2,
48
+ 'no-template-curly-in-string': 2,
49
+ 'no-undef': [
50
+ 2,
51
+ {
52
+ typeof: true,
53
+ },
54
+ ],
55
+ 'no-unmodified-loop-condition': 2,
56
+ 'no-unreachable-loop': 2,
57
+ 'no-unsafe-negation': [
58
+ 2,
59
+ {
60
+ enforceForOrderingRelations: true,
61
+ },
62
+ ],
63
+ 'no-unsafe-optional-chaining': [
64
+ 2,
65
+ {
66
+ disallowArithmeticOperators: true,
67
+ },
68
+ ],
69
+ 'no-unused-private-class-members': 2,
70
+ 'no-unused-vars': [
71
+ 2,
72
+ {
73
+ args: 'all',
74
+ argsIgnorePattern: '^_+$',
75
+ caughtErrors: 'all',
76
+ ignoreRestSiblings: true,
77
+ },
78
+ ],
79
+ 'no-use-before-define': [
80
+ 2,
81
+ {
82
+ functions: false,
83
+ variables: false,
84
+ },
85
+ ],
86
+ 'require-atomic-updates': [
87
+ 2,
88
+ {
89
+ allowProperties: true,
90
+ },
91
+ ],
92
+ 'use-isnan': [
93
+ 2,
94
+ {
95
+ enforceForIndexOf: true,
96
+ },
97
+ ],
98
+ 'valid-typeof': [
99
+ 2,
100
+ {
101
+ requireStringLiterals: true,
102
+ },
103
+ ],
104
+ 'accessor-pairs': 2,
105
+ 'arrow-body-style': 2,
106
+ 'block-scoped-var': 2,
107
+ camelcase: 2,
108
+ 'class-methods-use-this': 2,
109
+ 'consistent-return': 2,
110
+ curly: 2,
111
+ 'default-case': 2,
112
+ 'default-case-last': 2,
113
+ 'default-param-last': 2,
114
+ 'dot-notation': 2,
115
+ eqeqeq: 2,
116
+ 'func-name-matching': [
117
+ 2,
118
+ {
119
+ considerPropertyDescriptor: true,
120
+ },
121
+ ],
122
+ 'func-names': [
123
+ 2,
124
+ 'never',
125
+ ],
126
+ 'func-style': 2,
127
+ 'grouped-accessor-pairs': [
128
+ 2,
129
+ 'getBeforeSet',
130
+ ],
131
+ 'guard-for-in': 2,
132
+ 'logical-assignment-operators': [
133
+ 2,
134
+ 'always',
135
+ {
136
+ enforceForIfStatements: true,
137
+ },
138
+ ],
139
+ 'new-cap': 2,
140
+ 'no-alert': 2,
141
+ 'no-array-constructor': 2,
142
+ 'no-bitwise': 2,
143
+ 'no-caller': 2,
144
+ 'no-else-return': 2,
145
+ 'no-empty': [
146
+ 2,
147
+ {
148
+ allowEmptyCatch: true,
149
+ },
150
+ ],
151
+ 'no-empty-function': [
152
+ 2,
153
+ {
154
+ allow: [
155
+ 'arrowFunctions',
156
+ ],
157
+ },
158
+ ],
159
+ 'no-empty-static-block': 2,
160
+ 'no-eval': 2,
161
+ 'no-extend-native': 2,
162
+ 'no-extra-bind': 2,
163
+ 'no-extra-boolean-cast': [
164
+ 2,
165
+ {
166
+ enforceForLogicalOperands: true,
167
+ },
168
+ ],
169
+ 'no-implicit-coercion': 2,
170
+ 'no-implicit-globals': 2,
171
+ 'no-implied-eval': 2,
172
+ 'no-invalid-this': [
173
+ 2,
174
+ {
175
+ capIsConstructor: false,
176
+ },
177
+ ],
178
+ 'no-lone-blocks': 2,
179
+ 'no-lonely-if': 2,
180
+ 'no-loop-func': 2,
181
+ 'no-multi-assign': 2,
182
+ 'no-multi-str': 2,
183
+ 'no-nested-ternary': 2,
184
+ 'no-new': 2,
185
+ 'no-new-func': 2,
186
+ 'no-new-object': 2,
187
+ 'no-new-wrappers': 2,
188
+ 'no-octal-escape': 2,
189
+ 'no-param-reassign': 2,
190
+ 'no-return-assign': [
191
+ 2,
192
+ 'always',
193
+ ],
194
+ 'no-return-await': 2,
195
+ 'no-script-url': 2,
196
+ 'no-sequences': [
197
+ 2,
198
+ {
199
+ allowInParentheses: false,
200
+ },
201
+ ],
202
+ 'no-shadow': [
203
+ 2,
204
+ {
205
+ builtinGlobals: true,
206
+ },
207
+ ],
208
+ 'no-throw-literal': 2,
209
+ 'no-undef-init': 2,
210
+ 'no-underscore-dangle': [
211
+ 2,
212
+ {
213
+ allow: [
214
+ '_',
215
+ '__',
216
+ ],
217
+ enforceInMethodNames: true,
218
+ enforceInClassFields: true,
219
+ allowInArrayDestructuring: false,
220
+ allowInObjectDestructuring: false,
221
+ allowFunctionParams: false,
222
+ },
223
+ ],
224
+ 'no-unneeded-ternary': [
225
+ 2,
226
+ {
227
+ defaultAssignment: false,
228
+ },
229
+ ],
230
+ 'no-unused-expressions': 2,
231
+ 'no-useless-call': 2,
232
+ 'no-useless-computed-key': [
233
+ 2,
234
+ {
235
+ enforceForClassMembers: true,
236
+ },
237
+ ],
238
+ 'no-useless-concat': 2,
239
+ 'no-useless-constructor': 2,
240
+ 'no-useless-return': 2,
241
+ 'no-var': 2,
242
+ 'no-void': [
243
+ 2,
244
+ {
245
+ allowAsStatement: true,
246
+ },
247
+ ],
248
+ 'object-shorthand': 2,
249
+ 'operator-assignment': 2,
250
+ 'prefer-arrow-callback': 2,
251
+ 'prefer-const': 2,
252
+ 'prefer-destructuring': [
253
+ 2,
254
+ {
255
+ VariableDeclarator: {
256
+ array: true,
257
+ object: true,
258
+ },
259
+ AssignmentExpression: {
260
+ array: true,
261
+ object: true,
262
+ },
263
+ },
264
+ ],
265
+ 'prefer-exponentiation-operator': 2,
266
+ 'prefer-numeric-literals': 2,
267
+ 'prefer-object-has-own': 2,
268
+ 'prefer-object-spread': 2,
269
+ 'prefer-regex-literals': [
270
+ 2,
271
+ {
272
+ disallowRedundantWrapping: true,
273
+ },
274
+ ],
275
+ 'prefer-rest-params': 2,
276
+ 'prefer-spread': 2,
277
+ 'prefer-template': 2,
278
+ radix: [
279
+ 2,
280
+ 'as-needed',
281
+ ],
282
+ 'require-await': 2,
283
+ 'require-unicode-regexp': 2,
284
+ strict: 2,
285
+ 'symbol-description': 2,
286
+ 'vars-on-top': 2,
287
+ yoda: 2,
288
+ '@stylistic/array-bracket-newline': [
289
+ 2,
290
+ {
291
+ multiline: true,
292
+ },
293
+ ],
294
+ '@stylistic/array-bracket-spacing': 2,
295
+ '@stylistic/array-element-newline': [
296
+ 2,
297
+ 'consistent',
298
+ ],
299
+ '@stylistic/arrow-parens': [
300
+ 2,
301
+ 'as-needed',
302
+ ],
303
+ '@stylistic/arrow-spacing': 2,
304
+ '@stylistic/block-spacing': [
305
+ 2,
306
+ 'never',
307
+ ],
308
+ '@stylistic/brace-style': 2,
309
+ '@stylistic/comma-dangle': [
310
+ 2,
311
+ 'always-multiline',
312
+ ],
313
+ '@stylistic/comma-spacing': 2,
314
+ '@stylistic/comma-style': 2,
315
+ '@stylistic/computed-property-spacing': 2,
316
+ '@stylistic/dot-location': [
317
+ 2,
318
+ 'property',
319
+ ],
320
+ '@stylistic/eol-last': 2,
321
+ '@stylistic/function-call-argument-newline': [
322
+ 2,
323
+ 'consistent',
324
+ ],
325
+ '@stylistic/function-call-spacing': 2,
326
+ '@stylistic/function-paren-newline': [
327
+ 2,
328
+ 'multiline-arguments',
329
+ ],
330
+ '@stylistic/indent': [
331
+ 2,
332
+ 'tab',
333
+ {
334
+ SwitchCase: 1,
335
+ },
336
+ ],
337
+ '@stylistic/indent-binary-ops': [
338
+ 2,
339
+ 'tab',
340
+ ],
341
+ '@stylistic/key-spacing': 2,
342
+ '@stylistic/keyword-spacing': 2,
343
+ '@stylistic/linebreak-style': 2,
344
+ '@stylistic/lines-around-comment': [
345
+ 2,
346
+ {
347
+ allowBlockStart: true,
348
+ ignorePattern: '^\\* @',
349
+ },
350
+ ],
351
+ '@stylistic/lines-between-class-members': [
352
+ 2,
353
+ 'always',
354
+ {
355
+ exceptAfterSingleLine: true,
356
+ },
357
+ ],
358
+ '@stylistic/max-len': [
359
+ 2,
360
+ {
361
+ code: 120,
362
+ },
363
+ ],
364
+ '@stylistic/multiline-comment-style': [
365
+ 2,
366
+ 'separate-lines',
367
+ ],
368
+ '@stylistic/multiline-ternary': [
369
+ 2,
370
+ 'always-multiline',
371
+ ],
372
+ '@stylistic/new-parens': 2,
373
+ '@stylistic/newline-per-chained-call': [
374
+ 2,
375
+ {
376
+ ignoreChainWithDepth: 4,
377
+ },
378
+ ],
379
+ '@stylistic/no-extra-parens': [
380
+ 2,
381
+ 'all',
382
+ {
383
+ allowParensAfterCommentPattern: '@type',
384
+ },
385
+ ],
386
+ '@stylistic/no-extra-semi': 2,
387
+ '@stylistic/no-floating-decimal': 2,
388
+ '@stylistic/no-mixed-spaces-and-tabs': 2,
389
+ '@stylistic/no-multi-spaces': [
390
+ 2,
391
+ {
392
+ exceptions: {},
393
+ },
394
+ ],
395
+ '@stylistic/no-multiple-empty-lines': [
396
+ 2,
397
+ {
398
+ max: 1,
399
+ maxBOF: 0,
400
+ },
401
+ ],
402
+ '@stylistic/no-tabs': [
403
+ 2,
404
+ {
405
+ allowIndentationTabs: true,
406
+ },
407
+ ],
408
+ '@stylistic/no-trailing-spaces': 2,
409
+ '@stylistic/no-whitespace-before-property': 2,
410
+ '@stylistic/object-curly-newline': [
411
+ 2,
412
+ {
413
+ multiline: true,
414
+ consistent: true,
415
+ },
416
+ ],
417
+ '@stylistic/object-curly-spacing': 2,
418
+ '@stylistic/object-property-newline': [
419
+ 2,
420
+ {
421
+ allowAllPropertiesOnSameLine: true,
422
+ },
423
+ ],
424
+ '@stylistic/one-var-declaration-per-line': 2,
425
+ '@stylistic/operator-linebreak': [
426
+ 2,
427
+ 'before',
428
+ {
429
+ overrides: {
430
+ '=': 'after',
431
+ },
432
+ },
433
+ ],
434
+ '@stylistic/padded-blocks': [
435
+ 2,
436
+ 'never',
437
+ ],
438
+ '@stylistic/quote-props': [
439
+ 2,
440
+ 'as-needed',
441
+ ],
442
+ '@stylistic/quotes': [
443
+ 2,
444
+ 'single',
445
+ {
446
+ allowTemplateLiterals: true,
447
+ avoidEscape: true,
448
+ },
449
+ ],
450
+ '@stylistic/rest-spread-spacing': 2,
451
+ '@stylistic/semi': 2,
452
+ '@stylistic/semi-spacing': 2,
453
+ '@stylistic/semi-style': 2,
454
+ '@stylistic/space-before-blocks': 2,
455
+ '@stylistic/space-before-function-paren': [
456
+ 2,
457
+ {
458
+ anonymous: 'never',
459
+ named: 'never',
460
+ asyncArrow: 'always',
461
+ },
462
+ ],
463
+ '@stylistic/space-in-parens': 2,
464
+ '@stylistic/space-infix-ops': 2,
465
+ '@stylistic/space-unary-ops': 2,
466
+ '@stylistic/spaced-comment': 2,
467
+ '@stylistic/switch-colon-spacing': 2,
468
+ '@stylistic/template-curly-spacing': 2,
469
+ '@stylistic/wrap-iife': [
470
+ 2,
471
+ 'inside',
472
+ ],
473
+ 'promise/always-return': [
474
+ 2,
475
+ {
476
+ ignoreLastCallback: true,
477
+ },
478
+ ],
479
+ 'promise/catch-or-return': [
480
+ 2,
481
+ {
482
+ allowThen: true,
483
+ },
484
+ ],
485
+ 'promise/no-multiple-resolved': 2,
486
+ 'promise/prefer-await-to-then': 2,
487
+ 'regexp/no-contradiction-with-assertion': 2,
488
+ 'regexp/no-dupe-disjunctions': [
489
+ 2,
490
+ {
491
+ report: 'interesting',
492
+ },
493
+ ],
494
+ 'regexp/no-empty-character-class': 2,
495
+ 'regexp/no-misleading-capturing-group': [
496
+ 2,
497
+ {
498
+ reportBacktrackingEnds: false,
499
+ },
500
+ ],
501
+ 'regexp/no-misleading-unicode-character': 2,
502
+ 'regexp/no-missing-g-flag': 2,
503
+ 'regexp/no-super-linear-backtracking': 2,
504
+ 'regexp/no-super-linear-move': 2,
505
+ 'regexp/no-extra-lookaround-assertions': 2,
506
+ 'regexp/no-octal': 2,
507
+ 'regexp/no-standalone-backslash': 2,
508
+ 'regexp/no-useless-character-class': [
509
+ 2,
510
+ {
511
+ ignores: [],
512
+ },
513
+ ],
514
+ 'regexp/prefer-escape-replacement-dollar-char': 2,
515
+ 'regexp/prefer-quantifier': 2,
516
+ 'regexp/prefer-regexp-exec': 2,
517
+ 'regexp/prefer-regexp-test': 2,
518
+ 'regexp/use-ignore-case': 2,
519
+ 'regexp/hexadecimal-escape': 2,
520
+ 'regexp/letter-case': [
521
+ 2,
522
+ {
523
+ unicodeEscape: 'uppercase',
524
+ hexadecimalEscape: 'uppercase',
525
+ controlEscape: 'uppercase',
526
+ },
527
+ ],
528
+ 'regexp/prefer-character-class': [
529
+ 2,
530
+ {
531
+ minAlternatives: 2,
532
+ },
533
+ ],
534
+ 'regexp/prefer-lookaround': [
535
+ 2,
536
+ {
537
+ lookbehind: false,
538
+ },
539
+ ],
540
+ 'regexp/unicode-property': 2,
541
+ 'unicorn/catch-error-name': [
542
+ 2,
543
+ {
544
+ name: 'e',
545
+ },
546
+ ],
547
+ 'unicorn/consistent-function-scoping': [
548
+ 2,
549
+ {
550
+ checkArrowFunctions: false,
551
+ },
552
+ ],
553
+ 'unicorn/empty-brace-spaces': 2,
554
+ 'unicorn/error-message': 2,
555
+ 'unicorn/explicit-length-check': 2,
556
+ 'unicorn/new-for-builtins': 2,
557
+ 'unicorn/no-abusive-eslint-disable': 2,
558
+ 'unicorn/no-array-for-each': 2,
559
+ 'unicorn/no-array-method-this-argument': 2,
560
+ 'unicorn/no-array-push-push': 2,
561
+ 'unicorn/no-array-reduce': 2,
562
+ 'unicorn/no-await-in-promise-methods': 2,
563
+ 'unicorn/no-instanceof-array': 2,
564
+ 'unicorn/no-invalid-remove-event-listener': 2,
565
+ 'unicorn/no-lonely-if': 2,
566
+ 'unicorn/no-negated-condition': 2,
567
+ 'unicorn/no-negation-in-equality-check': 2,
568
+ 'unicorn/no-object-as-default-parameter': 2,
569
+ 'unicorn/no-single-promise-in-promise-methods': 2,
570
+ 'unicorn/no-static-only-class': 2,
571
+ 'unicorn/no-this-assignment': 2,
572
+ 'unicorn/no-typeof-undefined': [
573
+ 2,
574
+ {
575
+ checkGlobalVariables: true,
576
+ },
577
+ ],
578
+ 'unicorn/no-unreadable-iife': 2,
579
+ 'unicorn/no-unused-properties': 2,
580
+ 'unicorn/no-useless-fallback-in-spread': 2,
581
+ 'unicorn/no-useless-length-check': 2,
582
+ 'unicorn/no-useless-spread': 2,
583
+ 'unicorn/no-useless-switch-case': 2,
584
+ 'unicorn/number-literal-case': 2,
585
+ 'unicorn/numeric-separators-style': 2,
586
+ 'unicorn/prefer-array-find': 2,
587
+ 'unicorn/prefer-array-flat': 2,
588
+ 'unicorn/prefer-array-flat-map': 2,
589
+ 'unicorn/prefer-array-index-of': 2,
590
+ 'unicorn/prefer-array-some': 2,
591
+ 'unicorn/prefer-code-point': 2,
592
+ 'unicorn/prefer-default-parameters': 2,
593
+ 'unicorn/prefer-includes': 2,
594
+ 'unicorn/prefer-keyboard-event-key': 2,
595
+ 'unicorn/prefer-logical-operator-over-ternary': 2,
596
+ 'unicorn/prefer-native-coercion-functions': 2,
597
+ 'unicorn/prefer-negative-index': 2,
598
+ 'unicorn/prefer-optional-catch-binding': 2,
599
+ 'unicorn/prefer-prototype-methods': 2,
600
+ 'unicorn/prefer-spread': 2,
601
+ 'unicorn/prefer-string-raw': 2,
602
+ 'unicorn/prefer-string-starts-ends-with': 2,
603
+ 'unicorn/prefer-switch': 2,
604
+ 'unicorn/prefer-ternary': 2,
605
+ 'unicorn/switch-case-braces': [
606
+ 2,
607
+ 'avoid',
608
+ ],
609
+ 'unicorn/text-encoding-identifier-case': 2,
610
+ 'unicorn/throw-new-error': 2,
611
+ 'jsdoc/check-alignment': 1,
612
+ 'jsdoc/check-indentation': [
613
+ 1,
614
+ {
615
+ excludeTags: [
616
+ 'description',
617
+ ],
618
+ },
619
+ ],
620
+ 'jsdoc/check-tag-names': 1,
621
+ 'jsdoc/check-types': 1,
622
+ 'jsdoc/multiline-blocks': 1,
623
+ 'jsdoc/no-bad-blocks': [
624
+ 1,
625
+ {
626
+ preventAllMultiAsteriskBlocks: true,
627
+ },
628
+ ],
629
+ 'jsdoc/no-multi-asterisks': 1,
630
+ 'jsdoc/require-asterisk-prefix': 1,
631
+ 'jsdoc/require-description': [
632
+ 1,
633
+ {
634
+ exemptedBy: [
635
+ 'license',
636
+ 'type',
637
+ ],
638
+ checkConstructors: false,
639
+ checkSetters: false,
640
+ },
641
+ ],
642
+ 'jsdoc/require-hyphen-before-param-description': [
643
+ 1,
644
+ 'never',
645
+ ],
646
+ 'jsdoc/require-jsdoc': [
647
+ 1,
648
+ {
649
+ contexts: [
650
+ 'FunctionDeclaration:not(TSDeclareFunction + FunctionDeclaration)',
651
+ 'TSDeclareFunction:not(TSDeclareFunction + TSDeclareFunction)',
652
+ "MethodDefinition:not(MethodDefinition:has(TSEmptyBodyFunctionExpression) + MethodDefinition, [kind='get'] + [kind='set'], [override=true])",
653
+ ],
654
+ exemptEmptyConstructors: true,
655
+ checkGetters: true,
656
+ checkSetters: 'no-getter',
657
+ },
658
+ ],
659
+ 'jsdoc/require-param-description': 1,
660
+ 'jsdoc/require-param-name': 1,
661
+ 'jsdoc/require-param': [
662
+ 1,
663
+ {
664
+ checkConstructors: false,
665
+ },
666
+ ],
667
+ 'jsdoc/require-throws': 1,
668
+ 'eslint-comments/disable-enable-pair': [
669
+ 2,
670
+ {
671
+ allowWholeFile: true,
672
+ },
673
+ ],
674
+ },
675
+ overrides: [
676
+ {
677
+ files: '**/*.json',
678
+ parser: 'eslint-plugin-json-es',
679
+ extends: [
680
+ 'plugin:eslint-plugin-json-es/recommended',
681
+ ],
682
+ rules: {
683
+ '@stylistic/array-bracket-newline': [
684
+ 2,
685
+ {
686
+ minItems: 1,
687
+ },
688
+ ],
689
+ '@stylistic/array-element-newline': [
690
+ 2,
691
+ 'always',
692
+ ],
693
+ '@stylistic/comma-dangle': 0,
694
+ '@stylistic/max-len': 0,
695
+ '@stylistic/no-multiple-empty-lines': [
696
+ 2,
697
+ {
698
+ max: 0,
699
+ },
700
+ ],
701
+ '@stylistic/object-curly-newline': [
702
+ 2,
703
+ {
704
+ minProperties: 1,
705
+ },
706
+ ],
707
+ '@stylistic/object-property-newline': [
708
+ 2,
709
+ {
710
+ allowAllPropertiesOnSameLine: false,
711
+ },
712
+ ],
713
+ '@stylistic/quote-props': 0,
714
+ '@stylistic/quotes': 0,
715
+ strict: 0,
716
+ 'unicorn/prefer-string-raw': 0,
717
+ },
718
+ },
719
+ {
720
+ files: '**/*.ts',
721
+ parser: '@typescript-eslint/parser',
722
+ parserOptions: {
723
+ ecmaVersion: 'latest',
724
+ project: './tsconfig.json',
725
+ },
726
+ plugins: [
727
+ '@typescript-eslint',
728
+ ],
729
+ extends: [
730
+ 'plugin:@typescript-eslint/recommended',
731
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
732
+ ],
733
+ rules: {
734
+ 'class-methods-use-this': 0,
735
+ '@typescript-eslint/class-methods-use-this': [
736
+ 2,
737
+ {
738
+ ignoreOverrideMethods: true,
739
+ },
740
+ ],
741
+ 'default-param-last': 0,
742
+ '@typescript-eslint/default-param-last': 2,
743
+ 'dot-notation': 0,
744
+ '@typescript-eslint/dot-notation': [
745
+ 2,
746
+ {
747
+ allowIndexSignaturePropertyAccess: true,
748
+ },
749
+ ],
750
+ 'no-dupe-class-members': 0,
751
+ '@typescript-eslint/no-dupe-class-members': 2,
752
+ 'no-empty-function': 0,
753
+ '@typescript-eslint/no-empty-function': [
754
+ 2,
755
+ {
756
+ allow: [
757
+ 'arrowFunctions',
758
+ ],
759
+ },
760
+ ],
761
+ 'no-invalid-this': 0,
762
+ '@typescript-eslint/no-invalid-this': [
763
+ 2,
764
+ {
765
+ capIsConstructor: false,
766
+ },
767
+ ],
768
+ 'no-loop-func': 0,
769
+ '@typescript-eslint/no-loop-func': 2,
770
+ 'no-redeclare': 0,
771
+ '@typescript-eslint/no-redeclare': 2,
772
+ 'no-shadow': 0,
773
+ '@typescript-eslint/no-shadow': [
774
+ 2,
775
+ {
776
+ builtinGlobals: true,
777
+ },
778
+ ],
779
+ 'no-throw-literal': 0,
780
+ '@typescript-eslint/no-throw-literal': 2,
781
+ 'no-unused-expressions': 0,
782
+ '@typescript-eslint/no-unused-expressions': 2,
783
+ 'no-unused-vars': 0,
784
+ '@typescript-eslint/no-unused-vars': [
785
+ 2,
786
+ {
787
+ args: 'all',
788
+ argsIgnorePattern: '^_+$',
789
+ caughtErrors: 'all',
790
+ ignoreRestSiblings: true,
791
+ },
792
+ ],
793
+ 'no-use-before-define': 0,
794
+ '@typescript-eslint/no-use-before-define': [
795
+ 2,
796
+ {
797
+ functions: false,
798
+ variables: false,
799
+ },
800
+ ],
801
+ 'no-useless-constructor': 0,
802
+ '@typescript-eslint/no-useless-constructor': 2,
803
+ 'prefer-destructuring': 0,
804
+ '@typescript-eslint/prefer-destructuring': [
805
+ 2,
806
+ {
807
+ VariableDeclarator: {
808
+ array: true,
809
+ object: true,
810
+ },
811
+ AssignmentExpression: {
812
+ array: true,
813
+ object: true,
814
+ },
815
+ },
816
+ ],
817
+ 'require-await': 0,
818
+ '@typescript-eslint/require-await': 2,
819
+ 'unicorn/prefer-string-starts-ends-with': 0,
820
+ '@typescript-eslint/prefer-string-starts-ends-with': 2,
821
+ '@typescript-eslint/ban-types': [
822
+ 2,
823
+ {
824
+ types: {
825
+ Function: false,
826
+ },
827
+ },
828
+ ],
829
+ '@typescript-eslint/consistent-generic-constructors': 2,
830
+ '@typescript-eslint/consistent-indexed-object-style': 2,
831
+ '@typescript-eslint/consistent-type-assertions': 2,
832
+ '@typescript-eslint/consistent-type-definitions': 2,
833
+ '@typescript-eslint/consistent-type-exports': 2,
834
+ '@typescript-eslint/consistent-type-imports': [
835
+ 2,
836
+ {
837
+ disallowTypeAnnotations: false,
838
+ },
839
+ ],
840
+ '@typescript-eslint/explicit-function-return-type': [
841
+ 2,
842
+ {
843
+ allowIIFEs: true,
844
+ },
845
+ ],
846
+ '@typescript-eslint/member-delimiter-style': [
847
+ 2,
848
+ {
849
+ singleline: {
850
+ delimiter: 'comma',
851
+ },
852
+ },
853
+ ],
854
+ '@typescript-eslint/method-signature-style': [
855
+ 2,
856
+ 'method',
857
+ ],
858
+ '@typescript-eslint/no-confusing-non-null-assertion': 2,
859
+ '@typescript-eslint/no-confusing-void-expression': 2,
860
+ '@typescript-eslint/no-duplicate-type-constituents': 2,
861
+ '@typescript-eslint/no-explicit-any': [
862
+ 2,
863
+ {
864
+ ignoreRestArgs: true,
865
+ },
866
+ ],
867
+ '@typescript-eslint/no-floating-promises': [
868
+ 2,
869
+ {
870
+ ignoreIIFE: true,
871
+ },
872
+ ],
873
+ '@typescript-eslint/no-invalid-void-type': [
874
+ 2,
875
+ {
876
+ allowAsThisParameter: true,
877
+ },
878
+ ],
879
+ '@typescript-eslint/no-namespace': [
880
+ 2,
881
+ {
882
+ allowDeclarations: true,
883
+ },
884
+ ],
885
+ '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 2,
886
+ '@typescript-eslint/no-redundant-type-constituents': 2,
887
+ '@typescript-eslint/no-this-alias': [
888
+ 2,
889
+ {
890
+ allowedNames: [
891
+ 'self',
892
+ ],
893
+ },
894
+ ],
895
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 2,
896
+ '@typescript-eslint/no-unnecessary-condition': [
897
+ 2,
898
+ {
899
+ allowConstantLoopConditions: true,
900
+ },
901
+ ],
902
+ '@typescript-eslint/no-unnecessary-qualifier': 2,
903
+ '@typescript-eslint/no-unsafe-assignment': 0,
904
+ '@typescript-eslint/no-unsafe-call': 0,
905
+ '@typescript-eslint/no-unsafe-return': 0,
906
+ '@typescript-eslint/no-useless-empty-export': 2,
907
+ '@typescript-eslint/no-var-requires': 0,
908
+ '@typescript-eslint/non-nullable-type-assertion-style': 2,
909
+ '@typescript-eslint/prefer-for-of': 2,
910
+ '@typescript-eslint/prefer-reduce-type-parameter': 2,
911
+ '@typescript-eslint/prefer-return-this-type': 2,
912
+ '@typescript-eslint/switch-exhaustiveness-check': 2,
913
+ '@typescript-eslint/type-annotation-spacing': [
914
+ 2,
915
+ {
916
+ before: false,
917
+ after: true,
918
+ overrides: {
919
+ arrow: {
920
+ before: true,
921
+ },
922
+ },
923
+ },
924
+ ],
925
+ '@typescript-eslint/unified-signatures': 2,
926
+ 'func-style': 0,
927
+ '@stylistic/type-generic-spacing': 2,
928
+ '@stylistic/type-named-tuple-spacing': 2,
929
+ 'jsdoc/check-types': 0,
930
+ },
931
+ },
932
+ ],
933
+ settings: {
934
+ jsdoc: {
935
+ tagNamePreference: {
936
+ augments: 'extends',
937
+ },
938
+ ignorePrivate: true,
939
+ },
940
+ },
941
+ };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const config = require('./eslintrc.cjs');
4
+
5
+ module.exports = {
6
+ ...config,
7
+ env: {
8
+ ...config.env,
9
+ node: true,
10
+ },
11
+ extends: [
12
+ ...config.extends,
13
+ 'plugin:n/recommended-script',
14
+ ],
15
+ rules: {
16
+ ...config.rules,
17
+ 'n/exports-style': [
18
+ 2,
19
+ 'module.exports',
20
+ ],
21
+ 'n/no-missing-import': 2,
22
+ 'n/no-missing-require': 2,
23
+ 'n/no-mixed-requires': 2,
24
+ 'n/no-new-require': 2,
25
+ 'n/no-path-concat': 2,
26
+ },
27
+ settings: {
28
+ ...config.settings,
29
+ n: {
30
+ tryExtensions: [
31
+ '.js',
32
+ '.json',
33
+ '.ts',
34
+ ],
35
+ },
36
+ },
37
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@bhsd/common",
3
+ "version": "0.0.0",
4
+ "license": "GPL-2.0",
5
+ "files": [
6
+ "*.cjs"
7
+ ],
8
+ "engines": {
9
+ "node": "^20.9.0"
10
+ },
11
+ "devDependencies": {
12
+ "@stylistic/eslint-plugin": "^2.3.0",
13
+ "@stylistic/stylelint-plugin": "^2.0.0",
14
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
15
+ "@typescript-eslint/parser": "^7.15.0",
16
+ "esbuild": "^0.21.4",
17
+ "eslint": "^8.56.0",
18
+ "eslint-plugin-es-x": "^8.0.0",
19
+ "eslint-plugin-eslint-comments": "^3.2.0",
20
+ "eslint-plugin-jsdoc": "^48.5.2",
21
+ "eslint-plugin-json-es": "^1.6.0",
22
+ "eslint-plugin-markdown": "^4.0.1",
23
+ "eslint-plugin-n": "^17.9.0",
24
+ "eslint-plugin-promise": "^6.2.0",
25
+ "eslint-plugin-regexp": "^2.6.0",
26
+ "eslint-plugin-unicorn": "^54.0.0",
27
+ "http-server": "^14.1.0",
28
+ "stylelint": "^16.6.1",
29
+ "stylelint-config-recommended": "^14.0.0",
30
+ "typescript": "^5.5.3"
31
+ }
32
+ }
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ extends: 'stylelint-config-recommended',
5
+ plugins: ['@stylistic/stylelint-plugin'],
6
+ rules: {
7
+ 'declaration-property-value-no-unknown': true,
8
+ 'no-unknown-animations': true,
9
+ 'no-unknown-custom-media': true,
10
+ 'at-rule-no-vendor-prefix': true,
11
+ 'color-hex-alpha': 'never',
12
+ 'color-named': 'never',
13
+ 'length-zero-no-unit': true,
14
+ 'media-feature-name-no-vendor-prefix': true,
15
+ 'selector-no-vendor-prefix': true,
16
+ 'value-no-vendor-prefix': true,
17
+ 'declaration-block-single-line-max-declarations': 1,
18
+ 'number-max-precision': 2,
19
+ 'alpha-value-notation': 'number',
20
+ 'color-function-notation': 'legacy',
21
+ 'color-hex-length': 'short',
22
+ 'font-weight-notation': 'named-where-possible',
23
+ 'hue-degree-notation': 'number',
24
+ 'keyframe-selector-notation': 'percentage-unless-within-keyword-only-block',
25
+ 'selector-not-notation': 'complex',
26
+ 'selector-pseudo-element-colon-notation': 'double',
27
+ 'font-family-name-quotes': 'always-where-recommended',
28
+ 'selector-attribute-quotes': 'always',
29
+ 'declaration-block-no-redundant-longhand-properties': true,
30
+ 'shorthand-property-no-redundant-values': true,
31
+ 'comment-whitespace-inside': 'always',
32
+ '@stylistic/color-hex-case': 'lower',
33
+ '@stylistic/function-comma-space-after': 'always',
34
+ '@stylistic/function-comma-space-before': 'never',
35
+ '@stylistic/function-parentheses-space-inside': 'never',
36
+ '@stylistic/function-whitespace-after': 'always',
37
+ '@stylistic/number-leading-zero': 'never',
38
+ '@stylistic/number-no-trailing-zeros': true,
39
+ '@stylistic/string-quotes': 'double',
40
+ '@stylistic/declaration-bang-space-after': 'never',
41
+ '@stylistic/declaration-bang-space-before': 'always',
42
+ '@stylistic/declaration-colon-space-after': 'always',
43
+ '@stylistic/declaration-colon-space-before': 'never',
44
+ '@stylistic/declaration-block-semicolon-newline-after': 'always',
45
+ '@stylistic/declaration-block-trailing-semicolon': 'always',
46
+ '@stylistic/block-closing-brace-newline-after': 'always',
47
+ '@stylistic/block-closing-brace-newline-before': 'always',
48
+ '@stylistic/block-opening-brace-newline-after': 'always',
49
+ '@stylistic/block-opening-brace-space-before': 'always',
50
+ '@stylistic/selector-attribute-brackets-space-inside': 'never',
51
+ '@stylistic/selector-attribute-operator-space-after': 'never',
52
+ '@stylistic/selector-attribute-operator-space-before': 'never',
53
+ '@stylistic/selector-combinator-space-after': 'always',
54
+ '@stylistic/selector-combinator-space-before': 'always',
55
+ '@stylistic/selector-max-empty-lines': 0,
56
+ '@stylistic/selector-pseudo-class-parentheses-space-inside': 'never',
57
+ '@stylistic/media-feature-colon-space-after': 'always',
58
+ '@stylistic/media-feature-colon-space-before': 'never',
59
+ '@stylistic/media-feature-parentheses-space-inside': 'never',
60
+ '@stylistic/at-rule-name-space-after': 'always',
61
+ '@stylistic/indentation': 'tab',
62
+ '@stylistic/linebreaks': 'unix',
63
+ '@stylistic/max-empty-lines': 1,
64
+ '@stylistic/no-empty-first-line': true,
65
+ '@stylistic/no-eol-whitespace': true,
66
+ '@stylistic/no-extra-semicolons': true,
67
+ '@stylistic/no-missing-end-of-source-newline': true,
68
+ },
69
+ reportInvalidScopeDisables: true,
70
+ reportNeedlessDisables: true,
71
+ };