@vinicunca/eslint-config 2.0.0-beta.9 → 2.0.1

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,8 +1,61 @@
1
1
  // src/base.ts
2
- import process2 from "process";
2
+ import process3 from "process";
3
3
  import { isPackageExists } from "local-pkg";
4
4
 
5
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/function/purry.js
5
+ // src/flags.ts
6
+ var ERROR = "error";
7
+ var OFF = "off";
8
+ var WARN = "warn";
9
+ var CONSISTENT = "consistent";
10
+ var NEVER = "never";
11
+ var ALWAYS = "always";
12
+
13
+ // src/plugins.ts
14
+ import { default as default2 } from "@stylistic/eslint-plugin";
15
+ import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
16
+ import { default as default4 } from "@typescript-eslint/eslint-plugin";
17
+ import * as parserTs from "@typescript-eslint/parser";
18
+ import { default as default5 } from "eslint-plugin-eslint-comments";
19
+ import * as pluginImport from "eslint-plugin-i";
20
+ import { default as default6 } from "eslint-plugin-jsdoc";
21
+ import * as pluginJsonc from "eslint-plugin-jsonc";
22
+ import { default as default7 } from "eslint-plugin-markdown";
23
+ import { default as default8 } from "eslint-plugin-n";
24
+ import { default as default9 } from "eslint-plugin-no-only-tests";
25
+ import { default as default10 } from "eslint-plugin-unicorn";
26
+ import { default as default11 } from "eslint-plugin-unused-imports";
27
+ import { default as default12 } from "eslint-plugin-react";
28
+ import { default as default13 } from "eslint-plugin-react-hooks";
29
+ import { default as default14 } from "eslint-plugin-vue";
30
+ import * as pluginYaml from "eslint-plugin-yml";
31
+ import { default as default15 } from "eslint-plugin-vitest";
32
+ import { default as default16 } from "jsonc-eslint-parser";
33
+ import { default as default17 } from "vue-eslint-parser";
34
+ import { default as default18 } from "yaml-eslint-parser";
35
+
36
+ // src/configs/comments.ts
37
+ function comments() {
38
+ return [
39
+ {
40
+ name: "vinicunca:eslint-comments",
41
+ plugins: {
42
+ "eslint-comments": default5
43
+ },
44
+ rules: {
45
+ "eslint-comments/no-aggregating-enable": ERROR,
46
+ "eslint-comments/no-duplicate-disable": ERROR,
47
+ "eslint-comments/no-unlimited-disable": ERROR,
48
+ "eslint-comments/no-unused-enable": ERROR
49
+ }
50
+ }
51
+ ];
52
+ }
53
+
54
+ // src/configs/ignores.ts
55
+ import fs from "fs";
56
+ import parseGitignore from "parse-gitignore";
57
+
58
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
6
59
  function purry(fn, args, lazy) {
7
60
  const diff = fn.length - args.length;
8
61
  const arrayArgs = Array.from(args);
@@ -19,13 +72,56 @@ function purry(fn, args, lazy) {
19
72
  }
20
73
  throw new Error("Wrong number of arguments");
21
74
  }
