@w5s/eslint-config 3.3.4 → 3.5.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/dist/index.js CHANGED
@@ -1,2001 +1,1205 @@
1
- import globals from 'globals';
2
- import { Project, interopDefault, ESLintConfig } from '@w5s/dev';
3
- import fs from 'fs';
4
- import nodePath from 'path';
5
- import process from 'process';
6
- import { findUp } from 'find-up';
7
- import parseGitignore from 'parse-gitignore';
8
- import prettierConfig from '@w5s/prettier-config';
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __commonJS = (cb, mod) => function __require() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
- // If the importer is in node compatibility mode or this is not an ESM
29
- // file that has been converted to a CommonJS file using a Babel-
30
- // compatible transform (i.e. "__esModule" has not been set), then set
31
- // "default" to the CommonJS "module.exports" for node compatibility.
32
- __defProp(target, "default", { value: mod, enumerable: true }) ,
33
- mod
34
- ));
35
-
36
- // ../../node_modules/@eslint/js/package.json
37
- var require_package = __commonJS({
38
- "../../node_modules/@eslint/js/package.json"(exports$1, module) {
39
- module.exports = {
40
- name: "@eslint/js",
41
- version: "9.39.2",
42
- description: "ESLint JavaScript language implementation",
43
- funding: "https://eslint.org/donate",
44
- main: "./src/index.js",
45
- types: "./types/index.d.ts",
46
- scripts: {
47
- "test:types": "tsc -p tests/types/tsconfig.json"
48
- },
49
- files: [
50
- "LICENSE",
51
- "README.md",
52
- "src",
53
- "types"
54
- ],
55
- publishConfig: {
56
- access: "public"
57
- },
58
- repository: {
59
- type: "git",
60
- url: "https://github.com/eslint/eslint.git",
61
- directory: "packages/js"
62
- },
63
- homepage: "https://eslint.org",
64
- bugs: "https://github.com/eslint/eslint/issues/",
65
- keywords: [
66
- "javascript",
67
- "eslint-plugin",
68
- "eslint"
69
- ],
70
- license: "MIT",
71
- engines: {
72
- node: "^18.18.0 || ^20.9.0 || >=21.1.0"
73
- }
74
- };
75
- }
76
- });
77
-
78
- // ../../node_modules/@eslint/js/src/configs/eslint-all.js
79
- var require_eslint_all = __commonJS({
80
- "../../node_modules/@eslint/js/src/configs/eslint-all.js"(exports$1, module) {
81
- module.exports = Object.freeze({
82
- rules: Object.freeze({
83
- "accessor-pairs": "error",
84
- "array-callback-return": "error",
85
- "arrow-body-style": "error",
86
- "block-scoped-var": "error",
87
- "camelcase": "error",
88
- "capitalized-comments": "error",
89
- "class-methods-use-this": "error",
90
- "complexity": "error",
91
- "consistent-return": "error",
92
- "consistent-this": "error",
93
- "constructor-super": "error",
94
- "curly": "error",
95
- "default-case": "error",
96
- "default-case-last": "error",
97
- "default-param-last": "error",
98
- "dot-notation": "error",
99
- "eqeqeq": "error",
100
- "for-direction": "error",
101
- "func-name-matching": "error",
102
- "func-names": "error",
103
- "func-style": "error",
104
- "getter-return": "error",
105
- "grouped-accessor-pairs": "error",
106
- "guard-for-in": "error",
107
- "id-denylist": "error",
108
- "id-length": "error",
109
- "id-match": "error",
110
- "init-declarations": "error",
111
- "logical-assignment-operators": "error",
112
- "max-classes-per-file": "error",
113
- "max-depth": "error",
114
- "max-lines": "error",
115
- "max-lines-per-function": "error",
116
- "max-nested-callbacks": "error",
117
- "max-params": "error",
118
- "max-statements": "error",
119
- "new-cap": "error",
120
- "no-alert": "error",
121
- "no-array-constructor": "error",
122
- "no-async-promise-executor": "error",
123
- "no-await-in-loop": "error",
124
- "no-bitwise": "error",
125
- "no-caller": "error",
126
- "no-case-declarations": "error",
127
- "no-class-assign": "error",
128
- "no-compare-neg-zero": "error",
129
- "no-cond-assign": "error",
130
- "no-console": "error",
131
- "no-const-assign": "error",
132
- "no-constant-binary-expression": "error",
133
- "no-constant-condition": "error",
134
- "no-constructor-return": "error",
135
- "no-continue": "error",
136
- "no-control-regex": "error",
137
- "no-debugger": "error",
138
- "no-delete-var": "error",
139
- "no-div-regex": "error",
140
- "no-dupe-args": "error",
141
- "no-dupe-class-members": "error",
142
- "no-dupe-else-if": "error",
143
- "no-dupe-keys": "error",
144
- "no-duplicate-case": "error",
145
- "no-duplicate-imports": "error",
146
- "no-else-return": "error",
147
- "no-empty": "error",
148
- "no-empty-character-class": "error",
149
- "no-empty-function": "error",
150
- "no-empty-pattern": "error",
151
- "no-empty-static-block": "error",
152
- "no-eq-null": "error",
153
- "no-eval": "error",
154
- "no-ex-assign": "error",
155
- "no-extend-native": "error",
156
- "no-extra-bind": "error",
157
- "no-extra-boolean-cast": "error",
158
- "no-extra-label": "error",
159
- "no-fallthrough": "error",
160
- "no-func-assign": "error",
161
- "no-global-assign": "error",
162
- "no-implicit-coercion": "error",
163
- "no-implicit-globals": "error",
164
- "no-implied-eval": "error",
165
- "no-import-assign": "error",
166
- "no-inline-comments": "error",
167
- "no-inner-declarations": "error",
168
- "no-invalid-regexp": "error",
169
- "no-invalid-this": "error",
170
- "no-irregular-whitespace": "error",
171
- "no-iterator": "error",
172
- "no-label-var": "error",
173
- "no-labels": "error",
174
- "no-lone-blocks": "error",
175
- "no-lonely-if": "error",
176
- "no-loop-func": "error",
177
- "no-loss-of-precision": "error",
178
- "no-magic-numbers": "error",
179
- "no-misleading-character-class": "error",
180
- "no-multi-assign": "error",
181
- "no-multi-str": "error",
182
- "no-negated-condition": "error",
183
- "no-nested-ternary": "error",
184
- "no-new": "error",
185
- "no-new-func": "error",
186
- "no-new-native-nonconstructor": "error",
187
- "no-new-wrappers": "error",
188
- "no-nonoctal-decimal-escape": "error",
189
- "no-obj-calls": "error",
190
- "no-object-constructor": "error",
191
- "no-octal": "error",
192
- "no-octal-escape": "error",
193
- "no-param-reassign": "error",
194
- "no-plusplus": "error",
195
- "no-promise-executor-return": "error",
196
- "no-proto": "error",
197
- "no-prototype-builtins": "error",
198
- "no-redeclare": "error",
199
- "no-regex-spaces": "error",
200
- "no-restricted-exports": "error",
201
- "no-restricted-globals": "error",
202
- "no-restricted-imports": "error",
203
- "no-restricted-properties": "error",
204
- "no-restricted-syntax": "error",
205
- "no-return-assign": "error",
206
- "no-script-url": "error",
207
- "no-self-assign": "error",
208
- "no-self-compare": "error",
209
- "no-sequences": "error",
210
- "no-setter-return": "error",
211
- "no-shadow": "error",
212
- "no-shadow-restricted-names": "error",
213
- "no-sparse-arrays": "error",
214
- "no-template-curly-in-string": "error",
215
- "no-ternary": "error",
216
- "no-this-before-super": "error",
217
- "no-throw-literal": "error",
218
- "no-unassigned-vars": "error",
219
- "no-undef": "error",
220
- "no-undef-init": "error",
221
- "no-undefined": "error",
222
- "no-underscore-dangle": "error",
223
- "no-unexpected-multiline": "error",
224
- "no-unmodified-loop-condition": "error",
225
- "no-unneeded-ternary": "error",
226
- "no-unreachable": "error",
227
- "no-unreachable-loop": "error",
228
- "no-unsafe-finally": "error",
229
- "no-unsafe-negation": "error",
230
- "no-unsafe-optional-chaining": "error",
231
- "no-unused-expressions": "error",
232
- "no-unused-labels": "error",
233
- "no-unused-private-class-members": "error",
234
- "no-unused-vars": "error",
235
- "no-use-before-define": "error",
236
- "no-useless-assignment": "error",
237
- "no-useless-backreference": "error",
238
- "no-useless-call": "error",
239
- "no-useless-catch": "error",
240
- "no-useless-computed-key": "error",
241
- "no-useless-concat": "error",
242
- "no-useless-constructor": "error",
243
- "no-useless-escape": "error",
244
- "no-useless-rename": "error",
245
- "no-useless-return": "error",
246
- "no-var": "error",
247
- "no-void": "error",
248
- "no-warning-comments": "error",
249
- "no-with": "error",
250
- "object-shorthand": "error",
251
- "one-var": "error",
252
- "operator-assignment": "error",
253
- "prefer-arrow-callback": "error",
254
- "prefer-const": "error",
255
- "prefer-destructuring": "error",
256
- "prefer-exponentiation-operator": "error",
257
- "prefer-named-capture-group": "error",
258
- "prefer-numeric-literals": "error",
259
- "prefer-object-has-own": "error",
260
- "prefer-object-spread": "error",
261
- "prefer-promise-reject-errors": "error",
262
- "prefer-regex-literals": "error",
263
- "prefer-rest-params": "error",
264
- "prefer-spread": "error",
265
- "prefer-template": "error",
266
- "preserve-caught-error": "error",
267
- "radix": "error",
268
- "require-atomic-updates": "error",
269
- "require-await": "error",
270
- "require-unicode-regexp": "error",
271
- "require-yield": "error",
272
- "sort-imports": "error",
273
- "sort-keys": "error",
274
- "sort-vars": "error",
275
- "strict": "error",
276
- "symbol-description": "error",
277
- "unicode-bom": "error",
278
- "use-isnan": "error",
279
- "valid-typeof": "error",
280
- "vars-on-top": "error",
281
- "yoda": "error"
282
- })
283
- });
284
- }
285
- });
286
-
287
- // ../../node_modules/@eslint/js/src/configs/eslint-recommended.js
288
- var require_eslint_recommended = __commonJS({
289
- "../../node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports$1, module) {
290
- module.exports = Object.freeze({
291
- rules: Object.freeze({
292
- "constructor-super": "error",
293
- "for-direction": "error",
294
- "getter-return": "error",
295
- "no-async-promise-executor": "error",
296
- "no-case-declarations": "error",
297
- "no-class-assign": "error",
298
- "no-compare-neg-zero": "error",
299
- "no-cond-assign": "error",
300
- "no-const-assign": "error",
301
- "no-constant-binary-expression": "error",
302
- "no-constant-condition": "error",
303
- "no-control-regex": "error",
304
- "no-debugger": "error",
305
- "no-delete-var": "error",
306
- "no-dupe-args": "error",
307
- "no-dupe-class-members": "error",
308
- "no-dupe-else-if": "error",
309
- "no-dupe-keys": "error",
310
- "no-duplicate-case": "error",
311
- "no-empty": "error",
312
- "no-empty-character-class": "error",
313
- "no-empty-pattern": "error",
314
- "no-empty-static-block": "error",
315
- "no-ex-assign": "error",
316
- "no-extra-boolean-cast": "error",
317
- "no-fallthrough": "error",
318
- "no-func-assign": "error",
319
- "no-global-assign": "error",
320
- "no-import-assign": "error",
321
- "no-invalid-regexp": "error",
322
- "no-irregular-whitespace": "error",
323
- "no-loss-of-precision": "error",
324
- "no-misleading-character-class": "error",
325
- "no-new-native-nonconstructor": "error",
326
- "no-nonoctal-decimal-escape": "error",
327
- "no-obj-calls": "error",
328
- "no-octal": "error",
329
- "no-prototype-builtins": "error",
330
- "no-redeclare": "error",
331
- "no-regex-spaces": "error",
332
- "no-self-assign": "error",
333
- "no-setter-return": "error",
334
- "no-shadow-restricted-names": "error",
335
- "no-sparse-arrays": "error",
336
- "no-this-before-super": "error",
337
- "no-undef": "error",
338
- "no-unexpected-multiline": "error",
339
- "no-unreachable": "error",
340
- "no-unsafe-finally": "error",
341
- "no-unsafe-negation": "error",
342
- "no-unsafe-optional-chaining": "error",
343
- "no-unused-labels": "error",
344
- "no-unused-private-class-members": "error",
345
- "no-unused-vars": "error",
346
- "no-useless-backreference": "error",
347
- "no-useless-catch": "error",
348
- "no-useless-escape": "error",
349
- "no-with": "error",
350
- "require-yield": "error",
351
- "use-isnan": "error",
352
- "valid-typeof": "error"
353
- })
354
- });
355
- }
356
- });
357
-
358
- // ../../node_modules/@eslint/js/src/index.js
359
- var require_src = __commonJS({
360
- "../../node_modules/@eslint/js/src/index.js"(exports$1, module) {
361
- var { name, version } = require_package();
362
- module.exports = {
363
- meta: {
364
- name,
365
- version
366
- },
367
- configs: {
368
- all: require_eslint_all(),
369
- recommended: require_eslint_recommended()
370
- }
371
- };
372
- }
373
- });
374
-
375
- // src/config/es.ts
376
- var import_js = __toESM(require_src());
377
-
378
- // src/rules/esRules/bestPractices.ts
379
- var bestPractices = () => ({
380
- // enforces getter/setter pairs in objects
381
- // https://eslint.org/docs/rules/accessor-pairs
382
- "accessor-pairs": "off",
383
- // enforces return statements in callbacks of array's methods
384
- // https://eslint.org/docs/rules/array-callback-return
385
- "array-callback-return": ["error", { allowImplicit: true }],
386
- // treat var statements as if they were block scoped
387
- // https://eslint.org/docs/rules/block-scoped-var
388
- "block-scoped-var": "error",
389
- // specify the maximum cyclomatic complexity allowed in a program
390
- // https://eslint.org/docs/rules/complexity
391
- "complexity": ["off", 20],
392
- // enforce that class methods use "this"
393
- // https://eslint.org/docs/rules/class-methods-use-this
394
- "class-methods-use-this": ["error", {
395
- exceptMethods: []
396
- }],
397
- // require return statements to either always or never specify values
398
- // https://eslint.org/docs/rules/consistent-return
399
- "consistent-return": "error",
400
- // specify curly brace conventions for all control statements
401
- // https://eslint.org/docs/rules/curly
402
- "curly": ["error", "multi-line"],
403
- // multiline
404
- // require default case in switch statements
405
- // https://eslint.org/docs/rules/default-case
406
- "default-case": ["error", { commentPattern: "^no default$" }],
407
- // Enforce default clauses in switch statements to be last
408
- // https://eslint.org/docs/rules/default-case-last
409
- "default-case-last": "error",
410
- // https://eslint.org/docs/rules/default-param-last
411
- "default-param-last": "error",
412
- // encourages use of dot notation whenever possible
413
- // https://eslint.org/docs/rules/dot-notation
414
- "dot-notation": ["error", { allowKeywords: true }],
415
- // enforces consistent newlines before or after dots
416
- // https://eslint.org/docs/rules/dot-location
417
- "dot-location": ["error", "property"],
418
- // require the use of === and !==
419
- // https://eslint.org/docs/rules/eqeqeq
420
- "eqeqeq": ["error", "always", { null: "ignore" }],
421
- // Require grouped accessor pairs in object literals and classes
422
- // https://eslint.org/docs/rules/grouped-accessor-pairs
423
- "grouped-accessor-pairs": "error",
424
- // make sure for-in loops have an if statement
425
- // https://eslint.org/docs/rules/guard-for-in
426
- "guard-for-in": "error",
427
- // enforce a maximum number of classes per file
428
- // https://eslint.org/docs/rules/max-classes-per-file
429
- "max-classes-per-file": ["error", 1],
430
- // disallow the use of alert, confirm, and prompt
431
- // https://eslint.org/docs/rules/no-alert
432
- // TODO: enable, semver-major
433
- "no-alert": "warn",
434
- // disallow use of arguments.caller or arguments.callee
435
- // https://eslint.org/docs/rules/no-caller
436
- "no-caller": "error",
437
- // disallow lexical declarations in case/default clauses
438
- // https://eslint.org/docs/rules/no-case-declarations
439
- "no-case-declarations": "error",
440
- // Disallow returning value in constructor
441
- // https://eslint.org/docs/rules/no-constructor-return
442
- "no-constructor-return": "error",
443
- // disallow division operators explicitly at beginning of regular expression
444
- // https://eslint.org/docs/rules/no-div-regex
445
- "no-div-regex": "off",
446
- // disallow else after a return in an if
447
- // https://eslint.org/docs/rules/no-else-return
448
- "no-else-return": ["error", { allowElseIf: false }],
449
- // disallow empty functions, except for standalone funcs/arrows
450
- // https://eslint.org/docs/rules/no-empty-function
451
- "no-empty-function": ["error", {
452
- allow: [
453
- "arrowFunctions",
454
- "functions",
455
- "methods"
456
- ]
457
- }],
458
- // disallow empty destructuring patterns
459
- // https://eslint.org/docs/rules/no-empty-pattern
460
- "no-empty-pattern": "error",
461
- // Disallow empty static blocks
462
- // https://eslint.org/docs/latest/rules/no-empty-static-block
463
- // TODO: semver-major, enable
464
- "no-empty-static-block": "off",
465
- // disallow comparisons to null without a type-checking operator
466
- // https://eslint.org/docs/rules/no-eq-null
467
- "no-eq-null": "off",
468
- // disallow use of eval()
469
- // https://eslint.org/docs/rules/no-eval
470
- "no-eval": "error",
471
- // disallow adding to native types
472
- // https://eslint.org/docs/rules/no-extend-native
473
- "no-extend-native": "error",
474
- // disallow unnecessary function binding
475
- // https://eslint.org/docs/rules/no-extra-bind
476
- "no-extra-bind": "error",
477
- // disallow Unnecessary Labels
478
- // https://eslint.org/docs/rules/no-extra-label
479
- "no-extra-label": "error",
480
- // disallow fallthrough of case statements
481
- // https://eslint.org/docs/rules/no-fallthrough
482
- "no-fallthrough": "error",
483
- // disallow the use of leading or trailing decimal points in numeric literals
484
- // https://eslint.org/docs/rules/no-floating-decimal
485
- "no-floating-decimal": "error",
486
- // disallow reassignments of native objects or read-only globals
487
- // https://eslint.org/docs/rules/no-global-assign
488
- "no-global-assign": ["error", { exceptions: [] }],
489
- // deprecated in favor of no-global-assign
490
- // https://eslint.org/docs/rules/no-native-reassign
491
- "no-native-reassign": "off",
492
- // disallow implicit type conversions
493
- // https://eslint.org/docs/rules/no-implicit-coercion
494
- "no-implicit-coercion": ["off", {
495
- boolean: false,
496
- number: true,
497
- string: true,
498
- allow: []
499
- }],
500
- // disallow var and named functions in global scope
501
- // https://eslint.org/docs/rules/no-implicit-globals
502
- "no-implicit-globals": "off",
503
- // disallow use of eval()-like methods
504
- // https://eslint.org/docs/rules/no-implied-eval
505
- "no-implied-eval": "error",
506
- // disallow this keywords outside of classes or class-like objects
507
- // https://eslint.org/docs/rules/no-invalid-this
508
- "no-invalid-this": "off",
509
- // disallow usage of __iterator__ property
510
- // https://eslint.org/docs/rules/no-iterator
511
- "no-iterator": "error",
512
- // disallow use of labels for anything other than loops and switches
513
- // https://eslint.org/docs/rules/no-labels
514
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
515
- // disallow unnecessary nested blocks
516
- // https://eslint.org/docs/rules/no-lone-blocks
517
- "no-lone-blocks": "error",
518
- // disallow creation of functions within loops
519
- // https://eslint.org/docs/rules/no-loop-func
520
- "no-loop-func": "error",
521
- // disallow magic numbers
522
- // https://eslint.org/docs/rules/no-magic-numbers
523
- "no-magic-numbers": ["off", {
524
- ignore: [],
525
- ignoreArrayIndexes: true,
526
- enforceConst: true,
527
- detectObjects: false
528
- }],
529
- // disallow use of multiple spaces
530
- // https://eslint.org/docs/rules/no-multi-spaces
531
- "no-multi-spaces": ["error", {
532
- ignoreEOLComments: false
533
- }],
534
- // disallow use of multiline strings
535
- // https://eslint.org/docs/rules/no-multi-str
536
- "no-multi-str": "error",
537
- // disallow use of new operator when not part of the assignment or comparison
538
- // https://eslint.org/docs/rules/no-new
539
- "no-new": "error",
540
- // disallow use of new operator for Function object
541
- // https://eslint.org/docs/rules/no-new-func
542
- "no-new-func": "error",
543
- // disallows creating new instances of String, Number, and Boolean
544
- // https://eslint.org/docs/rules/no-new-wrappers
545
- "no-new-wrappers": "error",
546
- // Disallow \8 and \9 escape sequences in string literals
547
- // https://eslint.org/docs/rules/no-nonoctal-decimal-escape
548
- "no-nonoctal-decimal-escape": "error",
549
- // Disallow calls to the Object constructor without an argument
550
- // https://eslint.org/docs/latest/rules/no-object-constructor
551
- // TODO: enable, semver-major
552
- "no-object-constructor": "off",
553
- // disallow use of (old style) octal literals
554
- // https://eslint.org/docs/rules/no-octal
555
- "no-octal": "error",
556
- // disallow use of octal escape sequences in string literals, such as
557
- // var foo = 'Copyright \251';
558
- // https://eslint.org/docs/rules/no-octal-escape
559
- "no-octal-escape": "error",
560
- // disallow reassignment of function parameters
561
- // disallow parameter object manipulation except for specific exclusions
562
- // rule: https://eslint.org/docs/rules/no-param-reassign.html
563
- "no-param-reassign": ["error", {
564
- props: true,
565
- ignorePropertyModificationsFor: [
566
- "acc",
567
- // for reduce accumulators
568
- "accumulator",
569
- // for reduce accumulators
570
- "e",
571
- // for e.returnvalue
572
- "ctx",
573
- // for Koa routing
574
- "context",
575
- // for Koa routing
576
- "req",
577
- // for Express requests
578
- "request",
579
- // for Express requests
580
- "res",
581
- // for Express responses
582
- "response",
583
- // for Express responses
584
- "$scope",
585
- // for Angular 1 scopes
586
- "staticContext"
587
- // for ReactRouter context
588
- ]
589
- }],
590
- // disallow usage of __proto__ property
591
- // https://eslint.org/docs/rules/no-proto
592
- "no-proto": "error",
593
- // disallow declaring the same variable more than once
594
- // https://eslint.org/docs/rules/no-redeclare
595
- "no-redeclare": "error",
596
- // disallow certain object properties
597
- // https://eslint.org/docs/rules/no-restricted-properties
598
- "no-restricted-properties": ["error", {
599
- object: "arguments",
600
- property: "callee",
601
- message: "arguments.callee is deprecated"
602
- }, {
603
- object: "global",
604
- property: "isFinite",
605
- message: "Please use Number.isFinite instead"
606
- }, {
607
- object: "self",
608
- property: "isFinite",
609
- message: "Please use Number.isFinite instead"
610
- }, {
611
- object: "window",
612
- property: "isFinite",
613
- message: "Please use Number.isFinite instead"
614
- }, {
615
- object: "global",
616
- property: "isNaN",
617
- message: "Please use Number.isNaN instead"
618
- }, {
619
- object: "self",
620
- property: "isNaN",
621
- message: "Please use Number.isNaN instead"
622
- }, {
623
- object: "window",
624
- property: "isNaN",
625
- message: "Please use Number.isNaN instead"
626
- }, {
627
- property: "__defineGetter__",
628
- message: "Please use Object.defineProperty instead."
629
- }, {
630
- property: "__defineSetter__",
631
- message: "Please use Object.defineProperty instead."
632
- }, {
633
- object: "Math",
634
- property: "pow",
635
- message: "Use the exponentiation operator (**) instead."
636
- }],
637
- // disallow use of assignment in return statement
638
- // https://eslint.org/docs/rules/no-return-assign
639
- "no-return-assign": ["error", "always"],
640
- // disallow redundant `return await`
641
- // https://eslint.org/docs/rules/no-return-await
642
- "no-return-await": "error",
643
- // disallow use of `javascript:` urls.
644
- // https://eslint.org/docs/rules/no-script-url
645
- "no-script-url": "error",
646
- // disallow self assignment
647
- // https://eslint.org/docs/rules/no-self-assign
648
- "no-self-assign": ["error", {
649
- props: true
650
- }],
651
- // disallow comparisons where both sides are exactly the same
652
- // https://eslint.org/docs/rules/no-self-compare
653
- "no-self-compare": "error",
654
- // disallow use of comma operator
655
- // https://eslint.org/docs/rules/no-sequences
656
- "no-sequences": "error",
657
- // restrict what can be thrown as an exception
658
- // https://eslint.org/docs/rules/no-throw-literal
659
- "no-throw-literal": "error",
660
- // disallow unmodified conditions of loops
661
- // https://eslint.org/docs/rules/no-unmodified-loop-condition
662
- "no-unmodified-loop-condition": "off",
663
- // disallow usage of expressions in statement position
664
- // https://eslint.org/docs/rules/no-unused-expressions
665
- "no-unused-expressions": ["error", {
666
- allowShortCircuit: false,
667
- allowTernary: false,
668
- allowTaggedTemplates: false
669
- }],
670
- // disallow unused labels
671
- // https://eslint.org/docs/rules/no-unused-labels
672
- "no-unused-labels": "error",
673
- // disallow unnecessary .call() and .apply()
674
- // https://eslint.org/docs/rules/no-useless-call
675
- "no-useless-call": "off",
676
- // Disallow unnecessary catch clauses
677
- // https://eslint.org/docs/rules/no-useless-catch
678
- "no-useless-catch": "error",
679
- // disallow useless string concatenation
680
- // https://eslint.org/docs/rules/no-useless-concat
681
- "no-useless-concat": "error",
682
- // disallow unnecessary string escaping
683
- // https://eslint.org/docs/rules/no-useless-escape
684
- "no-useless-escape": "error",
685
- // disallow redundant return; keywords
686
- // https://eslint.org/docs/rules/no-useless-return
687
- "no-useless-return": "error",
688
- // disallow use of void operator
689
- // https://eslint.org/docs/rules/no-void
690
- "no-void": "error",
691
- // disallow usage of configurable warning terms in comments: e.g. todo
692
- // https://eslint.org/docs/rules/no-warning-comments
693
- "no-warning-comments": ["off", { terms: ["todo", "fixme", "xxx"], location: "start" }],
694
- // disallow use of the with statement
695
- // https://eslint.org/docs/rules/no-with
696
- "no-with": "error",
697
- // require using Error objects as Promise rejection reasons
698
- // https://eslint.org/docs/rules/prefer-promise-reject-errors
699
- "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
700
- // Suggest using named capture group in regular expression
701
- // https://eslint.org/docs/rules/prefer-named-capture-group
702
- "prefer-named-capture-group": "off",
703
- // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
704
- // https://eslint.org/docs/rules/prefer-object-has-own
705
- // TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
706
- "prefer-object-has-own": "off",
707
- // https://eslint.org/docs/rules/prefer-regex-literals
708
- "prefer-regex-literals": ["error", {
709
- disallowRedundantWrapping: true
710
- }],
711
- // require use of the second argument for parseInt()
712
- // https://eslint.org/docs/rules/radix
713
- "radix": "error",
714
- // require `await` in `async function` (note: this is a horrible rule that should never be used)
715
- // https://eslint.org/docs/rules/require-await
716
- "require-await": "off",
717
- // Enforce the use of u flag on RegExp
718
- // https://eslint.org/docs/rules/require-unicode-regexp
719
- "require-unicode-regexp": "off",
720
- // requires to declare all vars on top of their containing scope
721
- // https://eslint.org/docs/rules/vars-on-top
722
- "vars-on-top": "error",
723
- // require immediate function invocation to be wrapped in parentheses
724
- // https://eslint.org/docs/rules/wrap-iife.html
725
- "wrap-iife": ["error", "outside", { functionPrototypeMethods: false }],
726
- // require or disallow Yoda conditions
727
- // https://eslint.org/docs/rules/yoda
728
- "yoda": "error"
1
+ import globals from "globals";
2
+ import eslintConfig from "@eslint/js";
3
+ import { ESLintConfig, Project, interopDefault } from "@w5s/dev";
4
+ import fs from "node:fs";
5
+ import nodePath from "node:path";
6
+ import process from "node:process";
7
+ import { findUp } from "find-up";
8
+ import parseGitignore from "parse-gitignore";
9
+ import prettierConfig from "@w5s/prettier-config";
10
+ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
11
+ //#region src/rules/esRules/bestPractices.ts
12
+ const bestPractices = () => ({
13
+ "accessor-pairs": "off",
14
+ "array-callback-return": ["error", { allowImplicit: true }],
15
+ "block-scoped-var": "error",
16
+ "complexity": ["off", 20],
17
+ "class-methods-use-this": ["error", { exceptMethods: [] }],
18
+ "consistent-return": "error",
19
+ "curly": ["error", "multi-line"],
20
+ "default-case": ["error", { commentPattern: "^no default$" }],
21
+ "default-case-last": "error",
22
+ "default-param-last": "error",
23
+ "dot-notation": ["error", { allowKeywords: true }],
24
+ "dot-location": ["error", "property"],
25
+ "eqeqeq": [
26
+ "error",
27
+ "always",
28
+ { null: "ignore" }
29
+ ],
30
+ "grouped-accessor-pairs": "error",
31
+ "guard-for-in": "error",
32
+ "max-classes-per-file": ["error", 1],
33
+ "no-alert": "warn",
34
+ "no-caller": "error",
35
+ "no-case-declarations": "error",
36
+ "no-constructor-return": "error",
37
+ "no-div-regex": "off",
38
+ "no-else-return": ["error", { allowElseIf: false }],
39
+ "no-empty-function": ["error", { allow: [
40
+ "arrowFunctions",
41
+ "functions",
42
+ "methods"
43
+ ] }],
44
+ "no-empty-pattern": "error",
45
+ "no-empty-static-block": "off",
46
+ "no-eq-null": "off",
47
+ "no-eval": "error",
48
+ "no-extend-native": "error",
49
+ "no-extra-bind": "error",
50
+ "no-extra-label": "error",
51
+ "no-fallthrough": "error",
52
+ "no-floating-decimal": "error",
53
+ "no-global-assign": ["error", { exceptions: [] }],
54
+ "no-native-reassign": "off",
55
+ "no-implicit-coercion": ["off", {
56
+ boolean: false,
57
+ number: true,
58
+ string: true,
59
+ allow: []
60
+ }],
61
+ "no-implicit-globals": "off",
62
+ "no-implied-eval": "error",
63
+ "no-invalid-this": "off",
64
+ "no-iterator": "error",
65
+ "no-labels": ["error", {
66
+ allowLoop: false,
67
+ allowSwitch: false
68
+ }],
69
+ "no-lone-blocks": "error",
70
+ "no-loop-func": "error",
71
+ "no-magic-numbers": ["off", {
72
+ ignore: [],
73
+ ignoreArrayIndexes: true,
74
+ enforceConst: true,
75
+ detectObjects: false
76
+ }],
77
+ "no-multi-spaces": ["error", { ignoreEOLComments: false }],
78
+ "no-multi-str": "error",
79
+ "no-new": "error",
80
+ "no-new-func": "error",
81
+ "no-new-wrappers": "error",
82
+ "no-nonoctal-decimal-escape": "error",
83
+ "no-object-constructor": "off",
84
+ "no-octal": "error",
85
+ "no-octal-escape": "error",
86
+ "no-param-reassign": ["error", {
87
+ props: true,
88
+ ignorePropertyModificationsFor: [
89
+ "acc",
90
+ "accumulator",
91
+ "e",
92
+ "ctx",
93
+ "context",
94
+ "req",
95
+ "request",
96
+ "res",
97
+ "response",
98
+ "$scope",
99
+ "staticContext"
100
+ ]
101
+ }],
102
+ "no-proto": "error",
103
+ "no-redeclare": "error",
104
+ "no-restricted-properties": [
105
+ "error",
106
+ {
107
+ object: "arguments",
108
+ property: "callee",
109
+ message: "arguments.callee is deprecated"
110
+ },
111
+ {
112
+ object: "global",
113
+ property: "isFinite",
114
+ message: "Please use Number.isFinite instead"
115
+ },
116
+ {
117
+ object: "self",
118
+ property: "isFinite",
119
+ message: "Please use Number.isFinite instead"
120
+ },
121
+ {
122
+ object: "window",
123
+ property: "isFinite",
124
+ message: "Please use Number.isFinite instead"
125
+ },
126
+ {
127
+ object: "global",
128
+ property: "isNaN",
129
+ message: "Please use Number.isNaN instead"
130
+ },
131
+ {
132
+ object: "self",
133
+ property: "isNaN",
134
+ message: "Please use Number.isNaN instead"
135
+ },
136
+ {
137
+ object: "window",
138
+ property: "isNaN",
139
+ message: "Please use Number.isNaN instead"
140
+ },
141
+ {
142
+ property: "__defineGetter__",
143
+ message: "Please use Object.defineProperty instead."
144
+ },
145
+ {
146
+ property: "__defineSetter__",
147
+ message: "Please use Object.defineProperty instead."
148
+ },
149
+ {
150
+ object: "Math",
151
+ property: "pow",
152
+ message: "Use the exponentiation operator (**) instead."
153
+ }
154
+ ],
155
+ "no-return-assign": ["error", "always"],
156
+ "no-return-await": "error",
157
+ "no-script-url": "error",
158
+ "no-self-assign": ["error", { props: true }],
159
+ "no-self-compare": "error",
160
+ "no-sequences": "error",
161
+ "no-throw-literal": "error",
162
+ "no-unmodified-loop-condition": "off",
163
+ "no-unused-expressions": ["error", {
164
+ allowShortCircuit: false,
165
+ allowTernary: false,
166
+ allowTaggedTemplates: false
167
+ }],
168
+ "no-unused-labels": "error",
169
+ "no-useless-call": "off",
170
+ "no-useless-catch": "error",
171
+ "no-useless-concat": "error",
172
+ "no-useless-escape": "error",
173
+ "no-useless-return": "error",
174
+ "no-void": "error",
175
+ "no-warning-comments": ["off", {
176
+ terms: [
177
+ "todo",
178
+ "fixme",
179
+ "xxx"
180
+ ],
181
+ location: "start"
182
+ }],
183
+ "no-with": "error",
184
+ "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
185
+ "prefer-named-capture-group": "off",
186
+ "prefer-object-has-own": "off",
187
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
188
+ "radix": "error",
189
+ "require-await": "off",
190
+ "require-unicode-regexp": "off",
191
+ "vars-on-top": "error",
192
+ "wrap-iife": [
193
+ "error",
194
+ "outside",
195
+ { functionPrototypeMethods: false }
196
+ ],
197
+ "yoda": "error"
729
198
  });
730
-
731
- // src/rules/esRules/errors.ts
732
- var errors = () => ({
733
- // Enforce “for loop update clause moving the counter in the right direction
734
- // https://eslint.org/docs/rules/for-direction
735
- "for-direction": "error",
736
- // Enforces that a return statement is present in property getters
737
- // https://eslint.org/docs/rules/getter-return
738
- "getter-return": ["error", { allowImplicit: true }],
739
- // disallow using an async function as a Promise executor
740
- // https://eslint.org/docs/rules/no-async-promise-executor
741
- "no-async-promise-executor": "error",
742
- // Disallow await inside of loops
743
- // https://eslint.org/docs/rules/no-await-in-loop
744
- "no-await-in-loop": "error",
745
- // Disallow comparisons to negative zero
746
- // https://eslint.org/docs/rules/no-compare-neg-zero
747
- "no-compare-neg-zero": "error",
748
- // disallow assignment in conditional expressions
749
- "no-cond-assign": ["error", "always"],
750
- // disallow use of console
751
- "no-console": "warn",
752
- // Disallows expressions where the operation doesn't affect the value
753
- // https://eslint.org/docs/rules/no-constant-binary-expression
754
- // TODO: semver-major, enable
755
- "no-constant-binary-expression": "off",
756
- // disallow use of constant expressions in conditions
757
- "no-constant-condition": "warn",
758
- // disallow control characters in regular expressions
759
- "no-control-regex": "error",
760
- // disallow use of debugger
761
- "no-debugger": "error",
762
- // disallow duplicate arguments in functions
763
- "no-dupe-args": "error",
764
- // Disallow duplicate conditions in if-else-if chains
765
- // https://eslint.org/docs/rules/no-dupe-else-if
766
- "no-dupe-else-if": "error",
767
- // disallow duplicate keys when creating object literals
768
- "no-dupe-keys": "error",
769
- // disallow a duplicate case label.
770
- "no-duplicate-case": "error",
771
- // disallow empty statements
772
- "no-empty": "error",
773
- // disallow the use of empty character classes in regular expressions
774
- "no-empty-character-class": "error",
775
- // disallow assigning to the exception in a catch block
776
- "no-ex-assign": "error",
777
- // disallow double-negation boolean casts in a boolean context
778
- // https://eslint.org/docs/rules/no-extra-boolean-cast
779
- "no-extra-boolean-cast": "error",
780
- // disallow unnecessary parentheses
781
- // https://eslint.org/docs/rules/no-extra-parens
782
- "no-extra-parens": ["off", "all", {
783
- conditionalAssign: true,
784
- nestedBinaryExpressions: false,
785
- returnAssign: false,
786
- ignoreJSX: "all",
787
- // delegate to eslint-plugin-react
788
- enforceForArrowConditionals: false
789
- }],
790
- // disallow unnecessary semicolons
791
- "no-extra-semi": "error",
792
- // disallow overwriting functions written as function declarations
793
- "no-func-assign": "error",
794
- // https://eslint.org/docs/rules/no-import-assign
795
- "no-import-assign": "error",
796
- // disallow function or variable declarations in nested blocks
797
- "no-inner-declarations": "error",
798
- // disallow invalid regular expression strings in the RegExp constructor
799
- "no-invalid-regexp": "error",
800
- // disallow irregular whitespace outside of strings and comments
801
- "no-irregular-whitespace": "error",
802
- // Disallow Number Literals That Lose Precision
803
- // https://eslint.org/docs/rules/no-loss-of-precision
804
- "no-loss-of-precision": "error",
805
- // Disallow characters which are made with multiple code points in character class syntax
806
- // https://eslint.org/docs/rules/no-misleading-character-class
807
- "no-misleading-character-class": "error",
808
- // disallow the use of object properties of the global object (Math and JSON) as functions
809
- "no-obj-calls": "error",
810
- // Disallow new operators with global non-constructor functions
811
- // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
812
- // TODO: semver-major, enable
813
- "no-new-native-nonconstructor": "off",
814
- // Disallow returning values from Promise executor functions
815
- // https://eslint.org/docs/rules/no-promise-executor-return
816
- "no-promise-executor-return": "error",
817
- // disallow use of Object.prototypes builtins directly
818
- // https://eslint.org/docs/rules/no-prototype-builtins
819
- "no-prototype-builtins": "error",
820
- // disallow multiple spaces in a regular expression literal
821
- "no-regex-spaces": "error",
822
- // Disallow returning values from setters
823
- // https://eslint.org/docs/rules/no-setter-return
824
- "no-setter-return": "error",
825
- // disallow sparse arrays
826
- "no-sparse-arrays": "error",
827
- // Disallow template literal placeholder syntax in regular strings
828
- // https://eslint.org/docs/rules/no-template-curly-in-string
829
- "no-template-curly-in-string": "error",
830
- // Avoid code that looks like two expressions but is actually one
831
- // https://eslint.org/docs/rules/no-unexpected-multiline
832
- "no-unexpected-multiline": "error",
833
- // disallow unreachable statements after a return, throw, continue, or break statement
834
- "no-unreachable": "error",
835
- // Disallow loops with a body that allows only one iteration
836
- // https://eslint.org/docs/rules/no-unreachable-loop
837
- "no-unreachable-loop": ["error", {
838
- ignore: []
839
- // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
840
- }],
841
- // disallow return/throw/break/continue inside finally blocks
842
- // https://eslint.org/docs/rules/no-unsafe-finally
843
- "no-unsafe-finally": "error",
844
- // disallow negating the left operand of relational operators
845
- // https://eslint.org/docs/rules/no-unsafe-negation
846
- "no-unsafe-negation": "error",
847
- // disallow use of optional chaining in contexts where the undefined value is not allowed
848
- // https://eslint.org/docs/rules/no-unsafe-optional-chaining
849
- "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
850
- // Disallow Unused Private Class Members
851
- // https://eslint.org/docs/rules/no-unused-private-class-members
852
- // TODO: enable once eslint 7 is dropped (which is semver-major)
853
- "no-unused-private-class-members": "off",
854
- // Disallow useless backreferences in regular expressions
855
- // https://eslint.org/docs/rules/no-useless-backreference
856
- "no-useless-backreference": "error",
857
- // disallow negation of the left operand of an in expression
858
- // deprecated in favor of no-unsafe-negation
859
- "no-negated-in-lhs": "off",
860
- // Disallow assignments that can lead to race conditions due to usage of await or yield
861
- // https://eslint.org/docs/rules/require-atomic-updates
862
- // note: not enabled because it is very buggy
863
- "require-atomic-updates": "off",
864
- // disallow comparisons with the value NaN
865
- "use-isnan": "error",
866
- // ensure JSDoc comments are valid
867
- // https://eslint.org/docs/rules/valid-jsdoc
868
- "valid-jsdoc": "off",
869
- // ensure that the results of typeof are compared against a valid string
870
- // https://eslint.org/docs/rules/valid-typeof
871
- "valid-typeof": ["error", { requireStringLiterals: true }]
199
+ //#endregion
200
+ //#region src/rules/esRules/errors.ts
201
+ const errors = () => ({
202
+ "for-direction": "error",
203
+ "getter-return": ["error", { allowImplicit: true }],
204
+ "no-async-promise-executor": "error",
205
+ "no-await-in-loop": "error",
206
+ "no-compare-neg-zero": "error",
207
+ "no-cond-assign": ["error", "always"],
208
+ "no-console": "warn",
209
+ "no-constant-binary-expression": "off",
210
+ "no-constant-condition": "warn",
211
+ "no-control-regex": "error",
212
+ "no-debugger": "error",
213
+ "no-dupe-args": "error",
214
+ "no-dupe-else-if": "error",
215
+ "no-dupe-keys": "error",
216
+ "no-duplicate-case": "error",
217
+ "no-empty": "error",
218
+ "no-empty-character-class": "error",
219
+ "no-ex-assign": "error",
220
+ "no-extra-boolean-cast": "error",
221
+ "no-extra-parens": [
222
+ "off",
223
+ "all",
224
+ {
225
+ conditionalAssign: true,
226
+ nestedBinaryExpressions: false,
227
+ returnAssign: false,
228
+ ignoreJSX: "all",
229
+ enforceForArrowConditionals: false
230
+ }
231
+ ],
232
+ "no-extra-semi": "error",
233
+ "no-func-assign": "error",
234
+ "no-import-assign": "error",
235
+ "no-inner-declarations": "error",
236
+ "no-invalid-regexp": "error",
237
+ "no-irregular-whitespace": "error",
238
+ "no-loss-of-precision": "error",
239
+ "no-misleading-character-class": "error",
240
+ "no-obj-calls": "error",
241
+ "no-new-native-nonconstructor": "off",
242
+ "no-promise-executor-return": "error",
243
+ "no-prototype-builtins": "error",
244
+ "no-regex-spaces": "error",
245
+ "no-setter-return": "error",
246
+ "no-sparse-arrays": "error",
247
+ "no-template-curly-in-string": "error",
248
+ "no-unexpected-multiline": "error",
249
+ "no-unreachable": "error",
250
+ "no-unreachable-loop": ["error", { ignore: [] }],
251
+ "no-unsafe-finally": "error",
252
+ "no-unsafe-negation": "error",
253
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
254
+ "no-unused-private-class-members": "off",
255
+ "no-useless-backreference": "error",
256
+ "no-negated-in-lhs": "off",
257
+ "require-atomic-updates": "off",
258
+ "use-isnan": "error",
259
+ "valid-jsdoc": "off",
260
+ "valid-typeof": ["error", { requireStringLiterals: true }]
872
261
  });
873
-
874
- // src/rules/esRules/es6.ts
875
- var es6 = () => ({
876
- // enforces no braces where they can be omitted
877
- // https://eslint.org/docs/rules/arrow-body-style
878
- // TODO: enable requireReturnForObjectLiteral?
879
- "arrow-body-style": ["error", "as-needed", {
880
- requireReturnForObjectLiteral: false
881
- }],
882
- // require parens in arrow function arguments
883
- // https://eslint.org/docs/rules/arrow-parens
884
- "arrow-parens": ["error", "always"],
885
- // require space before/after arrow function's arrow
886
- // https://eslint.org/docs/rules/arrow-spacing
887
- "arrow-spacing": ["error", { before: true, after: true }],
888
- // verify super() callings in constructors
889
- "constructor-super": "error",
890
- // enforce the spacing around the * in generator functions
891
- // https://eslint.org/docs/rules/generator-star-spacing
892
- "generator-star-spacing": ["error", { before: false, after: true }],
893
- // disallow modifying variables of class declarations
894
- // https://eslint.org/docs/rules/no-class-assign
895
- "no-class-assign": "error",
896
- // disallow arrow functions where they could be confused with comparisons
897
- // https://eslint.org/docs/rules/no-confusing-arrow
898
- "no-confusing-arrow": ["error", {
899
- allowParens: true
900
- }],
901
- // disallow modifying variables that are declared using const
902
- "no-const-assign": "error",
903
- // disallow duplicate class members
904
- // https://eslint.org/docs/rules/no-dupe-class-members
905
- "no-dupe-class-members": "error",
906
- // disallow importing from the same path more than once
907
- // https://eslint.org/docs/rules/no-duplicate-imports
908
- // replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
909
- "no-duplicate-imports": "off",
910
- // disallow symbol constructor
911
- // https://eslint.org/docs/rules/no-new-symbol
912
- "no-new-symbol": "error",
913
- // Disallow specified names in exports
914
- // https://eslint.org/docs/rules/no-restricted-exports
915
- "no-restricted-exports": ["error", {
916
- restrictedNamedExports: [
917
- "default",
918
- // use `export default` to provide a default export
919
- "then"
920
- // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
921
- ]
922
- }],
923
- // disallow specific imports
924
- // https://eslint.org/docs/rules/no-restricted-imports
925
- "no-restricted-imports": ["off", {
926
- paths: [],
927
- patterns: []
928
- }],
929
- // disallow to use this/super before super() calling in constructors.
930
- // https://eslint.org/docs/rules/no-this-before-super
931
- "no-this-before-super": "error",
932
- // disallow useless computed property keys
933
- // https://eslint.org/docs/rules/no-useless-computed-key
934
- "no-useless-computed-key": "error",
935
- // disallow unnecessary constructor
936
- // https://eslint.org/docs/rules/no-useless-constructor
937
- "no-useless-constructor": "error",
938
- // disallow renaming import, export, and destructured assignments to the same name
939
- // https://eslint.org/docs/rules/no-useless-rename
940
- "no-useless-rename": ["error", {
941
- ignoreDestructuring: false,
942
- ignoreImport: false,
943
- ignoreExport: false
944
- }],
945
- // require let or const instead of var
946
- "no-var": "error",
947
- // require method and property shorthand syntax for object literals
948
- // https://eslint.org/docs/rules/object-shorthand
949
- "object-shorthand": ["error", "always", {
950
- ignoreConstructors: false,
951
- avoidQuotes: true
952
- }],
953
- // suggest using arrow functions as callbacks
954
- "prefer-arrow-callback": ["error", {
955
- allowNamedFunctions: false,
956
- allowUnboundThis: true
957
- }],
958
- // suggest using of const declaration for variables that are never modified after declared
959
- "prefer-const": ["error", {
960
- destructuring: "any",
961
- ignoreReadBeforeAssign: true
962
- }],
963
- // Prefer destructuring from arrays and objects
964
- // https://eslint.org/docs/rules/prefer-destructuring
965
- "prefer-destructuring": ["error", {
966
- VariableDeclarator: {
967
- array: false,
968
- object: true
969
- },
970
- AssignmentExpression: {
971
- array: true,
972
- object: false
973
- }
974
- }, {
975
- enforceForRenamedProperties: false
976
- }],
977
- // disallow parseInt() in favor of binary, octal, and hexadecimal literals
978
- // https://eslint.org/docs/rules/prefer-numeric-literals
979
- "prefer-numeric-literals": "error",
980
- // suggest using Reflect methods where applicable
981
- // https://eslint.org/docs/rules/prefer-reflect
982
- "prefer-reflect": "off",
983
- // use rest parameters instead of arguments
984
- // https://eslint.org/docs/rules/prefer-rest-params
985
- "prefer-rest-params": "error",
986
- // suggest using the spread syntax instead of .apply()
987
- // https://eslint.org/docs/rules/prefer-spread
988
- "prefer-spread": "error",
989
- // suggest using template literals instead of string concatenation
990
- // https://eslint.org/docs/rules/prefer-template
991
- "prefer-template": "error",
992
- // disallow generator functions that do not have yield
993
- // https://eslint.org/docs/rules/require-yield
994
- "require-yield": "error",
995
- // enforce spacing between object rest-spread
996
- // https://eslint.org/docs/rules/rest-spread-spacing
997
- "rest-spread-spacing": ["error", "never"],
998
- // import sorting
999
- // https://eslint.org/docs/rules/sort-imports
1000
- "sort-imports": ["off", {
1001
- ignoreCase: false,
1002
- ignoreDeclarationSort: false,
1003
- ignoreMemberSort: false,
1004
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
1005
- }],
1006
- // require a Symbol description
1007
- // https://eslint.org/docs/rules/symbol-description
1008
- "symbol-description": "error",
1009
- // enforce usage of spacing in template strings
1010
- // https://eslint.org/docs/rules/template-curly-spacing
1011
- "template-curly-spacing": "error",
1012
- // enforce spacing around the * in yield* expressions
1013
- // https://eslint.org/docs/rules/yield-star-spacing
1014
- "yield-star-spacing": ["error", "after"]
262
+ //#endregion
263
+ //#region src/rules/esRules/es6.ts
264
+ const es6 = () => ({
265
+ "arrow-body-style": [
266
+ "error",
267
+ "as-needed",
268
+ { requireReturnForObjectLiteral: false }
269
+ ],
270
+ "arrow-parens": ["error", "always"],
271
+ "arrow-spacing": ["error", {
272
+ before: true,
273
+ after: true
274
+ }],
275
+ "constructor-super": "error",
276
+ "generator-star-spacing": ["error", {
277
+ before: false,
278
+ after: true
279
+ }],
280
+ "no-class-assign": "error",
281
+ "no-confusing-arrow": ["error", { allowParens: true }],
282
+ "no-const-assign": "error",
283
+ "no-dupe-class-members": "error",
284
+ "no-duplicate-imports": "off",
285
+ "no-new-symbol": "error",
286
+ "no-restricted-exports": ["error", { restrictedNamedExports: ["default", "then"] }],
287
+ "no-restricted-imports": ["off", {
288
+ paths: [],
289
+ patterns: []
290
+ }],
291
+ "no-this-before-super": "error",
292
+ "no-useless-computed-key": "error",
293
+ "no-useless-constructor": "error",
294
+ "no-useless-rename": ["error", {
295
+ ignoreDestructuring: false,
296
+ ignoreImport: false,
297
+ ignoreExport: false
298
+ }],
299
+ "no-var": "error",
300
+ "object-shorthand": [
301
+ "error",
302
+ "always",
303
+ {
304
+ ignoreConstructors: false,
305
+ avoidQuotes: true
306
+ }
307
+ ],
308
+ "prefer-arrow-callback": ["error", {
309
+ allowNamedFunctions: false,
310
+ allowUnboundThis: true
311
+ }],
312
+ "prefer-const": ["error", {
313
+ destructuring: "any",
314
+ ignoreReadBeforeAssign: true
315
+ }],
316
+ "prefer-destructuring": [
317
+ "error",
318
+ {
319
+ VariableDeclarator: {
320
+ array: false,
321
+ object: true
322
+ },
323
+ AssignmentExpression: {
324
+ array: true,
325
+ object: false
326
+ }
327
+ },
328
+ { enforceForRenamedProperties: false }
329
+ ],
330
+ "prefer-numeric-literals": "error",
331
+ "prefer-reflect": "off",
332
+ "prefer-rest-params": "error",
333
+ "prefer-spread": "error",
334
+ "prefer-template": "error",
335
+ "require-yield": "error",
336
+ "rest-spread-spacing": ["error", "never"],
337
+ "sort-imports": ["off", {
338
+ ignoreCase: false,
339
+ ignoreDeclarationSort: false,
340
+ ignoreMemberSort: false,
341
+ memberSyntaxSortOrder: [
342
+ "none",
343
+ "all",
344
+ "multiple",
345
+ "single"
346
+ ]
347
+ }],
348
+ "symbol-description": "error",
349
+ "template-curly-spacing": "error",
350
+ "yield-star-spacing": ["error", "after"]
1015
351
  });
1016
-
1017
- // src/rules/esRules/overrides.ts
1018
- var overrides = () => ({
1019
- // Too many errors in components
1020
- "class-methods-use-this": "off",
1021
- // Annoying because it is not always wanted
1022
- "default-case": "off",
1023
- // We do not want console.* in production. Disable this rule on a per line basis if needed
1024
- "no-console": "error",
1025
- // Often useful in jsx
1026
- "no-nested-ternary": "off",
1027
- // Too strict, for pure code prefer the functional plugin
1028
- "no-param-reassign": ["error", { props: false }],
1029
- // Allow for-of syntax
1030
- // 'no-restricted-syntax': baseConfig.rules['no-restricted-syntax'].filter(
1031
- // // @ts-ignore No typing available
1032
- // ({ selector }) => selector !== 'ForOfStatement',
1033
- // ),
1034
- // underscore is often used (mongodb, etc)
1035
- "no-underscore-dangle": "off",
1036
- // Ignore underscore case arguments
1037
- "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
1038
- // Allow in some cases https://github.com/airbnb/javascript/issues/1089#issuecomment-1024351821
1039
- "no-use-before-define": ["error", "nofunc"],
1040
- // Allow statements, to be compatible with '@typescript-eslint/no-floating-promises' fix
1041
- "no-void": ["error", { allowAsStatement: true }],
1042
- "unicode-bom": ["error", "never"]
352
+ //#endregion
353
+ //#region src/rules/esRules/overrides.ts
354
+ const overrides = () => ({
355
+ "class-methods-use-this": "off",
356
+ "default-case": "off",
357
+ "no-console": "error",
358
+ "no-nested-ternary": "off",
359
+ "no-param-reassign": ["error", { props: false }],
360
+ "no-underscore-dangle": "off",
361
+ "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
362
+ "no-use-before-define": ["error", "nofunc"],
363
+ "no-void": ["error", { allowAsStatement: true }],
364
+ "unicode-bom": ["error", "never"]
1043
365
  });
1044
-
1045
- // src/rules/esRules/strict.ts
1046
- var strict = () => ({
1047
- // babel inserts `'use strict';` for us
1048
- strict: ["error", "never"]
366
+ //#endregion
367
+ //#region src/rules/esRules/strict.ts
368
+ const strict = () => ({ strict: ["error", "never"] });
369
+ //#endregion
370
+ //#region src/rules/esRules/variables.ts
371
+ const variables = () => ({
372
+ "init-declarations": "off",
373
+ "no-catch-shadow": "off",
374
+ "no-delete-var": "error",
375
+ "no-label-var": "error",
376
+ "no-restricted-globals": [
377
+ "error",
378
+ {
379
+ name: "isFinite",
380
+ message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite"
381
+ },
382
+ {
383
+ name: "isNaN",
384
+ message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan"
385
+ }
386
+ ],
387
+ "no-shadow": "error",
388
+ "no-shadow-restricted-names": "error",
389
+ "no-undef": "error",
390
+ "no-undef-init": "error",
391
+ "no-undefined": "off",
392
+ "no-unused-vars": ["error", {
393
+ vars: "all",
394
+ args: "after-used",
395
+ ignoreRestSiblings: true
396
+ }],
397
+ "no-use-before-define": ["error", {
398
+ functions: true,
399
+ classes: true,
400
+ variables: true
401
+ }]
1049
402
  });
1050
-
1051
- // src/rules/esRules/variables.ts
1052
- var variables = () => ({
1053
- // enforce or disallow variable initializations at definition
1054
- "init-declarations": "off",
1055
- // disallow the catch clause parameter name being the same as a variable in the outer scope
1056
- "no-catch-shadow": "off",
1057
- // disallow deletion of variables
1058
- "no-delete-var": "error",
1059
- // disallow labels that share a name with a variable
1060
- // https://eslint.org/docs/rules/no-label-var
1061
- "no-label-var": "error",
1062
- // disallow specific globals
1063
- "no-restricted-globals": [
1064
- "error",
1065
- {
1066
- name: "isFinite",
1067
- message: "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite"
1068
- },
1069
- {
1070
- name: "isNaN",
1071
- message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan"
1072
- }
1073
- // ...confusingBrowserGlobals.map((g) => ({
1074
- // name: g,
1075
- // message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
1076
- // })),
1077
- ],
1078
- // disallow declaration of variables already declared in the outer scope
1079
- "no-shadow": "error",
1080
- // disallow shadowing of names such as arguments
1081
- "no-shadow-restricted-names": "error",
1082
- // disallow use of undeclared variables unless mentioned in a /*global */ block
1083
- "no-undef": "error",
1084
- // disallow use of undefined when initializing variables
1085
- "no-undef-init": "error",
1086
- // disallow use of undefined variable
1087
- // https://eslint.org/docs/rules/no-undefined
1088
- // TODO: enable?
1089
- "no-undefined": "off",
1090
- // disallow declaration of variables that are not used in the code
1091
- "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
1092
- // disallow use of variables before they are defined
1093
- "no-use-before-define": ["error", { functions: true, classes: true, variables: true }]
1094
- });
1095
-
1096
- // src/rules/esRules.ts
1097
- var esRules = () => ({
1098
- ...bestPractices(),
1099
- ...errors(),
1100
- ...es6(),
1101
- ...strict(),
1102
- ...variables(),
1103
- // Must be last
1104
- ...overrides()
403
+ //#endregion
404
+ //#region src/rules/esRules.ts
405
+ const esRules = () => ({
406
+ ...bestPractices(),
407
+ ...errors(),
408
+ ...es6(),
409
+ ...strict(),
410
+ ...variables(),
411
+ ...overrides()
1105
412
  });
1106
-
1107
- // src/config/es.ts
1108
- var defaultFiles = [`**/${Project.extensionsToGlob(Project.queryExtensions(["javascript", "javascriptreact"]))}`];
413
+ //#endregion
414
+ //#region src/glob.ts
415
+ const sourceGlob$1 = `**/${Project.extensionsToGlob(Project.sourceExtensions())}`;
416
+ const esSourceGlob = `**/${Project.extensionsToGlob(Project.queryExtensions(["javascript", "javascriptreact"]))}`;
417
+ const jsonSourceGlob = `**/${Project.extensionsToGlob([
418
+ ".json",
419
+ ".json5",
420
+ ".jsonc"
421
+ ])}`;
422
+ const tsSourceGlob = `**/${Project.extensionsToGlob(Project.queryExtensions(["typescript", "typescriptreact"]))}`;
423
+ const ymlSourceGlob = `**/${Project.extensionsToGlob(Project.queryExtensions(["yaml"]))}`;
424
+ //#endregion
425
+ //#region src/config/es.ts
426
+ const defaultFiles$7 = [esSourceGlob];
1109
427
  async function es(options) {
1110
- const { rules = {} } = options;
1111
- return [
1112
- {
1113
- name: "w5s/es/setup",
1114
- languageOptions: {
1115
- ecmaVersion: Project.ecmaVersion(),
1116
- globals: {
1117
- ...globals.browser,
1118
- ...globals[`es${Project.ecmaVersion()}`],
1119
- ...globals.node,
1120
- __DEV__: "readonly",
1121
- __PROD__: "readonly",
1122
- __TEST__: "readonly",
1123
- document: "readonly",
1124
- navigator: "readonly",
1125
- window: "readonly"
1126
- },
1127
- parserOptions: {
1128
- ecmaFeatures: {
1129
- jsx: true
1130
- },
1131
- ecmaVersion: Project.ecmaVersion(),
1132
- sourceType: "module"
1133
- },
1134
- sourceType: "module"
1135
- },
1136
- linterOptions: {
1137
- reportUnusedDisableDirectives: true
1138
- }
1139
- },
1140
- {
1141
- name: "w5s/es/rules",
1142
- files: defaultFiles,
1143
- rules: {
1144
- ...import_js.default.configs.recommended.rules,
1145
- ...esRules(),
1146
- ...rules
1147
- }
1148
- }
1149
- ];
428
+ const { rules = {} } = options;
429
+ return [{
430
+ name: "w5s/es/setup",
431
+ languageOptions: {
432
+ ecmaVersion: Project.ecmaVersion(),
433
+ globals: {
434
+ ...globals.browser,
435
+ ...globals[`es${Project.ecmaVersion()}`],
436
+ ...globals.node,
437
+ __DEV__: "readonly",
438
+ __PROD__: "readonly",
439
+ __TEST__: "readonly",
440
+ document: "readonly",
441
+ navigator: "readonly",
442
+ window: "readonly"
443
+ },
444
+ parserOptions: {
445
+ ecmaFeatures: { jsx: true },
446
+ ecmaVersion: Project.ecmaVersion(),
447
+ sourceType: "module"
448
+ },
449
+ sourceType: "module"
450
+ },
451
+ linterOptions: { reportUnusedDisableDirectives: true }
452
+ }, {
453
+ name: "w5s/es/rules",
454
+ files: defaultFiles$7,
455
+ rules: {
456
+ ...eslintConfig.configs.recommended.rules,
457
+ ...esRules(),
458
+ ...rules
459
+ }
460
+ }];
1150
461
  }
1151
- var getGitignore = async (cwd, prefix = "") => {
1152
- const gitIgnoreFile = await findUp(nodePath.join(prefix, ".gitignore"), { cwd });
1153
- if (gitIgnoreFile != null) {
1154
- const { patterns } = parseGitignore.parse(await fs.promises.readFile(gitIgnoreFile));
1155
- const returnValue = patterns.map((pattern) => nodePath.join(prefix, pattern));
1156
- return returnValue;
1157
- }
1158
- return [];
462
+ //#endregion
463
+ //#region src/config/ignores.ts
464
+ const getGitignore = async (cwd, prefix = "") => {
465
+ const gitIgnoreFile = await findUp(nodePath.join(prefix, ".gitignore"), { cwd });
466
+ if (gitIgnoreFile != null) {
467
+ const { patterns } = parseGitignore.parse(await fs.promises.readFile(gitIgnoreFile));
468
+ return patterns.map((pattern) => nodePath.join(prefix, pattern));
469
+ }
470
+ return [];
1159
471
  };
1160
472
  async function ignores(options = {}) {
1161
- const cwd = process.cwd();
1162
- const [ignoreRoot, ignoreAndroid, ignoreIOS] = await Promise.all([
1163
- getGitignore(cwd),
1164
- getGitignore(cwd, "android"),
1165
- getGitignore(cwd, "ios")
1166
- ]);
1167
- return [
1168
- {
1169
- ignores: [
1170
- "**/node_modules",
1171
- "**/dist",
1172
- "**/package-lock.json",
1173
- "**/yarn.lock",
1174
- "**/pnpm-lock.yaml",
1175
- "**/bun.lockb",
1176
- "**/.docusaurus",
1177
- "**/output",
1178
- "**/coverage",
1179
- "**/temp",
1180
- "**/.temp",
1181
- "**/tmp",
1182
- "**/.tmp",
1183
- "**/.history",
1184
- "**/.vitepress/cache",
1185
- "**/.nuxt",
1186
- "**/.next",
1187
- "**/.svelte-kit",
1188
- "**/.vercel",
1189
- "**/.changeset",
1190
- "**/.idea",
1191
- "**/.cache",
1192
- "**/.output",
1193
- "**/.vite-inspect",
1194
- "**/.yarn",
1195
- "**/vendor",
1196
- "**/vendors",
1197
- "**/*.min.*",
1198
- "**/*.timestamp-*.mjs",
1199
- // esbuild/vite temporary files
1200
- ".modules/",
1201
- ".go/",
1202
- ".pnpm-store/",
1203
- // '!.*',
1204
- // '.venv/',
1205
- // 'deprecated/',
1206
- // 'test-output/',
1207
- // 'venv/',
1208
- // '_generated_/',
1209
- ...ignoreRoot,
1210
- ...ignoreAndroid,
1211
- ...ignoreIOS,
1212
- ...options.ignores ?? []
1213
- ],
1214
- name: "w5s/ignore"
1215
- }
1216
- ];
473
+ const cwd = process.cwd();
474
+ const [ignoreRoot, ignoreAndroid, ignoreIOS] = await Promise.all([
475
+ getGitignore(cwd),
476
+ getGitignore(cwd, "android"),
477
+ getGitignore(cwd, "ios")
478
+ ]);
479
+ return [{
480
+ ignores: [
481
+ "**/node_modules",
482
+ "**/dist",
483
+ "**/package-lock.json",
484
+ "**/yarn.lock",
485
+ "**/pnpm-lock.yaml",
486
+ "**/bun.lockb",
487
+ "**/.docusaurus",
488
+ "**/output",
489
+ "**/coverage",
490
+ "**/temp",
491
+ "**/.temp",
492
+ "**/tmp",
493
+ "**/.tmp",
494
+ "**/.history",
495
+ "**/.vitepress/cache",
496
+ "**/.nuxt",
497
+ "**/.next",
498
+ "**/.svelte-kit",
499
+ "**/.vercel",
500
+ "**/.changeset",
501
+ "**/.idea",
502
+ "**/.cache",
503
+ "**/.output",
504
+ "**/.vite-inspect",
505
+ "**/.yarn",
506
+ "**/vendor",
507
+ "**/vendors",
508
+ "**/*.min.*",
509
+ "**/*.timestamp-*.mjs",
510
+ ".modules/",
511
+ ".go/",
512
+ ".pnpm-store/",
513
+ ...ignoreRoot,
514
+ ...ignoreAndroid,
515
+ ...ignoreIOS,
516
+ ...options.ignores ?? []
517
+ ],
518
+ name: "w5s/ignore"
519
+ }];
1217
520
  }
1218
- var defaultConfig = {
1219
- enabled: true,
1220
- indent: prettierConfig.tabWidth ?? 2,
1221
- quotes: prettierConfig.singleQuote ? "single" : "double",
1222
- jsx: true,
1223
- semi: prettierConfig.semi ?? true
521
+ //#endregion
522
+ //#region src/type/StylisticConfig.ts
523
+ const defaultConfig = {
524
+ enabled: true,
525
+ indent: prettierConfig.tabWidth ?? 2,
526
+ quotes: prettierConfig.singleQuote ? "single" : "double",
527
+ jsx: true,
528
+ semi: prettierConfig.semi ?? true
1224
529
  };
1225
- var StylisticConfig = {
1226
- /**
1227
- * Default config
1228
- */
1229
- default: defaultConfig,
1230
- /**
1231
- * Return a new StylisticConfig from input
1232
- *
1233
- * @param input
1234
- */
1235
- from(input) {
1236
- return typeof input === "boolean" ? { ...defaultConfig, enabled: input } : { ...defaultConfig, ...input };
1237
- }
530
+ /**
531
+ * @namespace
532
+ */
533
+ const StylisticConfig = {
534
+ default: defaultConfig,
535
+ from(input) {
536
+ return typeof input === "boolean" ? {
537
+ ...defaultConfig,
538
+ enabled: input
539
+ } : {
540
+ ...defaultConfig,
541
+ ...input
542
+ };
543
+ }
1238
544
  };
1239
-
1240
- // src/config/jsdoc.ts
545
+ //#endregion
546
+ //#region src/config/jsdoc.ts
547
+ const defaultFiles$6 = [sourceGlob$1];
1241
548
  async function jsdoc(options = {}) {
1242
- const [jsdocPlugin] = await Promise.all([interopDefault(import('eslint-plugin-jsdoc'))]);
1243
- const { rules = {}, stylistic: stylistic2 = true } = options;
1244
- const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic2);
1245
- return [
1246
- {
1247
- name: "w5s/jsdoc/setup",
1248
- plugins: {
1249
- jsdoc: jsdocPlugin
1250
- }
1251
- },
1252
- {
1253
- name: "w5s/jsdoc/rules",
1254
- rules: {
1255
- ...jsdocPlugin.configs["flat/recommended-typescript-flavor"].rules,
1256
- "jsdoc/no-undefined-types": "off",
1257
- // https://github.com/gajus/eslint-plugin-jsdoc/issues/839
1258
- "jsdoc/require-hyphen-before-param-description": ["warn", "always"],
1259
- "jsdoc/require-jsdoc": "off",
1260
- "jsdoc/require-param-description": "off",
1261
- "jsdoc/require-param-type": "off",
1262
- "jsdoc/require-returns": "off",
1263
- "jsdoc/valid-types": "off",
1264
- // FIXME: reports lots of false positive
1265
- // 'strict': ['error', 'safe'],
1266
- ...stylisticEnabled ? {
1267
- ...jsdocPlugin.configs["flat/stylistic-typescript"].rules,
1268
- "jsdoc/check-alignment": "warn",
1269
- "jsdoc/multiline-blocks": "warn",
1270
- "jsdoc/tag-lines": ["warn", "any", { startLines: 1 }]
1271
- } : {},
1272
- ...rules
1273
- },
1274
- settings: {
1275
- jsdoc: {
1276
- mode: "typescript"
1277
- }
1278
- }
1279
- }
1280
- ];
549
+ const [jsdocPlugin] = await Promise.all([interopDefault(import("eslint-plugin-jsdoc"))]);
550
+ const { files = defaultFiles$6, rules = {}, stylistic = true } = options;
551
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
552
+ return [{
553
+ name: "w5s/jsdoc/setup",
554
+ plugins: { jsdoc: jsdocPlugin }
555
+ }, {
556
+ name: "w5s/jsdoc/rules",
557
+ files,
558
+ rules: {
559
+ ...jsdocPlugin.configs["flat/recommended-typescript-flavor"].rules,
560
+ "jsdoc/no-undefined-types": "off",
561
+ "jsdoc/require-hyphen-before-param-description": ["warn", "always"],
562
+ "jsdoc/require-jsdoc": "off",
563
+ "jsdoc/require-param-description": "off",
564
+ "jsdoc/require-param-type": "off",
565
+ "jsdoc/require-returns": "off",
566
+ "jsdoc/valid-types": "off",
567
+ ...stylisticEnabled ? {
568
+ ...jsdocPlugin.configs["flat/stylistic-typescript"].rules,
569
+ "jsdoc/check-alignment": "warn",
570
+ "jsdoc/multiline-blocks": "warn",
571
+ "jsdoc/tag-lines": [
572
+ "warn",
573
+ "any",
574
+ { startLines: 1 }
575
+ ]
576
+ } : {},
577
+ ...rules
578
+ },
579
+ settings: { jsdoc: { mode: "typescript" } }
580
+ }];
1281
581
  }
1282
- var defaultFiles2 = [`**/${Project.extensionsToGlob([".json", ".json5", ".jsonc"])}`];
582
+ //#endregion
583
+ //#region src/config/jsonc.ts
584
+ const defaultFiles$5 = [jsonSourceGlob];
1283
585
  async function jsonc(options = {}) {
1284
- const [jsoncPlugin, jsoncParser] = await Promise.all([
1285
- interopDefault(import('eslint-plugin-jsonc')),
1286
- interopDefault(import('jsonc-eslint-parser'))
1287
- ]);
1288
- const { files = defaultFiles2, rules = {}, stylistic: stylistic2 = true } = options;
1289
- const { enabled: stylisticEnabled, indent } = StylisticConfig.from(stylistic2);
1290
- return [
1291
- {
1292
- name: "w5s/jsonc/setup",
1293
- plugins: {
1294
- jsonc: jsoncPlugin
1295
- }
1296
- },
1297
- {
1298
- files,
1299
- languageOptions: {
1300
- parser: jsoncParser
1301
- },
1302
- name: "w5s/jsonc/rules",
1303
- rules: {
1304
- ...jsoncPlugin.configs["flat/recommended-with-json"][0]?.rules,
1305
- ...stylisticEnabled ? {
1306
- "jsonc/array-bracket-spacing": ["error", "never"],
1307
- "jsonc/comma-dangle": ["error", "never"],
1308
- "jsonc/comma-style": ["error", "last"],
1309
- "jsonc/indent": ["error", indent],
1310
- "jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1311
- "jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
1312
- "jsonc/object-curly-spacing": ["error", "always"],
1313
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
1314
- "jsonc/quote-props": "error",
1315
- "jsonc/quotes": "error"
1316
- } : {},
1317
- ...rules
1318
- }
1319
- },
1320
- stylisticEnabled ? sortPackageJson() : {},
1321
- stylisticEnabled ? sortTsconfigJson() : {}
1322
- ];
586
+ const [jsoncPlugin, jsoncParser] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
587
+ const { files = defaultFiles$5, rules = {}, stylistic = true } = options;
588
+ const { enabled: stylisticEnabled, indent } = StylisticConfig.from(stylistic);
589
+ return [
590
+ {
591
+ name: "w5s/jsonc/setup",
592
+ plugins: { jsonc: jsoncPlugin }
593
+ },
594
+ {
595
+ files,
596
+ languageOptions: { parser: jsoncParser },
597
+ name: "w5s/jsonc/rules",
598
+ rules: {
599
+ ...jsoncPlugin.configs["flat/recommended-with-json"][0]?.rules,
600
+ ...stylisticEnabled ? {
601
+ "jsonc/array-bracket-spacing": ["error", "never"],
602
+ "jsonc/comma-dangle": ["error", "never"],
603
+ "jsonc/comma-style": ["error", "last"],
604
+ "jsonc/indent": ["error", indent],
605
+ "jsonc/key-spacing": ["error", {
606
+ afterColon: true,
607
+ beforeColon: false
608
+ }],
609
+ "jsonc/object-curly-newline": ["error", {
610
+ consistent: true,
611
+ multiline: true
612
+ }],
613
+ "jsonc/object-curly-spacing": ["error", "always"],
614
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
615
+ "jsonc/quote-props": "error",
616
+ "jsonc/quotes": "error"
617
+ } : {},
618
+ ...rules
619
+ }
620
+ },
621
+ stylisticEnabled ? sortPackageJson() : {},
622
+ stylisticEnabled ? sortTsconfigJson() : {}
623
+ ];
1323
624
  }
1324
625
  function sortTsconfigJson() {
1325
- return {
1326
- files: ["tsconfig*.json"],
1327
- rules: {
1328
- "jsonc/sort-keys": [
1329
- "error",
1330
- {
1331
- order: ["$schema", "display", "extends", "compilerOptions", "include", "exclude", "files", "references"],
1332
- pathPattern: "^$"
1333
- },
1334
- {
1335
- order: { type: "asc" },
1336
- pathPattern: ".*"
1337
- }
1338
- ]
1339
- }
1340
- };
626
+ return {
627
+ files: ["tsconfig*.json"],
628
+ rules: { "jsonc/sort-keys": [
629
+ "error",
630
+ {
631
+ order: [
632
+ "$schema",
633
+ "display",
634
+ "extends",
635
+ "compilerOptions",
636
+ "include",
637
+ "exclude",
638
+ "files",
639
+ "references"
640
+ ],
641
+ pathPattern: "^$"
642
+ },
643
+ {
644
+ order: { type: "asc" },
645
+ pathPattern: ".*"
646
+ }
647
+ ] }
648
+ };
1341
649
  }
1342
650
  function sortPackageJson() {
1343
- return {
1344
- files: ["package.json"],
1345
- rules: {
1346
- "jsonc/sort-keys": [
1347
- "error",
1348
- {
1349
- order: [
1350
- "$schema",
1351
- "name",
1352
- "displayName",
1353
- "version",
1354
- "private",
1355
- "description",
1356
- "categories",
1357
- "keywords",
1358
- "homepage",
1359
- "bugs",
1360
- "repository",
1361
- "funding",
1362
- "license",
1363
- "qna",
1364
- "author",
1365
- "maintainers",
1366
- // Key order (per item): name, email, url
1367
- "contributors",
1368
- // Key order (per item): name, email, url
1369
- "publisher",
1370
- "sideEffects",
1371
- "type",
1372
- "imports",
1373
- "exports",
1374
- "main",
1375
- "svelte",
1376
- "umd:main",
1377
- "jsdelivr",
1378
- "unpkg",
1379
- "module",
1380
- "source",
1381
- "jsnext:main",
1382
- "browser",
1383
- "react-native",
1384
- "types",
1385
- "typesVersions",
1386
- "typings",
1387
- "style",
1388
- "example",
1389
- "examplestyle",
1390
- "assets",
1391
- "bin",
1392
- "man",
1393
- "directories",
1394
- // Key order: lib, bin, man, doc, example, test
1395
- "files",
1396
- // Unique items
1397
- "workspaces",
1398
- "binary",
1399
- // Key order: module_name, module_path, remote_path, package_name, host
1400
- "scripts",
1401
- // Script sort
1402
- "betterScripts",
1403
- // Script sort
1404
- "contributes",
1405
- "activationEvents",
1406
- // Unique items
1407
- "husky",
1408
- // Sorts the hooks field using git hook sort
1409
- "simple-git-hooks",
1410
- // Key sort using git hook sort
1411
- "pre-commit",
1412
- "commitlint",
1413
- "lint-staged",
1414
- "config",
1415
- "nodemonConfig",
1416
- "browserify",
1417
- "babel",
1418
- "browserslist",
1419
- "xo",
1420
- "prettier",
1421
- // Prettier sort
1422
- "eslintConfig",
1423
- // ESLint sort
1424
- "eslintIgnore",
1425
- "npmpackagejsonlint",
1426
- // Key sort (also recognizes: npmPackageJsonLintConfig, npmpkgjsonlint)
1427
- "release",
1428
- "remarkConfig",
1429
- "stylelint",
1430
- "ava",
1431
- "jest",
1432
- "mocha",
1433
- "nyc",
1434
- "tap",
1435
- "resolutions",
1436
- "dependencies",
1437
- "devDependencies",
1438
- "dependenciesMeta",
1439
- // Key sort (deep)
1440
- "peerDependencies",
1441
- "peerDependenciesMeta",
1442
- // Key sort (deep)
1443
- "optionalDependencies",
1444
- "bundledDependencies",
1445
- "bundleDependencies",
1446
- "extensionPack",
1447
- "extensionDependencies",
1448
- "flat",
1449
- "packageManager",
1450
- "engines",
1451
- "engineStrict",
1452
- "volta",
1453
- // Key order: node, npm, yarn
1454
- "languageName",
1455
- "os",
1456
- "cpu",
1457
- "preferGlobal",
1458
- "publishConfig",
1459
- "icon",
1460
- "badges",
1461
- // Key order (per item): description, url, href
1462
- "galleryBanner",
1463
- "preview",
1464
- "markdown"
1465
- ],
1466
- pathPattern: "^$"
1467
- },
1468
- {
1469
- order: ["url", "email"],
1470
- pathPattern: `^bugs$`
1471
- },
1472
- ...["repository", "funding", "license", "author"].map((key) => ({
1473
- order: ["type", "name", "email", "url"],
1474
- pathPattern: `^${key}$`
1475
- })),
1476
- ...["scripts", "betterScripts"].map((key) => ({
1477
- order: { type: "asc" },
1478
- pathPattern: `^${key}$`
1479
- })),
1480
- ...[
1481
- "bin",
1482
- "contributes",
1483
- "commitlint",
1484
- "config",
1485
- "nodemonConfig",
1486
- "browserify",
1487
- "babel",
1488
- "xo",
1489
- "release",
1490
- "remarkConfig",
1491
- "ava",
1492
- "jest",
1493
- "mocha",
1494
- "nyc",
1495
- "tap",
1496
- "resolutions",
1497
- "engines",
1498
- "engineStrict",
1499
- "preferGlobal",
1500
- "publishConfig",
1501
- "galleryBanner"
1502
- ].map((key) => ({
1503
- order: { type: "asc" },
1504
- pathPattern: `^${key}$`
1505
- })),
1506
- {
1507
- order: { type: "asc" },
1508
- pathPattern: "^(?:dev|peer|optional|bundled|extension)?[Dd]ependencies$"
1509
- },
1510
- {
1511
- order: ["types", "require", "import"],
1512
- pathPattern: "^exports.*$"
1513
- }
1514
- ]
1515
- }
1516
- };
651
+ return {
652
+ files: ["package.json"],
653
+ rules: { "jsonc/sort-keys": [
654
+ "error",
655
+ {
656
+ order: [
657
+ "$schema",
658
+ "name",
659
+ "displayName",
660
+ "version",
661
+ "private",
662
+ "description",
663
+ "categories",
664
+ "keywords",
665
+ "homepage",
666
+ "bugs",
667
+ "repository",
668
+ "funding",
669
+ "license",
670
+ "qna",
671
+ "author",
672
+ "maintainers",
673
+ "contributors",
674
+ "publisher",
675
+ "sideEffects",
676
+ "type",
677
+ "imports",
678
+ "exports",
679
+ "main",
680
+ "svelte",
681
+ "umd:main",
682
+ "jsdelivr",
683
+ "unpkg",
684
+ "module",
685
+ "source",
686
+ "jsnext:main",
687
+ "browser",
688
+ "react-native",
689
+ "types",
690
+ "typesVersions",
691
+ "typings",
692
+ "style",
693
+ "example",
694
+ "examplestyle",
695
+ "assets",
696
+ "bin",
697
+ "man",
698
+ "directories",
699
+ "files",
700
+ "workspaces",
701
+ "binary",
702
+ "scripts",
703
+ "betterScripts",
704
+ "contributes",
705
+ "activationEvents",
706
+ "husky",
707
+ "simple-git-hooks",
708
+ "pre-commit",
709
+ "commitlint",
710
+ "lint-staged",
711
+ "config",
712
+ "nodemonConfig",
713
+ "browserify",
714
+ "babel",
715
+ "browserslist",
716
+ "xo",
717
+ "prettier",
718
+ "eslintConfig",
719
+ "eslintIgnore",
720
+ "npmpackagejsonlint",
721
+ "release",
722
+ "remarkConfig",
723
+ "stylelint",
724
+ "ava",
725
+ "jest",
726
+ "mocha",
727
+ "nyc",
728
+ "tap",
729
+ "resolutions",
730
+ "dependencies",
731
+ "devDependencies",
732
+ "dependenciesMeta",
733
+ "peerDependencies",
734
+ "peerDependenciesMeta",
735
+ "optionalDependencies",
736
+ "bundledDependencies",
737
+ "bundleDependencies",
738
+ "extensionPack",
739
+ "extensionDependencies",
740
+ "flat",
741
+ "packageManager",
742
+ "engines",
743
+ "engineStrict",
744
+ "volta",
745
+ "languageName",
746
+ "os",
747
+ "cpu",
748
+ "preferGlobal",
749
+ "publishConfig",
750
+ "icon",
751
+ "badges",
752
+ "galleryBanner",
753
+ "preview",
754
+ "markdown"
755
+ ],
756
+ pathPattern: "^$"
757
+ },
758
+ {
759
+ order: ["url", "email"],
760
+ pathPattern: `^bugs$`
761
+ },
762
+ ...[
763
+ "repository",
764
+ "funding",
765
+ "license",
766
+ "author"
767
+ ].map((key) => ({
768
+ order: [
769
+ "type",
770
+ "name",
771
+ "email",
772
+ "url"
773
+ ],
774
+ pathPattern: `^${key}$`
775
+ })),
776
+ ...["scripts", "betterScripts"].map((key) => ({
777
+ order: { type: "asc" },
778
+ pathPattern: `^${key}$`
779
+ })),
780
+ ...[
781
+ "bin",
782
+ "contributes",
783
+ "commitlint",
784
+ "config",
785
+ "nodemonConfig",
786
+ "browserify",
787
+ "babel",
788
+ "xo",
789
+ "release",
790
+ "remarkConfig",
791
+ "ava",
792
+ "jest",
793
+ "mocha",
794
+ "nyc",
795
+ "tap",
796
+ "resolutions",
797
+ "engines",
798
+ "engineStrict",
799
+ "preferGlobal",
800
+ "publishConfig",
801
+ "galleryBanner"
802
+ ].map((key) => ({
803
+ order: { type: "asc" },
804
+ pathPattern: `^${key}$`
805
+ })),
806
+ {
807
+ order: { type: "asc" },
808
+ pathPattern: "^(?:dev|peer|optional|bundled|extension)?[Dd]ependencies$"
809
+ },
810
+ {
811
+ order: [
812
+ "types",
813
+ "require",
814
+ "import"
815
+ ],
816
+ pathPattern: "^exports.*$"
817
+ }
818
+ ] }
819
+ };
1517
820
  }
821
+ //#endregion
822
+ //#region src/config/imports.ts
1518
823
  async function imports(options = {}) {
1519
- const { rules = {}, stylistic: stylistic2 = true } = options;
1520
- const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic2);
1521
- const [importPlugin] = await Promise.all([interopDefault(import('eslint-plugin-import'))]);
1522
- return [
1523
- {
1524
- name: "w5s/import/rules",
1525
- plugins: {
1526
- import: importPlugin
1527
- },
1528
- rules: {
1529
- // 'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
1530
- "import/first": "error",
1531
- "import/no-duplicates": "error",
1532
- "import/no-mutable-exports": "error",
1533
- "import/no-named-default": "error",
1534
- ...stylisticEnabled ? {
1535
- // Stylistic rules
1536
- "import/newline-after-import": ["error", { count: 1 }]
1537
- } : {},
1538
- ...rules
1539
- }
1540
- }
1541
- ];
824
+ const { rules = {}, stylistic = true } = options;
825
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
826
+ const [importPlugin] = await Promise.all([interopDefault(import("eslint-plugin-import"))]);
827
+ return [{
828
+ name: "w5s/import/rules",
829
+ plugins: { import: importPlugin },
830
+ rules: {
831
+ "import/first": "error",
832
+ "import/no-duplicates": "error",
833
+ "import/no-mutable-exports": "error",
834
+ "import/no-named-default": "error",
835
+ ...stylisticEnabled ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
836
+ ...rules
837
+ }
838
+ }];
839
+ }
840
+ //#endregion
841
+ //#region src/config/markdown.ts
842
+ const defaultFiles$4 = [`**/${Project.extensionsToGlob(Project.queryExtensions(["markdown"]))}`];
843
+ async function markdown(options = {}) {
844
+ const [markdownPlugin] = await Promise.all([interopDefault(import("@eslint/markdown"))]);
845
+ const { language = "markdown/gfm", files = defaultFiles$4, rules = {}, stylistic = true } = options;
846
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
847
+ return [{
848
+ name: "w5s/markdown/setup",
849
+ plugins: { markdown: markdownPlugin }
850
+ }, {
851
+ files,
852
+ language,
853
+ name: "w5s/markdown/rules",
854
+ processor: mergeProcessors([markdownPlugin.processors.markdown, processorPassThrough]),
855
+ rules: {
856
+ ...markdownPlugin.configs.recommended.at(0)?.rules,
857
+ ...stylisticEnabled ? {} : {},
858
+ ...rules
859
+ }
860
+ }];
1542
861
  }
862
+ //#endregion
863
+ //#region src/config/node.ts
1543
864
  async function node(options = {}) {
1544
- const [nodePlugin] = await Promise.all([
1545
- interopDefault(import('eslint-plugin-n'))
1546
- ]);
1547
- const { rules = {} } = options;
1548
- return [
1549
- {
1550
- name: "w5s/node/setup",
1551
- plugins: {
1552
- node: nodePlugin
1553
- }
1554
- },
1555
- {
1556
- name: "w5s/node/rules",
1557
- rules: {
1558
- // 'node/handle-callback-err': ['error', '^(err|error|_error)$'],
1559
- "node/no-deprecated-api": "error",
1560
- "node/no-exports-assign": "error",
1561
- "node/no-new-require": "error",
1562
- "node/no-path-concat": "error",
1563
- "node/no-sync": "error",
1564
- "node/prefer-global/buffer": ["error", "never"],
1565
- "node/prefer-global/console": ["error", "always"],
1566
- // 'node/prefer-global/process': ['error', 'never'],
1567
- "node/prefer-global/url": ["error", "always"],
1568
- "node/prefer-global/url-search-params": ["error", "always"],
1569
- "node/process-exit-as-throw": "error",
1570
- ...rules
1571
- }
1572
- }
1573
- ];
865
+ const [nodePlugin] = await Promise.all([interopDefault(import("eslint-plugin-n"))]);
866
+ const { rules = {} } = options;
867
+ return [{
868
+ name: "w5s/node/setup",
869
+ plugins: { node: nodePlugin }
870
+ }, {
871
+ name: "w5s/node/rules",
872
+ rules: {
873
+ "node/no-deprecated-api": "error",
874
+ "node/no-exports-assign": "error",
875
+ "node/no-new-require": "error",
876
+ "node/no-path-concat": "error",
877
+ "node/no-sync": "error",
878
+ "node/prefer-global/buffer": ["error", "never"],
879
+ "node/prefer-global/console": ["error", "always"],
880
+ "node/prefer-global/url": ["error", "always"],
881
+ "node/prefer-global/url-search-params": ["error", "always"],
882
+ "node/process-exit-as-throw": "error",
883
+ ...rules
884
+ }
885
+ }];
1574
886
  }
887
+ //#endregion
888
+ //#region src/config/stylistic.ts
1575
889
  async function stylistic(options = {}) {
1576
- const [stylisticPlugin] = await Promise.all([
1577
- interopDefault(import('@stylistic/eslint-plugin'))
1578
- ]);
1579
- const { rules = {} } = options;
1580
- const { enabled: stylisticEnabled, indent, jsx, quotes, semi } = StylisticConfig.from(options);
1581
- const config = stylisticEnabled ? stylisticPlugin.configs.customize({
1582
- indent,
1583
- jsx,
1584
- pluginName: "style",
1585
- quotes,
1586
- semi
1587
- }) : { rules: {} };
1588
- return [
1589
- {
1590
- name: "w5s/style/setup",
1591
- plugins: {
1592
- style: stylisticPlugin
1593
- }
1594
- },
1595
- {
1596
- name: "w5s/style/rules",
1597
- rules: {
1598
- ...stylisticEnabled ? {
1599
- ...config.rules,
1600
- "style/arrow-parens": ["error", "always"],
1601
- "style/brace-style": ["error", "1tbs"],
1602
- "style/operator-linebreak": ["error", "after", { overrides: { ":": "before", "?": "before", "|>": "before", "|": "before" } }],
1603
- "style/quotes": ["error", quotes ?? StylisticConfig.default.quotes, { avoidEscape: true, allowTemplateLiterals: "always" }]
1604
- } : {},
1605
- ...rules
1606
- }
1607
- }
1608
- ];
890
+ const [stylisticPlugin] = await Promise.all([interopDefault(import("@stylistic/eslint-plugin"))]);
891
+ const { rules = {} } = options;
892
+ const { enabled: stylisticEnabled, indent, jsx, quotes, semi } = StylisticConfig.from(options);
893
+ const config = stylisticEnabled ? stylisticPlugin.configs.customize({
894
+ indent,
895
+ jsx,
896
+ pluginName: "style",
897
+ quotes,
898
+ semi
899
+ }) : { rules: {} };
900
+ return [{
901
+ name: "w5s/style/setup",
902
+ plugins: { style: stylisticPlugin }
903
+ }, {
904
+ name: "w5s/style/rules",
905
+ rules: {
906
+ ...stylisticEnabled ? {
907
+ ...config.rules,
908
+ "style/arrow-parens": ["error", "always"],
909
+ "style/brace-style": ["error", "1tbs"],
910
+ "style/operator-linebreak": [
911
+ "error",
912
+ "after",
913
+ { overrides: {
914
+ ":": "before",
915
+ "?": "before",
916
+ "|>": "before",
917
+ "|": "before"
918
+ } }
919
+ ],
920
+ "style/quotes": [
921
+ "error",
922
+ quotes ?? StylisticConfig.default.quotes,
923
+ {
924
+ avoidEscape: true,
925
+ allowTemplateLiterals: "always"
926
+ }
927
+ ]
928
+ } : {},
929
+ ...rules
930
+ }
931
+ }];
1609
932
  }
1610
- var sourceGlob = Project.extensionsToGlob(Project.sourceExtensions());
1611
- var defaultFiles3 = [
1612
- `**/__mocks__/**/${sourceGlob}`,
1613
- `**/__tests__/**/${sourceGlob}`,
1614
- `**/?(*.)+(spec|test)${sourceGlob.slice(1)}`
933
+ //#endregion
934
+ //#region src/config/test.ts
935
+ const sourceGlob = Project.extensionsToGlob(Project.sourceExtensions());
936
+ const defaultFiles$3 = [
937
+ `**/__mocks__/**/${sourceGlob}`,
938
+ `**/__tests__/**/${sourceGlob}`,
939
+ `**/?(*.)+(spec|test)${sourceGlob.slice(1)}`
1615
940
  ];
1616
941
  async function test(options = {}) {
1617
- const [vitestPlugin] = await Promise.all([
1618
- interopDefault(import('@vitest/eslint-plugin'))
1619
- ]);
1620
- const { files = defaultFiles3, rules = {}, stylistic: stylistic2 = true } = options;
1621
- const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic2);
1622
- return [
1623
- {
1624
- name: "w5s/test/setup",
1625
- plugins: {
1626
- test: vitestPlugin
1627
- }
1628
- },
1629
- {
1630
- files,
1631
- name: "w5s/test/rules",
1632
- rules: {
1633
- ...vitestPlugin.configs.recommended.rules,
1634
- ...stylisticEnabled ? {} : {},
1635
- ...rules
1636
- }
1637
- }
1638
- ];
942
+ const [vitestPlugin] = await Promise.all([interopDefault(import("@vitest/eslint-plugin"))]);
943
+ const { files = defaultFiles$3, rules = {}, stylistic = true } = options;
944
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
945
+ return [{
946
+ name: "w5s/test/setup",
947
+ plugins: { test: vitestPlugin }
948
+ }, {
949
+ files,
950
+ name: "w5s/test/rules",
951
+ rules: {
952
+ ...vitestPlugin.configs.recommended.rules,
953
+ ...stylisticEnabled ? {} : {},
954
+ ...rules
955
+ }
956
+ }];
1639
957
  }
1640
- var tsRules = () => {
1641
- const baseRules = esRules();
1642
- return ESLintConfig.renameRules(
1643
- {
1644
- // '@typescript-eslint/comma-dangle': [
1645
- // baseRules['comma-dangle'][0],
1646
- // {
1647
- // ...baseRules['comma-dangle'][1],
1648
- // enums: baseRules['comma-dangle'][1].arrays,
1649
- // generics: baseRules['comma-dangle'][1].arrays,
1650
- // tuples: baseRules['comma-dangle'][1].arrays,
1651
- // },
1652
- // ],
1653
- "@typescript-eslint/adjacent-overload-signatures": "error",
1654
- "@typescript-eslint/ban-ts-comment": [
1655
- "warn",
1656
- {
1657
- "minimumDescriptionLength": 3,
1658
- "ts-check": false,
1659
- "ts-expect-error": "allow-with-description",
1660
- "ts-ignore": "allow-with-description",
1661
- "ts-nocheck": true
1662
- }
1663
- ],
1664
- // '@typescript-eslint/brace-style': baseRules['brace-style'],
1665
- // '@typescript-eslint/comma-dangle': [
1666
- // baseRules['comma-dangle'][0],
1667
- // {
1668
- // ...baseRules['comma-dangle'][1],
1669
- // enums: baseRules['comma-dangle'][1].arrays,
1670
- // generics: baseRules['comma-dangle'][1].arrays,
1671
- // tuples: baseRules['comma-dangle'][1].arrays,
1672
- // },
1673
- // ],
1674
- // '@typescript-eslint/comma-spacing': baseRules['comma-spacing'],
1675
- "@typescript-eslint/consistent-type-assertions": [
1676
- "error",
1677
- { assertionStyle: "as", objectLiteralTypeAssertions: "never" }
1678
- ],
1679
- "@typescript-eslint/default-param-last": baseRules["default-param-last"],
1680
- // '@typescript-eslint/dot-notation': baseRules['dot-notation'], // TODO: Stylistic typechecked
1681
- "@typescript-eslint/explicit-function-return-type": "off",
1682
- "@typescript-eslint/explicit-module-boundary-types": "off",
1683
- // '@typescript-eslint/func-call-spacing': baseRules['func-call-spacing'],
1684
- // '@typescript-eslint/indent': baseRules.indent,
1685
- // '@typescript-eslint/keyword-spacing': baseRules['keyword-spacing'],
1686
- // '@typescript-eslint/lines-between-class-members': baseRules['lines-between-class-members'],
1687
- // '@typescript-eslint/member-delimiter-style': 'error', // TODO: @stylistic/member-delimiter-style
1688
- "@typescript-eslint/naming-convention": [
1689
- "error",
1690
- // {
1691
- // format: ['PascalCase', 'camelCase'],
1692
- // leadingUnderscore: 'allow',
1693
- // selector: 'default',
1694
- // trailingUnderscore: 'allow',
1695
- // },
1696
- {
1697
- format: ["PascalCase", "camelCase", "UPPER_CASE"],
1698
- leadingUnderscore: "allow",
1699
- selector: "variable",
1700
- trailingUnderscore: "allow"
1701
- },
1702
- // {
1703
- // format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
1704
- // leadingUnderscore: 'allowSingleOrDouble',
1705
- // selector: 'memberLike',
1706
- // trailingUnderscore: 'allowDouble',
1707
- // },
1708
- {
1709
- format: ["PascalCase"],
1710
- selector: "typeLike"
1711
- }
1712
- ],
1713
- // '@typescript-eslint/no-array-constructor': baseRules['no-array-constructor'],
1714
- // '@typescript-eslint/no-base-to-string': 'error', // TODO: require type check
1715
- "@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
1716
- "@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
1717
- "@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
1718
- "@typescript-eslint/no-empty-object-type": "off",
1719
- "@typescript-eslint/no-explicit-any": "off",
1720
- // if any is explicit then it's wanted
1721
- "@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
1722
- // '@typescript-eslint/no-extra-semi': baseRules['no-extra-semi'], // TODO: @stylistic/no-extra-semi
1723
- "@typescript-eslint/no-inferrable-types": "error",
1724
- "@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
1725
- "@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
1726
- "@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
1727
- "@typescript-eslint/no-misused-new": "error",
1728
- "@typescript-eslint/no-namespace": "off",
1729
- // We don't agree with community, namespaces are great and not deprecated
1730
- "@typescript-eslint/no-non-null-assertion": "error",
1731
- "@typescript-eslint/no-redeclare": ESLintConfig.fixme(baseRules["no-redeclare"]),
1732
- "@typescript-eslint/no-require-imports": "error",
1733
- "@typescript-eslint/no-shadow": baseRules["no-shadow"],
1734
- "@typescript-eslint/no-this-alias": "error",
1735
- // '@typescript-eslint/no-unnecessary-condition': 'error',// TODO: require type check
1736
- // '@typescript-eslint/no-unsafe-argument': 'error', // TODO: recommended type check
1737
- "@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
1738
- "@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
1739
- "@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
1740
- "@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
1741
- "@typescript-eslint/no-var-requires": "error",
1742
- "@typescript-eslint/no-wrapper-object-types": "error",
1743
- // '@typescript-eslint/object-curly-spacing': baseRules['object-curly-spacing'],
1744
- // '@typescript-eslint/only-throw-error': baseRules['no-throw-literal'], //TODO: Recommended type check
1745
- "@typescript-eslint/prefer-namespace-keyword": "error",
1746
- // '@typescript-eslint/prefer-reduce-type-parameter': 'error', // TODO: strict type check
1747
- // '@typescript-eslint/quotes': baseRules.quotes,
1748
- "@typescript-eslint/require-await": baseRules["require-await"],
1749
- // '@typescript-eslint/return-await': baseRules['no-return-await'], // TODO: strict type check
1750
- // '@typescript-eslint/semi': baseRules.semi,
1751
- // '@typescript-eslint/space-before-function-paren': baseRules['space-before-function-paren'],
1752
- // '@typescript-eslint/space-infix-ops': baseRules['space-infix-ops'],
1753
- // '@typescript-eslint/strict-boolean-expressions': [
1754
- // 'error',
1755
- // {
1756
- // allowNullableObject: false,
1757
- // allowNumber: false,
1758
- // allowString: false,
1759
- // },
1760
- // ], //TODO: require typing
1761
- // '@typescript-eslint/switch-exhaustiveness-check': 'error',//TODO: require type check
1762
- "@typescript-eslint/triple-slash-reference": "error"
1763
- // '@typescript-eslint/type-annotation-spacing': 'error',// TODO: @stylistic/type-annotation-spacing
1764
- },
1765
- {
1766
- "@typescript-eslint": "ts"
1767
- }
1768
- );
958
+ //#endregion
959
+ //#region src/rules/tsRules.ts
960
+ const tsRules = () => {
961
+ const baseRules = esRules();
962
+ return ESLintConfig.renameRules({
963
+ "@typescript-eslint/adjacent-overload-signatures": "error",
964
+ "@typescript-eslint/ban-ts-comment": ["warn", {
965
+ "minimumDescriptionLength": 3,
966
+ "ts-check": false,
967
+ "ts-expect-error": "allow-with-description",
968
+ "ts-ignore": "allow-with-description",
969
+ "ts-nocheck": true
970
+ }],
971
+ "@typescript-eslint/consistent-type-assertions": ["error", {
972
+ assertionStyle: "as",
973
+ objectLiteralTypeAssertions: "never"
974
+ }],
975
+ "@typescript-eslint/default-param-last": baseRules["default-param-last"],
976
+ "@typescript-eslint/explicit-function-return-type": "off",
977
+ "@typescript-eslint/explicit-module-boundary-types": "off",
978
+ "@typescript-eslint/naming-convention": [
979
+ "error",
980
+ {
981
+ format: [
982
+ "PascalCase",
983
+ "camelCase",
984
+ "UPPER_CASE"
985
+ ],
986
+ leadingUnderscore: "allow",
987
+ selector: "variable",
988
+ trailingUnderscore: "allow"
989
+ },
990
+ {
991
+ format: ["PascalCase"],
992
+ selector: "typeLike"
993
+ }
994
+ ],
995
+ "@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
996
+ "@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
997
+ "@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: true }],
998
+ "@typescript-eslint/no-empty-object-type": "off",
999
+ "@typescript-eslint/no-explicit-any": "off",
1000
+ "@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
1001
+ "@typescript-eslint/no-inferrable-types": "error",
1002
+ "@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
1003
+ "@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
1004
+ "@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
1005
+ "@typescript-eslint/no-misused-new": "error",
1006
+ "@typescript-eslint/no-namespace": "off",
1007
+ "@typescript-eslint/no-non-null-assertion": "error",
1008
+ "@typescript-eslint/no-redeclare": ESLintConfig.fixme(baseRules["no-redeclare"]),
1009
+ "@typescript-eslint/no-require-imports": "error",
1010
+ "@typescript-eslint/no-shadow": baseRules["no-shadow"],
1011
+ "@typescript-eslint/no-this-alias": "error",
1012
+ "@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
1013
+ "@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
1014
+ "@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
1015
+ "@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
1016
+ "@typescript-eslint/no-var-requires": "error",
1017
+ "@typescript-eslint/no-wrapper-object-types": "error",
1018
+ "@typescript-eslint/prefer-namespace-keyword": "error",
1019
+ "@typescript-eslint/require-await": baseRules["require-await"],
1020
+ "@typescript-eslint/triple-slash-reference": "error"
1021
+ }, { "@typescript-eslint": "ts" });
1769
1022
  };
1770
-
1771
- // src/config/ts.ts
1772
- var defaultFiles4 = [`**/${Project.extensionsToGlob(Project.queryExtensions(["typescript", "typescriptreact"]))}`];
1023
+ //#endregion
1024
+ //#region src/config/ts.ts
1025
+ const defaultFiles$2 = [tsSourceGlob];
1773
1026
  async function ts(options = {}) {
1774
- const [tsPlugin, tsParser] = await Promise.all([
1775
- interopDefault(import('@typescript-eslint/eslint-plugin')),
1776
- interopDefault(import('@typescript-eslint/parser'))
1777
- ]);
1778
- const tsRecommendedRules = tsPlugin.configs["eslint-recommended"].overrides[0].rules;
1779
- const tsStrictRules = tsPlugin.configs["strict"].rules;
1780
- const tsTypeCheckedRules = tsPlugin.configs["recommended-type-checked-only"].rules;
1781
- const { files = defaultFiles4, rules = {}, stylistic: stylistic2 = true, typeChecked = false } = options;
1782
- const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic2);
1783
- return [
1784
- {
1785
- name: "w5s/ts/setup",
1786
- plugins: {
1787
- ts: tsPlugin
1788
- }
1789
- },
1790
- {
1791
- files,
1792
- languageOptions: {
1793
- parser: tsParser,
1794
- parserOptions: {
1795
- sourceType: "module"
1796
- // extraFileExtensions: componentExts.map(ext => `.${ext}`),
1797
- // ...typeAware
1798
- // ? {
1799
- // projectService: {
1800
- // allowDefaultProject: ['./*.js'],
1801
- // defaultProject: tsconfigPath,
1802
- // },
1803
- // tsconfigRootDir: process.cwd(),
1804
- // }
1805
- // : {},
1806
- // ...parserOptions as any,
1807
- }
1808
- },
1809
- name: "w5s/ts/rules",
1810
- rules: {
1811
- ...ESLintConfig.renameRules(tsRecommendedRules, { "@typescript-eslint": "ts" }),
1812
- ...ESLintConfig.renameRules(tsStrictRules, { "@typescript-eslint": "ts" }),
1813
- ...tsRules(),
1814
- ...stylisticEnabled ? {} : {},
1815
- ...rules
1816
- }
1817
- },
1818
- ...typeChecked ? [
1819
- {
1820
- files: defaultFiles4,
1821
- // ignores: ignoresTypeAware,
1822
- name: "w5s/ts/rules-type-checked",
1823
- rules: {
1824
- ...ESLintConfig.renameRules(tsTypeCheckedRules, { "@typescript-eslint": "ts" })
1825
- }
1826
- }
1827
- ] : []
1828
- ];
1027
+ const [tsPlugin, tsParser] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
1028
+ const tsRecommendedRules = tsPlugin.configs["eslint-recommended"].overrides[0].rules;
1029
+ const tsStrictRules = tsPlugin.configs["strict"].rules;
1030
+ const tsTypeCheckedRules = tsPlugin.configs["recommended-type-checked-only"].rules;
1031
+ const { files = defaultFiles$2, rules = {}, stylistic = true, typeChecked = false } = options;
1032
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
1033
+ return [
1034
+ {
1035
+ name: "w5s/ts/setup",
1036
+ plugins: { ts: tsPlugin }
1037
+ },
1038
+ {
1039
+ files,
1040
+ languageOptions: {
1041
+ parser: tsParser,
1042
+ parserOptions: { sourceType: "module" }
1043
+ },
1044
+ name: "w5s/ts/rules",
1045
+ rules: {
1046
+ ...ESLintConfig.renameRules(tsRecommendedRules, { "@typescript-eslint": "ts" }),
1047
+ ...ESLintConfig.renameRules(tsStrictRules, { "@typescript-eslint": "ts" }),
1048
+ ...tsRules(),
1049
+ ...stylisticEnabled ? {} : {},
1050
+ ...rules
1051
+ }
1052
+ },
1053
+ ...typeChecked ? [{
1054
+ files: defaultFiles$2,
1055
+ name: "w5s/ts/rules-type-checked",
1056
+ rules: { ...ESLintConfig.renameRules(tsTypeCheckedRules, { "@typescript-eslint": "ts" }) }
1057
+ }] : []
1058
+ ];
1829
1059
  }
1060
+ //#endregion
1061
+ //#region src/config/unicorn.ts
1062
+ const defaultFiles$1 = [sourceGlob$1];
1830
1063
  async function unicorn(options = {}) {
1831
- const [unicornPlugin] = await Promise.all([
1832
- interopDefault(import('eslint-plugin-unicorn'))
1833
- ]);
1834
- const { rules = {}, stylistic: stylistic2 = true } = options;
1835
- const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic2);
1836
- return [
1837
- {
1838
- name: "w5s/unicorn/setup",
1839
- plugins: {
1840
- unicorn: unicornPlugin
1841
- }
1842
- },
1843
- {
1844
- name: "w5s/unicorn/rules",
1845
- rules: {
1846
- ...unicornPlugin.configs.recommended?.rules,
1847
- // Disabled for safety
1848
- "unicorn/consistent-destructuring": "off",
1849
- "unicorn/consistent-function-scoping": "off",
1850
- // Too many false positive
1851
- "unicorn/filename-case": "off",
1852
- "unicorn/import-index": "off",
1853
- // Not playing well with ES Module
1854
- "unicorn/new-for-builtins": "off",
1855
- // error, @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/122
1856
- "unicorn/no-array-callback-reference": "off",
1857
- // Many false positive reported
1858
- "unicorn/no-array-for-each": "off",
1859
- // This rule could change browser compatibility
1860
- "unicorn/no-array-method-this-argument": "off",
1861
- // Many false positive reported
1862
- "unicorn/no-array-reduce": "off",
1863
- // Array#reduce can be used
1864
- "unicorn/no-console-spaces": "off",
1865
- "unicorn/no-fn-reference-in-iterator": "off",
1866
- // error ?
1867
- "unicorn/no-nested-ternary": "off",
1868
- "unicorn/no-null": "off",
1869
- // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/612
1870
- "unicorn/no-object-as-default-parameter": "off",
1871
- "unicorn/no-process-exit": "off",
1872
- "unicorn/no-unreadable-array-destructuring": "off",
1873
- "unicorn/no-unused-properties": "warn",
1874
- "unicorn/no-useless-undefined": "off",
1875
- "unicorn/prefer-add-event-listener": "off",
1876
- "unicorn/prefer-default-parameters": "off",
1877
- "unicorn/prefer-set-has": "off",
1878
- "unicorn/prevent-abbreviations": "off",
1879
- // This rule is so dangerous : it potentially break code while fixing in many cases !!
1880
- "unicorn/throw-new-error": "off",
1881
- // Creating errors with call signature is OK
1882
- ...stylisticEnabled ? {} : {},
1883
- ...rules
1884
- }
1885
- },
1886
- // TODO: move to another file ?
1887
- {
1888
- name: "w5s/unicorn/overrides",
1889
- files: ["**/*.config.cjs", "**/*.config.js"],
1890
- rules: {
1891
- "unicorn/prefer-module": "off"
1892
- }
1893
- }
1894
- ];
1064
+ const [unicornPlugin] = await Promise.all([interopDefault(import("eslint-plugin-unicorn"))]);
1065
+ const { files = defaultFiles$1, rules = {}, stylistic = true } = options;
1066
+ const { enabled: stylisticEnabled } = StylisticConfig.from(stylistic);
1067
+ return [
1068
+ {
1069
+ name: "w5s/unicorn/setup",
1070
+ plugins: { unicorn: unicornPlugin }
1071
+ },
1072
+ {
1073
+ name: "w5s/unicorn/rules",
1074
+ files,
1075
+ rules: {
1076
+ ...unicornPlugin.configs.recommended?.rules,
1077
+ "unicorn/consistent-destructuring": "off",
1078
+ "unicorn/consistent-function-scoping": "off",
1079
+ "unicorn/filename-case": "off",
1080
+ "unicorn/import-index": "off",
1081
+ "unicorn/new-for-builtins": "off",
1082
+ "unicorn/no-array-callback-reference": "off",
1083
+ "unicorn/no-array-for-each": "off",
1084
+ "unicorn/no-array-method-this-argument": "off",
1085
+ "unicorn/no-array-reduce": "off",
1086
+ "unicorn/no-console-spaces": "off",
1087
+ "unicorn/no-fn-reference-in-iterator": "off",
1088
+ "unicorn/no-nested-ternary": "off",
1089
+ "unicorn/no-null": "off",
1090
+ "unicorn/no-object-as-default-parameter": "off",
1091
+ "unicorn/no-process-exit": "off",
1092
+ "unicorn/no-unreadable-array-destructuring": "off",
1093
+ "unicorn/no-unused-properties": "warn",
1094
+ "unicorn/no-useless-undefined": "off",
1095
+ "unicorn/prefer-add-event-listener": "off",
1096
+ "unicorn/prefer-default-parameters": "off",
1097
+ "unicorn/prefer-set-has": "off",
1098
+ "unicorn/prevent-abbreviations": "off",
1099
+ "unicorn/throw-new-error": "off",
1100
+ ...stylisticEnabled ? {} : {},
1101
+ ...rules
1102
+ }
1103
+ },
1104
+ {
1105
+ name: "w5s/unicorn/overrides",
1106
+ files: ["**/*.config.cjs", "**/*.config.js"],
1107
+ rules: { "unicorn/prefer-module": "off" }
1108
+ }
1109
+ ];
1895
1110
  }
1896
- var defaultFiles5 = [`**/${Project.extensionsToGlob(Project.queryExtensions(["yaml"]))}`];
1111
+ //#endregion
1112
+ //#region src/config/yml.ts
1113
+ const defaultFiles = [ymlSourceGlob];
1897
1114
  async function yml(options = {}) {
1898
- const [ymlPlugin, ymlParser] = await Promise.all([
1899
- interopDefault(import('eslint-plugin-yml')),
1900
- interopDefault(import('yaml-eslint-parser'))
1901
- ]);
1902
- const { files = defaultFiles5, rules = {}, stylistic: stylistic2 = true } = options;
1903
- const { enabled: stylisticEnabled, indent, quotes } = StylisticConfig.from(stylistic2);
1904
- return [
1905
- {
1906
- name: "w5s/yml/setup",
1907
- plugins: {
1908
- yml: ymlPlugin
1909
- }
1910
- },
1911
- {
1912
- files,
1913
- languageOptions: {
1914
- parser: ymlParser
1915
- },
1916
- name: "w5s/yml/rules",
1917
- rules: {
1918
- ...ymlPlugin.configs["flat/recommended"][0].rules,
1919
- ...ymlPlugin.configs["flat/recommended"][1].rules,
1920
- ...ymlPlugin.configs["flat/recommended"][2].rules,
1921
- ...stylisticEnabled ? {
1922
- // ...(ymlPlugin.configs['flat/standard'][3]!.rules),
1923
- // 'yml/array-bracket-spacing': ['error', 'never'],
1924
- // 'yml/comma-dangle': ['error', 'never'],
1925
- // 'yml/comma-style': ['error', 'last'],
1926
- // 'yml/object-curly-newline': ['error', { consistent: true, multiline: true }],
1927
- // 'yml/object-curly-spacing': ['error', 'always'],
1928
- // 'yml/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
1929
- // 'yml/quote-props': 'error',
1930
- "style/spaced-comment": "off",
1931
- // Fix
1932
- "yml/block-mapping-question-indicator-newline": "error",
1933
- "yml/block-sequence-hyphen-indicator-newline": "error",
1934
- "yml/flow-mapping-curly-newline": "error",
1935
- "yml/flow-mapping-curly-spacing": "error",
1936
- "yml/flow-sequence-bracket-newline": "error",
1937
- "yml/flow-sequence-bracket-spacing": "error",
1938
- "yml/indent": ["error", indent === "tab" ? 2 : indent],
1939
- "yml/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1940
- "yml/no-tab-indent": "error",
1941
- "yml/quotes": ["error", { avoidEscape: true, prefer: quotes === "backtick" ? "single" : quotes }],
1942
- "yml/spaced-comment": "error"
1943
- } : {},
1944
- ...rules
1945
- }
1946
- }
1947
- ];
1115
+ const [ymlPlugin] = await Promise.all([interopDefault(import("eslint-plugin-yml"))]);
1116
+ const { files = defaultFiles, rules = {}, stylistic = true } = options;
1117
+ const { enabled: stylisticEnabled, indent, quotes } = StylisticConfig.from(stylistic);
1118
+ return [{
1119
+ name: "w5s/yml/setup",
1120
+ plugins: { yml: ymlPlugin }
1121
+ }, {
1122
+ files,
1123
+ language: "yml/yaml",
1124
+ name: "w5s/yml/rules",
1125
+ rules: {
1126
+ ...ymlPlugin.configs["recommended"].reduce((acc, config) => ({
1127
+ ...acc,
1128
+ ...config.rules
1129
+ }), {}),
1130
+ ...stylisticEnabled ? {
1131
+ "style/spaced-comment": "off",
1132
+ "yml/block-mapping-question-indicator-newline": "error",
1133
+ "yml/block-sequence-hyphen-indicator-newline": "error",
1134
+ "yml/flow-mapping-curly-newline": "error",
1135
+ "yml/flow-mapping-curly-spacing": "error",
1136
+ "yml/flow-sequence-bracket-newline": "error",
1137
+ "yml/flow-sequence-bracket-spacing": "error",
1138
+ "yml/indent": ["error", indent === "tab" ? 2 : indent],
1139
+ "yml/key-spacing": ["error", {
1140
+ afterColon: true,
1141
+ beforeColon: false
1142
+ }],
1143
+ "yml/no-tab-indent": "error",
1144
+ "yml/quotes": ["error", {
1145
+ avoidEscape: true,
1146
+ prefer: quotes === "backtick" ? "single" : quotes
1147
+ }],
1148
+ "yml/spaced-comment": "error"
1149
+ } : {},
1150
+ ...rules
1151
+ }
1152
+ }];
1948
1153
  }
1949
-
1950
- // src/defineConfig.ts
1154
+ //#endregion
1155
+ //#region src/defineConfig.ts
1951
1156
  async function defineConfig(options = {}) {
1952
- const stylisticOptions = typeof options.stylistic === "boolean" ? { enabled: options.stylistic } : { enabled: true, ...options.stylistic };
1953
- const withDefaultStylistic = (_options) => ({ stylistic: stylisticOptions, ..._options });
1954
- const toOption = (optionsOrBoolean) => withDefaultStylistic(
1955
- typeof optionsOrBoolean === "boolean" ? { enabled: optionsOrBoolean } : { enabled: true, ...optionsOrBoolean }
1956
- );
1957
- const esOptions = toOption(options.es);
1958
- const importOptions = toOption(options.import);
1959
- const jsdocOptions = toOption(options.jsdoc);
1960
- const jsoncOptions = toOption(options.jsonc);
1961
- const nodeOptions = toOption(options.node);
1962
- const tsOptions = toOption(options.ts);
1963
- const unicornOptions = toOption(options.unicorn);
1964
- const ymlOptions = toOption(options.yml);
1965
- const returnValue = [];
1966
- const append = (config) => {
1967
- returnValue.push(config);
1968
- };
1969
- append(es(esOptions));
1970
- append(ignores(options));
1971
- if (jsoncOptions.enabled) {
1972
- append(jsonc(jsoncOptions));
1973
- }
1974
- if (jsdocOptions.enabled) {
1975
- append(jsdoc(jsdocOptions));
1976
- }
1977
- if (stylisticOptions.enabled) {
1978
- append(stylistic(stylisticOptions));
1979
- }
1980
- if (importOptions.enabled) {
1981
- append(imports(importOptions));
1982
- }
1983
- if (nodeOptions.enabled) {
1984
- append(node(nodeOptions));
1985
- }
1986
- if (tsOptions.enabled) {
1987
- append(ts(tsOptions));
1988
- }
1989
- if (ymlOptions.enabled) {
1990
- append(yml(ymlOptions));
1991
- }
1992
- if (unicornOptions.enabled) {
1993
- append(unicorn(unicornOptions));
1994
- }
1995
- const nested = await Promise.all(returnValue);
1996
- return nested.reduce((acc, curr) => [...acc, ...curr], []);
1157
+ const stylisticOptions = typeof options.stylistic === "boolean" ? { enabled: options.stylistic } : {
1158
+ enabled: true,
1159
+ ...options.stylistic
1160
+ };
1161
+ const withDefaultStylistic = (_options) => ({
1162
+ stylistic: stylisticOptions,
1163
+ ..._options
1164
+ });
1165
+ const toOption = (optionsOrBoolean) => withDefaultStylistic(typeof optionsOrBoolean === "boolean" ? { enabled: optionsOrBoolean } : {
1166
+ enabled: true,
1167
+ ...optionsOrBoolean
1168
+ });
1169
+ const esOptions = toOption(options.es);
1170
+ const importOptions = toOption(options.import);
1171
+ const jsdocOptions = toOption(options.jsdoc);
1172
+ const jsoncOptions = toOption(options.jsonc);
1173
+ const markdownOptions = toOption(options.markdown);
1174
+ const nodeOptions = toOption(options.node);
1175
+ const tsOptions = toOption(options.ts);
1176
+ const unicornOptions = toOption(options.unicorn);
1177
+ const ymlOptions = toOption(options.yml);
1178
+ const returnValue = [];
1179
+ const append = (config) => {
1180
+ returnValue.push(config);
1181
+ };
1182
+ append(es(esOptions));
1183
+ append(ignores(options));
1184
+ if (jsoncOptions.enabled) append(jsonc(jsoncOptions));
1185
+ if (jsdocOptions.enabled) append(jsdoc(jsdocOptions));
1186
+ if (stylisticOptions.enabled) append(stylistic(stylisticOptions));
1187
+ if (importOptions.enabled) append(imports(importOptions));
1188
+ if (markdownOptions.enabled) append(markdown(markdownOptions));
1189
+ if (nodeOptions.enabled) append(node(nodeOptions));
1190
+ if (tsOptions.enabled) append(ts(tsOptions));
1191
+ if (ymlOptions.enabled) append(yml(ymlOptions));
1192
+ if (unicornOptions.enabled) append(unicorn(unicornOptions));
1193
+ return (await Promise.all(returnValue)).reduce((acc, curr) => [...acc, ...curr], []);
1997
1194
  }
1195
+ //#endregion
1196
+ //#region src/meta.ts
1197
+ const meta = Object.freeze({
1198
+ name: "@w5s/eslint-config",
1199
+ version: "3.5.0",
1200
+ buildNumber: 1
1201
+ });
1202
+ //#endregion
1203
+ export { StylisticConfig, defineConfig as default, defineConfig, es, ignores, imports, jsdoc, jsonc, markdown, meta, node, stylistic, test, ts, unicorn, yml };
1998
1204
 
1999
- export { StylisticConfig, defineConfig as default, defineConfig, es, ignores, imports, jsdoc, jsonc, node, stylistic, test, ts, unicorn, yml };
2000
- //# sourceMappingURL=index.js.map
2001
1205
  //# sourceMappingURL=index.js.map