22
-
23
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
24
- function isBoolean(data) {
25
- return typeof data === "boolean";
75
+ function isArray(data) {
76
+ return Array.isArray(data);
26
77
  }
27
-
28
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/utils/reduce-lazy.js
78
+ function isDefined(data) {
79
+ return typeof data !== "undefined" && data !== null;
80
+ }
81
+ ((isDefined2) => {
82
+ function strict(data) {
83
+ return data !== void 0;
84
+ }
85
+ isDefined2.strict = strict;
86
+ })(isDefined || (isDefined = {}));
87
+ function toString(value) {
88
+ return Object.prototype.toString.call(value);
89
+ }
90
+ function isObject(data) {
91
+ return toString(data) === "[object Object]";
92
+ }
93
+ function isString(data) {
94
+ return typeof data === "string";
95
+ }
96
+ function isEmpty(data) {
97
+ if (isArray(data) || isString(data)) {
98
+ return data.length === 0;
99
+ }
100
+ if (isObject(data)) {
101
+ for (const _ in data) {
102
+ return false;
103
+ }
104
+ return !(data instanceof RegExp);
105
+ }
106
+ return false;
107
+ }
108
+ function _countBy(indexed) {
109
+ return (array, fn) => {
110
+ return array.reduce((ret, item, index) => {
111
+ const value = indexed ? fn(item, index, array) : fn(item);
112
+ return ret + (value ? 1 : 0);
113
+ }, 0);
114
+ };
115
+ }
116
+ function countBy(...args) {
117
+ return purry(_countBy(false), args);
118
+ }
119
+ ((countBy2) => {
120
+ function indexed(...args) {
121
+ return purry(_countBy(true), args);
122
+ }
123
+ countBy2.indexed = indexed;
124
+ })(countBy || (countBy = {}));
29
125
  function _reduceLazy(array, lazy, indexed) {
30
126
  const newArray = [];
31
127
  for (let index = 0; index < array.length; index++) {
@@ -39,25 +135,815 @@ function _reduceLazy(array, lazy, indexed) {
39
135
  }
40
136
  return newArray;
41
137
  }
42
-
43
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/array/uniq.js
44
- function uniq() {
45
- return purry(_uniq, arguments, uniq.lazy);
138
+ function differenceWith(...args) {
139
+ return purry(_differenceWith, args, differenceWith.lazy);
140
+ }
141
+ function _differenceWith(array, other, isEquals) {
142
+ const lazy = differenceWith.lazy(other, isEquals);
143
+ return _reduceLazy(array, lazy);
144
+ }
145
+ ((differenceWith2) => {
146
+ function lazy(other, isEquals) {
147
+ return (value) => {
148
+ if (other.every((otherValue) => !isEquals(value, otherValue))) {
149
+ return {
150
+ done: false,
151
+ hasNext: true,
152
+ next: value
153
+ };
154
+ }
155
+ return {
156
+ done: false,
157
+ hasNext: false
158
+ };
159
+ };
160
+ }
161
+ differenceWith2.lazy = lazy;
162
+ })(differenceWith || (differenceWith = {}));
163
+ function difference(...args) {
164
+ return purry(_difference, args, difference.lazy);
165
+ }
166
+ function _difference(array, other) {
167
+ const lazy = difference.lazy(other);
168
+ return _reduceLazy(array, lazy);
169
+ }
170
+ ((difference2) => {
171
+ function lazy(other) {
172
+ const set2 = new Set(other);
173
+ return (value) => {
174
+ if (!set2.has(value)) {
175
+ return {
176
+ done: false,
177
+ hasNext: true,
178
+ next: value
179
+ };
180
+ }
181
+ return {
182
+ done: false,
183
+ hasNext: false
184
+ };
185
+ };
186
+ }
187
+ difference2.lazy = lazy;
188
+ })(difference || (difference = {}));
189
+ function drop(...args) {
190
+ return purry(_drop, args, drop.lazy);
191
+ }
192
+ function _drop(array, n) {
193
+ return _reduceLazy(array, drop.lazy(n));
194
+ }
195
+ ((drop2) => {
196
+ function lazy(n) {
197
+ let left = n;
198
+ return (value) => {
199
+ if (left > 0) {
200
+ left--;
201
+ return {
202
+ done: false,
203
+ hasNext: false
204
+ };
205
+ }
206
+ return {
207
+ done: false,
208
+ hasNext: true,
209
+ next: value
210
+ };
211
+ };
212
+ }
213
+ drop2.lazy = lazy;
214
+ })(drop || (drop = {}));
215
+ function toLazyIndexed(fn) {
216
+ fn.indexed = true;
217
+ return fn;
218
+ }
219
+ function filter(...args) {
220
+ return purry(_filter(false), args, filter.lazy);
221
+ }
222
+ function _filter(indexed) {
223
+ return (array, fn) => {
224
+ return _reduceLazy(
225
+ array,
226
+ indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
227
+ indexed
228
+ );
229
+ };
230
+ }
231
+ function _lazy(indexed) {
232
+ return (fn) => {
233
+ return (value, index, array) => {
234
+ const valid = indexed ? fn(value, index, array) : fn(value);
235
+ if (valid) {
236
+ return {
237
+ done: false,
238
+ hasNext: true,
239
+ next: value
240
+ };
241
+ }
242
+ return {
243
+ done: false,
244
+ hasNext: false
245
+ };
246
+ };
247
+ };
248
+ }
249
+ ((filter2) => {
250
+ function indexed(...args) {
251
+ return purry(_filter(true), args, filter2.lazyIndexed);
252
+ }
253
+ filter2.indexed = indexed;
254
+ filter2.lazy = _lazy(false);
255
+ filter2.lazyIndexed = toLazyIndexed(_lazy(true));
256
+ })(filter || (filter = {}));
257
+ function toSingle(fn) {
258
+ fn.single = true;
259
+ return fn;
260
+ }
261
+ function findIndex(...args) {
262
+ return purry(_findIndex(false), args, findIndex.lazy);
263
+ }
264
+ function _findIndex(indexed) {
265
+ return (array, fn) => {
266
+ if (indexed) {
267
+ return array.findIndex(fn);
268
+ }
269
+ return array.findIndex((x) => fn(x));
270
+ };
271
+ }
272
+ function _lazy2(indexed) {
273
+ return (fn) => {
274
+ let i = 0;
275
+ return (value, index, array) => {
276
+ const valid = indexed ? fn(value, index, array) : fn(value);
277
+ if (valid) {
278
+ return {
279
+ done: true,
280
+ hasNext: true,
281
+ next: i
282
+ };
283
+ }
284
+ i++;
285
+ return {
286
+ done: false,
287
+ hasNext: false
288
+ };
289
+ };
290
+ };
291
+ }
292
+ ((findIndex2) => {
293
+ function indexed(...args) {
294
+ return purry(_findIndex(true), args, findIndex2.lazyIndexed);
295
+ }
296
+ findIndex2.indexed = indexed;
297
+ findIndex2.lazy = toSingle(_lazy2(false));
298
+ findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
299
+ })(findIndex || (findIndex = {}));
300
+ function findLastIndex(...args) {
301
+ return purry(_findLastIndex(false), args);
302
+ }
303
+ function _findLastIndex(indexed) {
304
+ return (array, fn) => {
305
+ for (let i = array.length - 1; i >= 0; i--) {
306
+ if (indexed ? fn(array[i], i, array) : fn(array[i])) {
307
+ return i;
308
+ }
309
+ }
310
+ return -1;
311
+ };
312
+ }
313
+ ((findLastIndex2) => {
314
+ function indexed(...args) {
315
+ return purry(_findLastIndex(true), args);
316
+ }
317
+ findLastIndex2.indexed = indexed;
318
+ })(findLastIndex || (findLastIndex = {}));
319
+ function findLast(...args) {
320
+ return purry(_findLast(false), args);
321
+ }
322
+ function _findLast(indexed) {
323
+ return (array, fn) => {
324
+ for (let i = array.length - 1; i >= 0; i--) {
325
+ if (indexed ? fn(array[i], i, array) : fn(array[i])) {
326
+ return array[i];
327
+ }
328
+ }
329
+ };
330
+ }
331
+ ((findLast2) => {
332
+ function indexed(...args) {
333
+ return purry(_findLast(true), args);
334
+ }
335
+ findLast2.indexed = indexed;
336
+ })(findLast || (findLast = {}));
337
+ function find(...args) {
338
+ return purry(_find(false), args, find.lazy);
339
+ }
340
+ function _find(indexed) {
341
+ return (array, fn) => {
342
+ if (indexed) {
343
+ return array.find(fn);
344
+ }
345
+ return array.find((x) => fn(x));
346
+ };
347
+ }
348
+ function _lazy3(indexed) {
349
+ return (fn) => {
350
+ return (value, index, array) => {
351
+ const valid = indexed ? fn(value, index, array) : fn(value);
352
+ return {
353
+ done: valid,
354
+ hasNext: valid,
355
+ next: value
356
+ };
357
+ };
358
+ };
359
+ }
360
+ ((find2) => {
361
+ function indexed(...args) {
362
+ return purry(_find(true), args, find2.lazyIndexed);
363
+ }
364
+ find2.indexed = indexed;
365
+ find2.lazy = toSingle(_lazy3(false));
366
+ find2.lazyIndexed = toSingle(toLazyIndexed(_lazy3(true)));
367
+ })(find || (find = {}));
368
+ function first(...args) {
369
+ return purry(_first, args, first.lazy);
370
+ }
371
+ function _first([first2]) {
372
+ return first2;
373
+ }
374
+ ((first2) => {
375
+ function lazy() {
376
+ return (value) => {
377
+ return {
378
+ done: true,
379
+ hasNext: true,
380
+ next: value
381
+ };
382
+ };
383
+ }
384
+ first2.lazy = lazy;
385
+ ((lazy2) => {
386
+ lazy2.single = true;
387
+ })(lazy = first2.lazy || (first2.lazy = {}));
388
+ })(first || (first = {}));
389
+ function flatMapToObj(...args) {
390
+ return purry(_flatMapToObj(false), args);
391
+ }
392
+ function _flatMapToObj(indexed) {
393
+ return (array, fn) => {
394
+ return array.reduce((result, element, index) => {
395
+ const items = indexed ? fn(element, index, array) : fn(element);
396
+ items.forEach(([key, value]) => {
397
+ result[key] = value;
398
+ });
399
+ return result;
400
+ }, {});
401
+ };
402
+ }
403
+ ((flatMapToObj2) => {
404
+ function indexed(...args) {
405
+ return purry(_flatMapToObj(true), args);
406
+ }
407
+ flatMapToObj2.indexed = indexed;
408
+ })(flatMapToObj || (flatMapToObj = {}));
409
+ function flatten(...args) {
410
+ return purry(_flatten, args, flatten.lazy);
411
+ }
412
+ function _flatten(items) {
413
+ return _reduceLazy(items, flatten.lazy());
414
+ }
415
+ ((flatten2) => {
416
+ function lazy() {
417
+ return (next) => {
418
+ if (Array.isArray(next)) {
419
+ return {
420
+ done: false,
421
+ hasNext: true,
422
+ hasMany: true,
423
+ next
424
+ };
425
+ }
426
+ return {
427
+ done: false,
428
+ hasNext: true,
429
+ next
430
+ };
431
+ };
432
+ }
433
+ flatten2.lazy = lazy;
434
+ })(flatten || (flatten = {}));
435
+ function flatMap(...args) {
436
+ return purry(_flatMap, args, flatMap.lazy);
437
+ }
438
+ function _flatMap(array, fn) {
439
+ return flatten(array.map((item) => fn(item)));
440
+ }
441
+ ((flatMap2) => {
442
+ function lazy(fn) {
443
+ return (value) => {
444
+ const next = fn(value);
445
+ if (Array.isArray(next)) {
446
+ return {
447
+ done: false,
448
+ hasNext: true,
449
+ hasMany: true,
450
+ next
451
+ };
452
+ }
453
+ return {
454
+ done: false,
455
+ hasNext: true,
456
+ next
457
+ };
458
+ };
459
+ }
460
+ flatMap2.lazy = lazy;
461
+ })(flatMap || (flatMap = {}));
462
+ function flattenDeep(...args) {
463
+ return purry(_flattenDeep, args, flattenDeep.lazy);
464
+ }
465
+ function _flattenDeep(items) {
466
+ return _reduceLazy(items, flattenDeep.lazy());
467
+ }
468
+ function _flattenDeepValue(value) {
469
+ if (!Array.isArray(value)) {
470
+ return value;
471
+ }
472
+ const ret = [];
473
+ value.forEach((item) => {
474
+ if (Array.isArray(item)) {
475
+ ret.push(...flattenDeep(item));
476
+ } else {
477
+ ret.push(item);
478
+ }
479
+ });
480
+ return ret;
481
+ }
482
+ ((flattenDeep2) => {
483
+ function lazy() {
484
+ return (value) => {
485
+ const next = _flattenDeepValue(value);
486
+ if (Array.isArray(next)) {
487
+ return {
488
+ done: false,
489
+ hasNext: true,
490
+ hasMany: true,
491
+ next
492
+ };
493
+ }
494
+ return {
495
+ done: false,
496
+ hasNext: true,
497
+ next
498
+ };
499
+ };
500
+ }
501
+ flattenDeep2.lazy = lazy;
502
+ })(flattenDeep || (flattenDeep = {}));
503
+ function forEach(...args) {
504
+ return purry(_forEach(false), args, forEach.lazy);
505
+ }
506
+ function _forEach(indexed) {
507
+ return (array, fn) => {
508
+ return _reduceLazy(
509
+ array,
510
+ indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
511
+ indexed
512
+ );
513
+ };
514
+ }
515
+ function _lazy4(indexed) {
516
+ return (fn) => {
517
+ return (value, index, array) => {
518
+ if (indexed) {
519
+ fn(value, index, array);
520
+ } else {
521
+ fn(value);
522
+ }
523
+ return {
524
+ done: false,
525
+ hasNext: true,
526
+ next: value
527
+ };
528
+ };
529
+ };
530
+ }
531
+ ((forEach2) => {
532
+ function indexed(...args) {
533
+ return purry(_forEach(true), args, forEach2.lazyIndexed);
534
+ }
535
+ forEach2.indexed = indexed;
536
+ forEach2.lazy = _lazy4(false);
537
+ forEach2.lazyIndexed = toLazyIndexed(_lazy4(true));
538
+ })(forEach || (forEach = {}));
539
+ function groupBy(...args) {
540
+ return purry(_groupBy(false), args);
541
+ }
542
+ function _groupBy(indexed) {
543
+ return (array, fn) => {
544
+ const ret = {};
545
+ array.forEach((item, index) => {
546
+ const key = indexed ? fn(item, index, array) : fn(item);
547
+ if (key !== void 0) {
548
+ const actualKey = String(key);
549
+ if (!ret[actualKey]) {
550
+ ret[actualKey] = [];
551
+ }
552
+ ret[actualKey].push(item);
553
+ }
554
+ });
555
+ return ret;
556
+ };
557
+ }
558
+ ((groupBy2) => {
559
+ function indexed(...args) {
560
+ return purry(_groupBy(true), args);
561
+ }
562
+ groupBy2.indexed = indexed;
563
+ groupBy2.strict = groupBy2;
564
+ })(groupBy || (groupBy = {}));
565
+ function indexBy(...args) {
566
+ return purry(_indexBy(false), args);
567
+ }
568
+ function _indexBy(indexed) {
569
+ return (array, fn) => {
570
+ return array.reduce((ret, item, index) => {
571
+ const value = indexed ? fn(item, index, array) : fn(item);
572
+ const key = String(value);
573
+ ret[key] = item;
574
+ return ret;
575
+ }, {});
576
+ };
577
+ }
578
+ ((indexBy2) => {
579
+ function indexed(...args) {
580
+ return purry(_indexBy(true), args);
581
+ }
582
+ indexBy2.indexed = indexed;
583
+ })(indexBy || (indexBy = {}));
584
+ function intersection(...args) {
585
+ return purry(_intersection, args, intersection.lazy);
586
+ }
587
+ function _intersection(array, other) {
588
+ const lazy = intersection.lazy(other);
589
+ return _reduceLazy(array, lazy);
590
+ }
591
+ ((intersection2) => {
592
+ function lazy(other) {
593
+ return (value) => {
594
+ const set2 = new Set(other);
595
+ if (set2.has(value)) {
596
+ return {
597
+ done: false,
598
+ hasNext: true,
599
+ next: value
600
+ };
601
+ }
602
+ return {
603
+ done: false,
604
+ hasNext: false
605
+ };
606
+ };
607
+ }
608
+ intersection2.lazy = lazy;
609
+ })(intersection || (intersection = {}));
610
+ function intersectionWith(...args) {
611
+ return purry(_intersectionWith, args, intersectionWith.lazy);
612
+ }
613
+ function _intersectionWith(array, other, comparator) {
614
+ const lazy = intersectionWith.lazy(other, comparator);
615
+ return _reduceLazy(array, lazy);
616
+ }
617
+ ((intersectionWith2) => {
618
+ function lazy(other, comparator) {
619
+ return (value) => {
620
+ if (other.some((otherValue) => comparator(value, otherValue))) {
621
+ return {
622
+ done: false,
623
+ hasNext: true,
624
+ next: value
625
+ };
626
+ }
627
+ return {
628
+ done: false,
629
+ hasNext: false
630
+ };
631
+ };
632
+ }
633
+ intersectionWith2.lazy = lazy;
634
+ })(intersectionWith || (intersectionWith = {}));
635
+ function map(...args) {
636
+ return purry(_map(false), args, map.lazy);
637
+ }
638
+ function _map(indexed) {
639
+ return (array, fn) => {
640
+ return _reduceLazy(
641
+ array,
642
+ indexed ? map.lazyIndexed(fn) : map.lazy(fn),
643
+ indexed
644
+ );
645
+ };
646
+ }
647
+ function _lazy5(indexed) {
648
+ return (fn) => {
649
+ return (value, index, array) => {
650
+ return {
651
+ done: false,
652
+ hasNext: true,
653
+ next: indexed ? fn(value, index, array) : fn(value)
654
+ };
655
+ };
656
+ };
657
+ }
658
+ ((map2) => {
659
+ function indexed(...args) {
660
+ return purry(_map(true), args, map2.lazyIndexed);
661
+ }
662
+ map2.indexed = indexed;
663
+ map2.lazy = _lazy5(false);
664
+ map2.lazyIndexed = toLazyIndexed(_lazy5(true));
665
+ map2.strict = map2;
666
+ })(map || (map = {}));
667
+ function mapToObj(...args) {
668
+ return purry(_mapToObj(false), args);
669
+ }
670
+ function _mapToObj(indexed) {
671
+ return (array, fn) => {
672
+ return array.reduce((result, element, index) => {
673
+ const [key, value] = indexed ? fn(element, index, array) : fn(element);
674
+ result[key] = value;
675
+ return result;
676
+ }, {});
677
+ };
678
+ }
679
+ ((mapToObj2) => {
680
+ function indexed(...args) {
681
+ return purry(_mapToObj(true), args);
682
+ }
683
+ mapToObj2.indexed = indexed;
684
+ })(mapToObj || (mapToObj = {}));
685
+ function _maxBy(indexed) {
686
+ return (array, fn) => {
687
+ let ret;
688
+ let retMax;
689
+ array.forEach((item, i) => {
690
+ const max = indexed ? fn(item, i, array) : fn(item);
691
+ if (retMax === void 0 || max > retMax) {
692
+ ret = item;
693
+ retMax = max;
694
+ }
695
+ });
696
+ return ret;
697
+ };
698
+ }
699
+ function maxBy(...args) {
700
+ return purry(_maxBy(false), args);
701
+ }
702
+ ((maxBy2) => {
703
+ function indexed(...args) {
704
+ return purry(_maxBy(true), args);
705
+ }
706
+ maxBy2.indexed = indexed;
707
+ })(maxBy || (maxBy = {}));
708
+ function _meanBy(indexed) {
709
+ return (array, fn) => {
710
+ if (array.length === 0) {
711
+ return Number.NaN;
712
+ }
713
+ let sum = 0;
714
+ array.forEach((item, i) => {
715
+ sum += indexed ? fn(item, i, array) : fn(item);
716
+ });
717
+ return sum / array.length;
718
+ };
719
+ }
720
+ function meanBy(...args) {
721
+ return purry(_meanBy(false), args);
722
+ }
723
+ ((meanBy2) => {
724
+ function indexed(...args) {
725
+ return purry(_meanBy(true), args);
726
+ }
727
+ meanBy2.indexed = indexed;
728
+ })(meanBy || (meanBy = {}));
729
+ function _minBy(indexed) {
730
+ return (array, fn) => {
731
+ let ret;
732
+ let retMin;
733
+ array.forEach((item, i) => {
734
+ const min = indexed ? fn(item, i, array) : fn(item);
735
+ if (retMin === void 0 || min < retMin) {
736
+ ret = item;
737
+ retMin = min;
738
+ }
739
+ });
740
+ return ret;
741
+ };
742
+ }
743
+ function minBy(...args) {
744
+ return purry(_minBy(false), args);
745
+ }
746
+ ((minBy2) => {
747
+ function indexed(...args) {
748
+ return purry(_minBy(true), args);
749
+ }
750
+ minBy2.indexed = indexed;
751
+ })(minBy || (minBy = {}));
752
+ function partition(...args) {
753
+ return purry(_partition(false), args);
754
+ }
755
+ function _partition(indexed) {
756
+ return (array, fn) => {
757
+ const ret = [[], []];
758
+ array.forEach((item, index) => {
759
+ const matches = indexed ? fn(item, index, array) : fn(item);
760
+ ret[matches ? 0 : 1].push(item);
761
+ });
762
+ return ret;
763
+ };
764
+ }
765
+ ((partition2) => {
766
+ function indexed(...args) {
767
+ return purry(_partition(true), args);
768
+ }
769
+ partition2.indexed = indexed;
770
+ })(partition || (partition = {}));
771
+ function reduce(...args) {
772
+ return purry(_reduce(false), args);
773
+ }
774
+ function _reduce(indexed) {
775
+ return (items, fn, initialValue) => {
776
+ return items.reduce(
777
+ (acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
778
+ initialValue
779
+ );
780
+ };
781
+ }
782
+ ((reduce2) => {
783
+ function indexed(...args) {
784
+ return purry(_reduce(true), args);
785
+ }
786
+ reduce2.indexed = indexed;
787
+ })(reduce || (reduce = {}));
788
+ function reject(...args) {
789
+ return purry(_reject(false), args, reject.lazy);
790
+ }
791
+ function _reject(indexed) {
792
+ return (array, fn) => {
793
+ return _reduceLazy(
794
+ array,
795
+ indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
796
+ indexed
797
+ );
798
+ };
799
+ }
800
+ function _lazy6(indexed) {
801
+ return (fn) => {
802
+ return (value, index, array) => {
803
+ const valid = indexed ? fn(value, index, array) : fn(value);
804
+ if (!valid) {
805
+ return {
806
+ done: false,
807
+ hasNext: true,
808
+ next: value
809
+ };
810
+ }
811
+ return {
812
+ done: false,
813
+ hasNext: false
814
+ };
815
+ };
816
+ };
817
+ }
818
+ ((reject2) => {
819
+ function indexed(...args) {
820
+ return purry(_reject(true), args, reject2.lazyIndexed);
821
+ }
822
+ reject2.indexed = indexed;
823
+ reject2.lazy = _lazy6(false);
824
+ reject2.lazyIndexed = toLazyIndexed(_lazy6(true));
825
+ })(reject || (reject = {}));
826
+ function sort(...args) {
827
+ return purry(_sort, args);
828
+ }
829
+ function _sort(items, cmp) {
830
+ const ret = [...items];
831
+ ret.sort(cmp);
832
+ return ret;
833
+ }
834
+ ((sort2) => {
835
+ sort2.strict = sort2;
836
+ })(sort || (sort = {}));
837
+ var ALL_DIRECTIONS = ["asc", "desc"];
838
+ var COMPARATOR = {
839
+ asc: (x, y) => x > y,
840
+ desc: (x, y) => x < y
841
+ };
842
+ function sortBy(arrayOrSortRule, ...sortRules) {
843
+ const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
844
+ return purry(_sortBy, args);
845
+ }
846
+ function isSortRule(x) {
847
+ if (typeof x === "function") {
848
+ return true;
849
+ }
850
+ const [maybeProjection, maybeDirection, ...rest] = x;
851
+ if (rest.length > 0) {
852
+ return false;
853
+ }
854
+ return typeof maybeProjection === "function" && ALL_DIRECTIONS.includes(maybeDirection);
855
+ }
856
+ function _sortBy(array, sorts) {
857
+ return [...array].sort(comparer(...sorts));
858
+ }
859
+ function comparer(primaryRule, secondaryRule, ...otherRules) {
860
+ const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
861
+ const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
862
+ const comparator = COMPARATOR[direction];
863
+ const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
864
+ return (a, b) => {
865
+ const projectedA = projector(a);
866
+ const projectedB = projector(b);
867
+ if (comparator(projectedA, projectedB)) {
868
+ return 1;
869
+ }
870
+ if (comparator(projectedB, projectedA)) {
871
+ return -1;
872
+ }
873
+ return nextComparer?.(a, b) ?? 0;
874
+ };
875
+ }
876
+ ((sortBy2) => {
877
+ sortBy2.strict = sortBy2;
878
+ })(sortBy || (sortBy = {}));
879
+ function _sumBy(indexed) {
880
+ return (array, fn) => {
881
+ let sum = 0;
882
+ array.forEach((item, i) => {
883
+ const summand = indexed ? fn(item, i, array) : fn(item);
884
+ sum += summand;
885
+ });
886
+ return sum;
887
+ };
888
+ }
889
+ function sumBy(...args) {
890
+ return purry(_sumBy(false), args);
891
+ }
892
+ ((sumBy2) => {
893
+ function indexed(...args) {
894
+ return purry(_sumBy(true), args);
895
+ }
896
+ sumBy2.indexed = indexed;
897
+ })(sumBy || (sumBy = {}));
898
+ function take(...args) {
899
+ return purry(_take, args, take.lazy);
900
+ }
901
+ function _take(array, n) {
902
+ return _reduceLazy(array, take.lazy(n));
903
+ }
904
+ ((take2) => {
905
+ function lazy(n) {
906
+ return (value) => {
907
+ if (n === 0) {
908
+ return {
909
+ done: true,
910
+ hasNext: false
911
+ };
912
+ }
913
+ n--;
914
+ if (n === 0) {
915
+ return {
916
+ done: true,
917
+ hasNext: true,
918
+ next: value
919
+ };
920
+ }
921
+ return {
922
+ done: false,
923
+ hasNext: true,
924
+ next: value
925
+ };
926
+ };
927
+ }
928
+ take2.lazy = lazy;
929
+ })(take || (take = {}));
930
+ function uniq(...args) {
931
+ return purry(_uniq, args, uniq.lazy);
46
932
  }
47
933
  function _uniq(array) {
48
934
  return _reduceLazy(array, uniq.lazy());
49
935
  }
50
- (function(uniq2) {
936
+ ((uniq2) => {
51
937
  function lazy() {
52
- const set = /* @__PURE__ */ new Set();
938
+ const set2 = /* @__PURE__ */ new Set();
53
939
  return (value) => {
54
- if (set.has(value)) {
940
+ if (set2.has(value)) {
55
941
  return {
56
942
  done: false,
57
943
  hasNext: false
58
944
  };
59
945
  }
60
- set.add(value);
946
+ set2.add(value);
61
947
  return {
62
948
  done: false,
63
949
  hasNext: true,
@@ -67,59 +953,81 @@ function _uniq(array) {
67
953
  }
68
954
  uniq2.lazy = lazy;
69
955
  })(uniq || (uniq = {}));
70
-
71
- // src/flags.ts
72
- var ERROR = "error";
73
- var OFF = "off";
74
- var WARN = "warn";
75
- var CONSISTENT = "consistent";
76
- var NEVER = "never";
77
- var ALWAYS = "always";
78
-
79
- // src/plugins.ts
80
- import { default as default2 } from "@stylistic/eslint-plugin";
81
- import { default as default3 } from "@vinicunca/eslint-plugin-vinicunca";
82
- import { default as default4 } from "@typescript-eslint/eslint-plugin";
83
- import * as parserTs from "@typescript-eslint/parser";
84
- import { default as default5 } from "eslint-plugin-eslint-comments";
85
- import * as pluginImport from "eslint-plugin-i";
86
- import { default as default6 } from "eslint-plugin-jsdoc";
87
- import * as pluginJsonc from "eslint-plugin-jsonc";
88
- import { default as default7 } from "eslint-plugin-markdown";
89
- import { default as default8 } from "eslint-plugin-n";
90
- import { default as default9 } from "eslint-plugin-no-only-tests";
91
- import { default as default10 } from "eslint-plugin-unicorn";
92
- import { default as default11 } from "eslint-plugin-unused-imports";
93
- import { default as default12 } from "eslint-plugin-react";
94
- import { default as default13 } from "eslint-plugin-react-hooks";
95
- import { default as default14 } from "eslint-plugin-vue";
96
- import * as pluginYaml from "eslint-plugin-yml";
97
- import { default as default15 } from "eslint-plugin-vitest";
98
- import { default as default16 } from "jsonc-eslint-parser";
99
- import { default as default17 } from "vue-eslint-parser";
100
- import { default as default18 } from "yaml-eslint-parser";
101
-
102
- // src/configs/comments.ts
103
- function comments() {
104
- return [
105
- {
106
- name: "vinicunca:eslint-comments",
107
- plugins: {
108
- "eslint-comments": default5
109
- },
110
- rules: {
111
- "eslint-comments/no-aggregating-enable": ERROR,
112
- "eslint-comments/no-duplicate-disable": ERROR,
113
- "eslint-comments/no-unlimited-disable": ERROR,
114
- "eslint-comments/no-unused-enable": ERROR
956
+ function uniqWith(...args) {
957
+ return purry(_uniqWith, args, uniqWith.lazy);
958
+ }
959
+ function _uniqWith(array, isEquals) {
960
+ const lazy = uniqWith.lazy(isEquals);
961
+ return _reduceLazy(array, lazy, true);
962
+ }
963
+ function _lazy7(isEquals) {
964
+ return (value, index, array) => {
965
+ if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
966
+ return {
967
+ done: false,
968
+ hasNext: true,
969
+ next: value
970
+ };
971
+ }
972
+ return {
973
+ done: false,
974
+ hasNext: false
975
+ };
976
+ };
977
+ }
978
+ ((uniqWith2) => {
979
+ uniqWith2.lazy = toLazyIndexed(_lazy7);
980
+ })(uniqWith || (uniqWith = {}));
981
+ var isArray2 = Array.isArray;
982
+ function forEachObj(...args) {
983
+ return purry(_forEachObj(false), args);
984
+ }
985
+ function _forEachObj(indexed) {
986
+ return (object, fn) => {
987
+ for (const key in object) {
988
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
989
+ const val = object[key];
990
+ if (indexed) {
991
+ fn(val, key, object);
992
+ } else {
993
+ fn(val);
994
+ }
115
995
  }
116
996
  }
117
- ];
997
+ return object;
998
+ };
118
999
  }
119
-
120
- // src/configs/ignores.ts
121
- import fs from "fs";
122
- import parseGitignore from "parse-gitignore";
1000
+ ((forEachObj2) => {
1001
+ function indexed(...args) {
1002
+ return purry(_forEachObj(true), args);
1003
+ }
1004
+ forEachObj2.indexed = indexed;
1005
+ })(forEachObj || (forEachObj = {}));
1006
+ function fromPairs(entries) {
1007
+ const out = {};
1008
+ for (const [key, value] of entries) {
1009
+ out[key] = value;
1010
+ }
1011
+ return out;
1012
+ }
1013
+ ((fromPairs2) => {
1014
+ fromPairs2.strict = fromPairs2;
1015
+ })(fromPairs || (fromPairs = {}));
1016
+ function keys(source) {
1017
+ return Object.keys(source);
1018
+ }
1019
+ ((keys2) => {
1020
+ keys2.strict = keys2;
1021
+ })(keys || (keys = {}));
1022
+ function toPairs(object) {
1023
+ return Object.entries(object);
1024
+ }
1025
+ ((toPairs2) => {
1026
+ function strict(object) {
1027
+ return Object.entries(object);
1028
+ }
1029
+ toPairs2.strict = strict;
1030
+ })(toPairs || (toPairs = {}));
123
1031
 
124
1032
  // src/globs.ts
125
1033
  var GLOB_JS = "**/*.?([cm])js";
@@ -494,6 +1402,7 @@ function javascript(options = {}) {
494
1402
  argsIgnorePattern: "^_",
495
1403
  ignoreRestSiblings: true
496
1404
  }],
1405
+ ...default3.configs.recommended.rules,
497
1406
  ...overrides
498
1407
  }
499
1408
  },
@@ -1204,7 +2113,7 @@ function typescript(options) {
1204
2113
  componentExts = [],
1205
2114
  overrides = {},
1206
2115
  parserOptions = {},
1207
- tsconfigPath
2116
+ tsconfigPath = []
1208
2117
  } = options ?? {};
1209
2118
  const typeAwareRules = {
1210
2119
  "dot-notation": OFF,
@@ -1217,16 +2126,19 @@ function typescript(options) {
1217
2126
  "ts/no-implied-eval": ERROR,
1218
2127
  "ts/no-misused-promises": ERROR,
1219
2128
  "ts/no-throw-literal": ERROR,
1220
- "ts/no-unnecessary-type-assertion": ERROR,
1221
- "ts/no-unsafe-argument": ERROR,
1222
- "ts/no-unsafe-assignment": ERROR,
1223
- "ts/no-unsafe-call": ERROR,
1224
- "ts/no-unsafe-member-access": ERROR,
1225
- "ts/no-unsafe-return": ERROR,
1226
2129
  "ts/restrict-plus-operands": ERROR,
1227
2130
  "ts/restrict-template-expressions": ERROR,
1228
2131
  "ts/unbound-method": ERROR
1229
2132
  };
2133
+ let tsConfigOptions = {};
2134
+ let additionalTypeAwareRules = {};
2135
+ if (!isEmpty(tsconfigPath)) {
2136
+ tsConfigOptions = {
2137
+ project: tsconfigPath,
2138
+ tsconfigRootDir: process.cwd()
2139
+ };
2140
+ additionalTypeAwareRules = typeAwareRules;
2141
+ }
1230
2142
  return [
1231
2143
  {
1232
2144
  // Install the plugins without globs, so they can be configured separately.
@@ -1247,10 +2159,7 @@ function typescript(options) {
1247
2159
  parser: parserTs,
1248
2160
  parserOptions: {
1249
2161
  sourceType: "module",
1250
- ...tsconfigPath ? {
1251
- project: [tsconfigPath],
1252
- tsconfigRootDir: process.cwd()
1253
- } : {},
2162
+ ...tsConfigOptions,
1254
2163
  ...parserOptions
1255
2164
  }
1256
2165
  },
@@ -1304,7 +2213,7 @@ function typescript(options) {
1304
2213
  "vinicunca/named-tuple-spacing": ERROR,
1305
2214
  "vinicunca/no-cjs-exports": ERROR,
1306
2215
  "vinicunca/no-ts-export-equal": ERROR,
1307
- ...tsconfigPath ? typeAwareRules : {},
2216
+ ...additionalTypeAwareRules,
1308
2217
  ...overrides
1309
2218
  }
1310
2219
  },
@@ -1367,10 +2276,20 @@ function unicorn(options = {}) {
1367
2276
  }
1368
2277
 
1369
2278
  // src/configs/vue.ts
2279
+ import process2 from "process";
1370
2280
  function vue(options = {}) {
1371
2281
  const {
2282
+ typescript: typescript2 = {},
1372
2283
  overrides = {}
1373
2284
  } = options;
2285
+ let tsConfigOptions = {};
2286
+ const tsconfigPath = typescript2.tsconfigPath ?? [];
2287
+ if (!isEmpty(tsconfigPath)) {
2288
+ tsConfigOptions = {
2289
+ project: tsconfigPath,
2290
+ tsconfigRootDir: process2.cwd()
2291
+ };
2292
+ }
1374
2293
  return [
1375
2294
  {
1376
2295
  name: "vinicunca:vue:setup",
@@ -1388,8 +2307,9 @@ function vue(options = {}) {
1388
2307
  jsx: true
1389
2308
  },
1390
2309
  extraFileExtensions: [".vue"],
1391
- parser: options.typescript ? parserTs : null,
1392
- sourceType: "module"
2310
+ parser: typescript2.enabled ? parserTs : void 0,
2311
+ sourceType: "module",
2312
+ ...tsConfigOptions
1393
2313
  }
1394
2314
  },
1395
2315
  processor: default14.processors[".vue"],
@@ -1542,9 +2462,9 @@ var VuePackages = [
1542
2462
  ];
1543
2463
  function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1544
2464
  const {
1545
- isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI),
2465
+ isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
1546
2466
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1547
- typescript: enableTypeScript = isPackageExists("typescript"),
2467
+ typescript: tsOptions = {},
1548
2468
  stylistic: enableStylistic = true,
1549
2469
  test: enableTest = true,
1550
2470
  jsonc: enableJsonc = true,
@@ -1569,9 +2489,13 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1569
2489
  if (enableVue) {
1570
2490
  componentExts.push("vue");
1571
2491
  }
1572
- if (enableTypeScript) {
2492
+ const {
2493
+ enabled: tsEnabled = isPackageExists("typescript"),
2494
+ ...tsParams
2495
+ } = tsOptions;
2496
+ if (tsEnabled) {
1573
2497
  configs.push(typescript({
1574
- ...!isBoolean(enableTypeScript) ? enableTypeScript : {},
2498
+ ...tsParams,
1575
2499
  componentExts,
1576
2500
  overrides: overrides.typescript
1577
2501
  }));
@@ -1588,7 +2512,10 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
1588
2512
  ;
1589
2513
  if (enableVue) {
1590
2514
  configs.push(vue({
1591
- typescript: !!enableTypeScript,
2515
+ typescript: {
2516
+ enabled: tsEnabled,
2517
+ ...tsParams
2518
+ },
1592
2519
  overrides: overrides.vue
1593
2520
  }));
1594
2521
  }