@vinicunca/eslint-config 2.6.1 → 2.7.0-beta.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,760 +1,14 @@
1
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.5.4/node_modules/@vinicunca/perkakas/dist/index.mjs
2
- function purry(fn, args, lazyFactory) {
3
- const callArgs = Array.from(args);
4
- const diff = fn.length - args.length;
5
- if (diff === 0) {
6
- return fn(...callArgs);
7
- }
8
- if (diff === 1) {
9
- const ret = (data) => fn(data, ...callArgs);
10
- const lazy = lazyFactory ?? fn.lazy;
11
- return lazy === void 0 ? ret : Object.assign(ret, { lazy, lazyArgs: args });
12
- }
13
- throw new Error("Wrong number of arguments");
14
- }
15
- function purryOn(isArg, implementation, args) {
16
- const callArgs = Array.from(args);
17
- return isArg(args[0]) ? (data) => implementation(data, ...callArgs) : implementation(...callArgs);
18
- }
19
- function conditional(...args) {
20
- return purryOn(isCase, conditionalImplementation, args);
21
- }
22
- function conditionalImplementation(data, ...cases) {
23
- for (const [when, then] of cases) {
24
- if (when(data)) {
25
- return then(data);
26
- }
27
- }
28
- throw new Error("conditional: data failed for all cases");
29
- }
30
- function isCase(maybeCase) {
31
- if (!Array.isArray(maybeCase)) {
32
- return false;
33
- }
34
- const [when, then, ...rest] = maybeCase;
35
- return typeof when === "function" && when.length <= 1 && typeof then === "function" && then.length <= 1 && rest.length === 0;
36
- }
37
- var trivialDefaultCase = () => void 0;
38
- ((conditional2) => {
39
- function defaultCase(then = trivialDefaultCase) {
40
- return [() => true, then];
41
- }
42
- conditional2.defaultCase = defaultCase;
43
- })(conditional || (conditional = {}));
44
- function _reduceLazy(array, lazy, isIndexed = false) {
45
- const out = [];
46
- for (let index = 0; index < array.length; index++) {
47
- const item = array[index];
48
- const result = isIndexed ? lazy(item, index, array) : lazy(item);
49
- if (result.hasMany === true) {
50
- out.push(...result.next);
51
- } else if (result.hasNext) {
52
- out.push(result.next);
53
- }
54
- if (result.done) {
55
- break;
56
- }
57
- }
58
- return out;
59
- }
60
- function differenceWith(...args) {
61
- return purry(differenceWith_, args, differenceWith.lazy);
62
- }
63
- function differenceWith_(array, other, isEquals) {
64
- const lazy = differenceWith.lazy(other, isEquals);
65
- return _reduceLazy(array, lazy);
66
- }
67
- ((differenceWith2) => {
68
- function lazy(other, isEquals) {
69
- return (value) => other.every((otherValue) => !isEquals(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
70
- }
71
- differenceWith2.lazy = lazy;
72
- })(differenceWith || (differenceWith = {}));
73
- var COMPARATORS = {
74
- asc: (x, y) => x > y,
75
- desc: (x, y) => x < y
76
- };
77
- function purryOrderRules(func, inputArgs) {
78
- const [dataOrRule, ...rules] = Array.isArray(inputArgs) ? inputArgs : Array.from(inputArgs);
79
- if (!isOrderRule(dataOrRule)) {
80
- const compareFn2 = orderRuleComparer(...rules);
81
- return func(dataOrRule, compareFn2);
82
- }
83
- const compareFn = orderRuleComparer(dataOrRule, ...rules);
84
- return (data) => func(data, compareFn);
85
- }
86
- function orderRuleComparer(primaryRule, secondaryRule, ...otherRules) {
87
- const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
88
- const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
89
- const { [direction]: comparator } = COMPARATORS;
90
- const nextComparer = secondaryRule === void 0 ? void 0 : orderRuleComparer(secondaryRule, ...otherRules);
91
- return (a, b) => {
92
- const projectedA = projector(a);
93
- const projectedB = projector(b);
94
- if (comparator(projectedA, projectedB)) {
95
- return 1;
96
- }
97
- if (comparator(projectedB, projectedA)) {
98
- return -1;
99
- }
100
- return (nextComparer == null ? void 0 : nextComparer(a, b)) ?? 0;
101
- };
102
- }
103
- function isOrderRule(x) {
104
- if (isProjection(x)) {
105
- return true;
106
- }
107
- if (typeof x !== "object" || !Array.isArray(x)) {
108
- return false;
109
- }
110
- const [maybeProjection, maybeDirection, ...rest] = x;
111
- return isProjection(maybeProjection) && maybeDirection in COMPARATORS && rest.length === 0;
112
- }
113
- function isProjection(x) {
114
- return typeof x === "function" && x.length === 1;
1
+ // ../node_modules/.pnpm/@vinicunca+perkakas@1.0.2/node_modules/@vinicunca/perkakas/dist/chunk-HLL46USD.js
2
+ function r(e2) {
3
+ if (typeof e2 != "object" || e2 === null) return false;
4
+ let o = Object.getPrototypeOf(e2);
5
+ return o === null || o === Object.prototype;
115
6
  }
116
- function drop(...args) {
117
- return purry(drop_, args, drop.lazy);
118
- }
119
- function drop_(array, n) {
120
- return _reduceLazy(array, drop.lazy(n));
121
- }
122
- ((drop2) => {
123
- function lazy(n) {
124
- let left = n;
125
- return (value) => {
126
- if (left > 0) {
127
- left -= 1;
128
- return { done: false, hasNext: false };
129
- }
130
- return { done: false, hasNext: true, next: value };
131
- };
132
- }
133
- drop2.lazy = lazy;
134
- })(drop || (drop = {}));
135
- function entries(...args) {
136
- return purry(Object.entries, args);
137
- }
138
- ((entries2) => {
139
- entries2.strict = entries2;
140
- })(entries || (entries = {}));
141
- function _toLazyIndexed(fn) {
142
- return Object.assign(fn, { indexed: true });
143
- }
144
- function filter(...args) {
145
- return purry(filter_(false), args, filter.lazy);
146
- }
147
- function filter_(indexed) {
148
- return (array, fn) => {
149
- return _reduceLazy(
150
- array,
151
- indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
152
- indexed
153
- );
154
- };
155
- }
156
- function lazy_$5(indexed) {
157
- return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
158
- }
159
- ((filter2) => {
160
- function indexed(...args) {
161
- return purry(filter_(true), args, filter2.lazyIndexed);
162
- }
163
- filter2.indexed = indexed;
164
- filter2.lazy = lazy_$5(false);
165
- filter2.lazyIndexed = _toLazyIndexed(lazy_$5(true));
166
- })(filter || (filter = {}));
167
- function _toSingle(fn) {
168
- return Object.assign(fn, { single: true });
169
- }
170
- function findIndex(...args) {
171
- return purry(findIndex_(false), args, findIndex.lazy);
172
- }
173
- function findIndex_(indexed) {
174
- return (array, fn) => array.findIndex((item, index, input) => indexed ? fn(item, index, input) : fn(item));
175
- }
176
- function lazy_$4(indexed) {
177
- return (fn) => {
178
- let actualIndex = 0;
179
- return (value, index, array) => {
180
- if (indexed ? fn(value, index, array) : fn(value)) {
181
- return { done: true, hasNext: true, next: actualIndex };
182
- }
183
- actualIndex += 1;
184
- return { done: false, hasNext: false };
185
- };
186
- };
187
- }
188
- ((findIndex2) => {
189
- function indexed(...args) {
190
- return purry(findIndex_(true), args, findIndex2.lazyIndexed);
191
- }
192
- findIndex2.indexed = indexed;
193
- findIndex2.lazy = _toSingle(lazy_$4(false));
194
- findIndex2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$4(true)));
195
- })(findIndex || (findIndex = {}));
196
- function findLastIndex(...args) {
197
- return purry(findLastIndex_(false), args);
198
- }
199
- function findLastIndex_(indexed) {
200
- return (array, fn) => {
201
- for (let i = array.length - 1; i >= 0; i--) {
202
- if (indexed ? fn(array[i], i, array) : fn(array[i])) {
203
- return i;
204
- }
205
- }
206
- return -1;
207
- };
208
- }
209
- ((findLastIndex2) => {
210
- function indexed(...args) {
211
- return purry(findLastIndex_(true), args);
212
- }
213
- findLastIndex2.indexed = indexed;
214
- })(findLastIndex || (findLastIndex = {}));
215
- function findLast(...args) {
216
- return purry(findLast_(false), args);
217
- }
218
- function findLast_(indexed) {
219
- return (array, fn) => {
220
- for (let i = array.length - 1; i >= 0; i--) {
221
- if (indexed ? fn(array[i], i, array) : fn(array[i])) {
222
- return array[i];
223
- }
224
- }
225
- return void 0;
226
- };
227
- }
228
- ((findLast2) => {
229
- function indexed(...args) {
230
- return purry(findLast_(true), args);
231
- }
232
- findLast2.indexed = indexed;
233
- })(findLast || (findLast = {}));
234
- function find(...args) {
235
- return purry(find_(false), args, find.lazy);
236
- }
237
- function find_(indexed) {
238
- return (array, fn) => array.find((item, index, input) => indexed ? fn(item, index, input) : fn(item));
239
- }
240
- function lazy_$3(indexed) {
241
- return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: true, hasNext: true, next: value } : { done: false, hasNext: false };
242
- }
243
- ((find2) => {
244
- function indexed(...args) {
245
- return purry(find_(true), args, find2.lazyIndexed);
246
- }
247
- find2.indexed = indexed;
248
- find2.lazy = _toSingle(lazy_$3(false));
249
- find2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$3(true)));
250
- })(find || (find = {}));
251
- function first(...args) {
252
- return purry(first_, args, first.lazy);
253
- }
254
- function first_([item]) {
255
- return item;
256
- }
257
- ((first2) => {
258
- function lazy() {
259
- return (value) => ({ done: true, hasNext: true, next: value });
260
- }
261
- first2.lazy = lazy;
262
- ((lazy2) => {
263
- lazy2.single = true;
264
- })(lazy = first2.lazy || (first2.lazy = {}));
265
- })(first || (first = {}));
266
- function flatten(...args) {
267
- return purry(flatten_, args, flatten.lazy);
268
- }
269
- function flatten_(items) {
270
- return _reduceLazy(items, flatten.lazy());
271
- }
272
- ((flatten2) => {
273
- function lazy() {
274
- return (item) => (
275
- // @ts-expect-error [ts2322] - We need to make LazyMany better so it accommodate the typing here...
276
- Array.isArray(item) ? { done: false, hasMany: true, hasNext: true, next: item } : { done: false, hasNext: true, next: item }
277
- );
278
- }
279
- flatten2.lazy = lazy;
280
- })(flatten || (flatten = {}));
281
- function flatMap(...args) {
282
- return purry(flatMap_, args, flatMap.lazy);
283
- }
284
- function flatMap_(array, fn) {
285
- return flatten(array.map((item) => fn(item)));
286
- }
287
- ((flatMap2) => {
288
- function lazy(fn) {
289
- return (value) => {
290
- const next = fn(value);
291
- return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
292
- };
293
- }
294
- flatMap2.lazy = lazy;
295
- })(flatMap || (flatMap = {}));
296
- function flattenDeep(...args) {
297
- return purry(flattenDeep_, args, flattenDeep.lazy);
298
- }
299
- function flattenDeep_(items) {
300
- return _reduceLazy(items, flattenDeep.lazy());
301
- }
302
- function flattenDeepValue_(value) {
303
- if (!Array.isArray(value)) {
304
- return value;
305
- }
306
- const ret = [];
307
- for (const item of value) {
308
- if (Array.isArray(item)) {
309
- ret.push(...flattenDeep(item));
310
- } else {
311
- ret.push(item);
312
- }
313
- }
314
- return ret;
315
- }
316
- ((flattenDeep2) => {
317
- function lazy() {
318
- return (value) => {
319
- const next = flattenDeepValue_(value);
320
- return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
321
- };
322
- }
323
- flattenDeep2.lazy = lazy;
324
- })(flattenDeep || (flattenDeep = {}));
325
- function forEachObj(...args) {
326
- return purry(forEachObj_(false), args);
327
- }
328
- function forEachObj_(indexed) {
329
- return (data, fn) => {
330
- for (const key in data) {
331
- if (Object.prototype.hasOwnProperty.call(data, key)) {
332
- const { [key]: val } = data;
333
- if (indexed) {
334
- fn(val, key, data);
335
- } else {
336
- fn(val);
337
- }
338
- }
339
- }
340
- return data;
341
- };
342
- }
343
- ((forEachObj2) => {
344
- function indexed(...args) {
345
- return purry(forEachObj_(true), args);
346
- }
347
- forEachObj2.indexed = indexed;
348
- })(forEachObj || (forEachObj = {}));
349
- function forEach(...args) {
350
- return purry(forEach_(false), args, forEach.lazy);
351
- }
352
- function forEach_(indexed) {
353
- return (array, fn) => _reduceLazy(
354
- array,
355
- indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
356
- indexed
357
- );
358
- }
359
- function lazy_$2(indexed) {
360
- return (fn) => (value, index, array) => {
361
- if (indexed) {
362
- fn(value, index, array);
363
- } else {
364
- fn(value);
365
- }
366
- return {
367
- done: false,
368
- hasNext: true,
369
- next: value
370
- };
371
- };
372
- }
373
- ((forEach2) => {
374
- function indexed(...args) {
375
- return purry(forEach_(true), args, forEach2.lazyIndexed);
376
- }
377
- forEach2.indexed = indexed;
378
- forEach2.lazy = lazy_$2(false);
379
- forEach2.lazyIndexed = _toLazyIndexed(lazy_$2(true));
380
- })(forEach || (forEach = {}));
381
- function fromEntries(...args) {
382
- return purry(fromEntriesImplementation, args);
383
- }
384
- function fromEntriesImplementation(entries2) {
385
- const out = {};
386
- for (const [key, value] of entries2) {
387
- out[key] = value;
388
- }
389
- return out;
390
- }
391
- ((fromEntries2) => {
392
- fromEntries2.strict = fromEntries2;
393
- })(fromEntries || (fromEntries = {}));
394
- function groupBy(...args) {
395
- return purry(groupBy_(false), args);
396
- }
397
- function groupBy_(indexed) {
398
- return (array, fn) => {
399
- const ret = {};
400
- for (const [index, item] of array.entries()) {
401
- const key = indexed ? fn(item, index, array) : fn(item);
402
- if (key !== void 0) {
403
- const actualKey = String(key);
404
- let items = ret[actualKey];
405
- if (items === void 0) {
406
- items = [];
407
- ret[actualKey] = items;
408
- }
409
- items.push(item);
410
- }
411
- }
412
- return ret;
413
- };
414
- }
415
- ((groupBy2) => {
416
- function indexed(...args) {
417
- return purry(groupBy_(true), args);
418
- }
419
- groupBy2.indexed = indexed;
420
- groupBy2.strict = groupBy2;
421
- })(groupBy || (groupBy = {}));
422
- function indexBy(...args) {
423
- return purry(indexBy_(false), args);
424
- }
425
- function indexBy_(indexed) {
426
- return (array, fn) => {
427
- const out = {};
428
- for (const [index, item] of array.entries()) {
429
- const value = indexed ? fn(item, index, array) : fn(item);
430
- const key = String(value);
431
- out[key] = item;
432
- }
433
- return out;
434
- };
435
- }
436
- function indexByStrict(...args) {
437
- return purry(indexByStrict_, args);
438
- }
439
- function indexByStrict_(array, fn) {
440
- const out = {};
441
- for (const item of array) {
442
- const key = fn(item);
443
- out[key] = item;
444
- }
445
- return out;
446
- }
447
- ((indexBy2) => {
448
- function indexed(...args) {
449
- return purry(indexBy_(true), args);
450
- }
451
- indexBy2.indexed = indexed;
452
- indexBy2.strict = indexByStrict;
453
- })(indexBy || (indexBy = {}));
454
- function intersectionWith(...args) {
455
- return purry(intersectionWith_, args, intersectionWith.lazy);
456
- }
457
- function intersectionWith_(array, other, comparator) {
458
- const lazy = intersectionWith.lazy(other, comparator);
459
- return _reduceLazy(array, lazy);
460
- }
461
- ((intersectionWith2) => {
462
- function lazy(other, comparator) {
463
- return (value) => other.some((otherValue) => comparator(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
464
- }
465
- intersectionWith2.lazy = lazy;
466
- })(intersectionWith || (intersectionWith = {}));
467
- function isBoolean(data) {
468
- return typeof data === "boolean";
469
- }
470
- function isDefined(data) {
471
- return data !== void 0 && data !== null;
472
- }
473
- ((isDefined2) => {
474
- function strict(data) {
475
- return data !== void 0;
476
- }
477
- isDefined2.strict = strict;
478
- })(isDefined || (isDefined = {}));
479
- function isObject(data) {
480
- if (typeof data !== "object" || data === null) {
481
- return false;
482
- }
483
- const proto = Object.getPrototypeOf(data);
484
- return proto === null || proto === Object.prototype;
485
- }
486
- function keys(...args) {
487
- return purry(Object.keys, args);
488
- }
489
- ((keys2) => {
490
- keys2.strict = keys2;
491
- })(keys || (keys = {}));
492
- function mapToObj(...args) {
493
- return purry(mapToObj_(false), args);
494
- }
495
- function mapToObj_(indexed) {
496
- return (array, fn) => {
497
- const out = {};
498
- for (const [index, element] of array.entries()) {
499
- const [key, value] = indexed ? fn(element, index, array) : fn(element);
500
- out[key] = value;
501
- }
502
- return out;
503
- };
504
- }
505
- ((mapToObj2) => {
506
- function indexed(...args) {
507
- return purry(mapToObj_(true), args);
508
- }
509
- mapToObj2.indexed = indexed;
510
- })(mapToObj || (mapToObj = {}));
511
- function map(...args) {
512
- return purry(map_(false), args, map.lazy);
513
- }
514
- function map_(indexed) {
515
- return (array, fn) => {
516
- return _reduceLazy(
517
- array,
518
- indexed ? map.lazyIndexed(fn) : map.lazy(fn),
519
- indexed
520
- );
521
- };
522
- }
523
- function lazy_$1(indexed) {
524
- return (fn) => (value, index, array) => ({
525
- done: false,
526
- hasNext: true,
527
- next: indexed ? fn(value, index, array) : fn(value)
528
- });
529
- }
530
- ((map2) => {
531
- function indexed(...args) {
532
- return purry(map_(true), args, map2.lazyIndexed);
533
- }
534
- map2.indexed = indexed;
535
- map2.lazy = lazy_$1(false);
536
- map2.lazyIndexed = _toLazyIndexed(lazy_$1(true));
537
- map2.strict = map2;
538
- })(map || (map = {}));
539
- function meanBy_(indexed) {
540
- return (array, fn) => {
541
- if (array.length === 0) {
542
- return Number.NaN;
543
- }
544
- let sum = 0;
545
- for (const [index, item] of array.entries()) {
546
- sum += indexed ? fn(item, index, array) : fn(item);
547
- }
548
- return sum / array.length;
549
- };
550
- }
551
- function meanBy(...args) {
552
- return purry(meanBy_(false), args);
553
- }
554
- ((meanBy2) => {
555
- function indexed(...args) {
556
- return purry(meanBy_(true), args);
557
- }
558
- meanBy2.indexed = indexed;
559
- })(meanBy || (meanBy = {}));
560
- function partition(...args) {
561
- return purry(partition_(false), args);
562
- }
563
- function partition_(indexed) {
564
- return (array, fn) => {
565
- const ret = [[], []];
566
- for (const [index, item] of array.entries()) {
567
- const matches = indexed ? fn(item, index, array) : fn(item);
568
- ret[matches ? 0 : 1].push(item);
569
- }
570
- return ret;
571
- };
572
- }
573
- ((partition2) => {
574
- function indexed(...args) {
575
- return purry(partition_(true), args);
576
- }
577
- partition2.indexed = indexed;
578
- })(partition || (partition = {}));
579
- function reduce(...args) {
580
- return purry(reduce_(false), args);
581
- }
582
- function reduce_(indexed) {
583
- return (items, fn, initialValue) => {
584
- return items.reduce(
585
- (acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
586
- initialValue
587
- );
588
- };
589
- }
590
- ((reduce2) => {
591
- function indexed(...args) {
592
- return purry(reduce_(true), args);
593
- }
594
- reduce2.indexed = indexed;
595
- })(reduce || (reduce = {}));
596
- function sortBy(...args) {
597
- return purryOrderRules(_sortBy, args);
598
- }
599
- function _sortBy(data, compareFn) {
600
- return data.slice().sort(compareFn);
601
- }
602
- ((sortBy2) => {
603
- sortBy2.strict = sortBy2;
604
- })(sortBy || (sortBy = {}));
605
- function sort(...args) {
606
- return purry(sort_, args);
607
- }
608
- function sort_(items, cmp) {
609
- const ret = items.slice();
610
- ret.sort(cmp);
611
- return ret;
612
- }
613
- ((sort2) => {
614
- sort2.strict = sort2;
615
- })(sort || (sort = {}));
616
- function _binarySearchCutoffIndex(array, predicate) {
617
- let lowIndex = 0;
618
- let highIndex = array.length;
619
- while (lowIndex < highIndex) {
620
- const pivotIndex = lowIndex + highIndex >>> 1;
621
- const pivot = array[pivotIndex];
622
- if (predicate(pivot, pivotIndex)) {
623
- lowIndex = pivotIndex + 1;
624
- } else {
625
- highIndex = pivotIndex;
626
- }
627
- }
628
- return highIndex;
629
- }
630
- function sortedIndexBy(...args) {
631
- return purry(sortedIndexByImplementation, args);
632
- }
633
- ((sortedIndexBy2) => {
634
- function indexed(...args) {
635
- return purry(sortedIndexByImplementation, args);
636
- }
637
- sortedIndexBy2.indexed = indexed;
638
- })(sortedIndexBy || (sortedIndexBy = {}));
639
- function sortedIndexByImplementation(array, item, valueFunction) {
640
- const value = valueFunction(item);
641
- return _binarySearchCutoffIndex(
642
- array,
643
- (pivot, index) => valueFunction(pivot, index) < value
644
- );
645
- }
646
- function sortedIndexWith(...args) {
647
- return purry(_binarySearchCutoffIndex, args);
648
- }
649
- ((sortedIndexWith2) => {
650
- function indexed(...args) {
651
- return purry(_binarySearchCutoffIndex, args);
652
- }
653
- sortedIndexWith2.indexed = indexed;
654
- })(sortedIndexWith || (sortedIndexWith = {}));
655
- function sortedLastIndexBy(...args) {
656
- return purry(sortedLastIndexByImplementation, args);
657
- }
658
- ((sortedLastIndexBy2) => {
659
- function indexed(...args) {
660
- return purry(sortedLastIndexByImplementation, args);
661
- }
662
- sortedLastIndexBy2.indexed = indexed;
663
- })(sortedLastIndexBy || (sortedLastIndexBy = {}));
664
- function sortedLastIndexByImplementation(array, item, valueFunction) {
665
- const value = valueFunction(item);
666
- return _binarySearchCutoffIndex(
667
- array,
668
- // The only difference between the regular implementation and the "last"
669
- // variation is that we consider the pivot with equality too, so that we
670
- // skip all equal values in addition to the lower ones.
671
- (pivot, index) => valueFunction(pivot, index) <= value
672
- );
673
- }
674
- function sumBy_(indexed) {
675
- return (array, fn) => {
676
- let sum = 0;
677
- for (const [index, item] of array.entries()) {
678
- const summand = indexed ? fn(item, index, array) : fn(item);
679
- sum += summand;
680
- }
681
- return sum;
682
- };
683
- }
684
- function sumBy(...args) {
685
- return purry(sumBy_(false), args);
686
- }
687
- ((sumBy2) => {
688
- function indexed(...args) {
689
- return purry(sumBy_(true), args);
690
- }
691
- sumBy2.indexed = indexed;
692
- })(sumBy || (sumBy = {}));
693
- function take(...args) {
694
- return purry(take_, args, take.lazy);
695
- }
696
- function take_(array, n) {
697
- return _reduceLazy(array, take.lazy(n));
698
- }
699
- ((take2) => {
700
- function lazy(n) {
701
- if (n <= 0) {
702
- return () => ({ done: true, hasNext: false });
703
- }
704
- let remaining = n;
705
- return (value) => {
706
- remaining -= 1;
707
- return { done: remaining <= 0, hasNext: true, next: value };
708
- };
709
- }
710
- take2.lazy = lazy;
711
- })(take || (take = {}));
712
- function uniqueWith(...args) {
713
- return purry(uniqueWithImplementation, args, uniqueWith.lazy);
714
- }
715
- function uniqueWithImplementation(array, isEquals) {
716
- const lazy = uniqueWith.lazy(isEquals);
717
- return _reduceLazy(array, lazy, true);
718
- }
719
- function lazy_(isEquals) {
720
- return (value, index, array) => array !== void 0 && array.findIndex((otherValue) => isEquals(value, otherValue)) === index ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
721
- }
722
- ((uniqueWith2) => {
723
- uniqueWith2.lazy = _toLazyIndexed(lazy_);
724
- })(uniqueWith || (uniqueWith = {}));
725
- function unique(...args) {
726
- return purry(uniqueImplementation, args, unique.lazy);
727
- }
728
- function uniqueImplementation(array) {
729
- return _reduceLazy(array, unique.lazy());
730
- }
731
- ((unique2) => {
732
- function lazy() {
733
- const set = /* @__PURE__ */ new Set();
734
- return (value) => {
735
- if (set.has(value)) {
736
- return { done: false, hasNext: false };
737
- }
738
- set.add(value);
739
- return { done: false, hasNext: true, next: value };
740
- };
741
- }
742
- unique2.lazy = lazy;
743
- })(unique || (unique = {}));
744
- function zip(...args) {
745
- return purry(zip_, args);
746
- }
747
- function zip_(first2, second) {
748
- const resultLength = first2.length > second.length ? second.length : first2.length;
749
- const result = [];
750
- for (let i = 0; i < resultLength; i++) {
751
- result.push([first2[i], second[i]]);
752
- }
753
- return result;
7
+
8
+ // ../node_modules/.pnpm/@vinicunca+perkakas@1.0.2/node_modules/@vinicunca/perkakas/dist/chunk-AZUJCNUP.js
9
+ function e(o) {
10
+ return typeof o == "boolean";
754
11
  }
755
- ((zip2) => {
756
- zip2.strict = zip2;
757
- })(zip || (zip = {}));
758
12
 
759
13
  // src/base.ts
760
14
  import { FlatConfigComposer } from "eslint-flat-config-utils";
@@ -859,6 +113,8 @@ var GLOB_EXCLUDE = [
859
113
  "**/.cache",
860
114
  "**/.output",
861
115
  "**/.vite-inspect",
116
+ "**/.yarn",
117
+ "**/vite.config.*.timestamp-*",
862
118
  "**/CHANGELOG*.md",
863
119
  "**/*.min.*",
864
120
  "**/LICENSE*",
@@ -872,10 +128,10 @@ async function combineConfigs(...configs2) {
872
128
  const resolved = await Promise.all(configs2);
873
129
  return resolved.flat();
874
130
  }
875
- function renameRules(rules, map2) {
131
+ function renameRules(rules, map) {
876
132
  return Object.fromEntries(
877
133
  Object.entries(rules).map(([key, value]) => {
878
- for (const [from, to] of Object.entries(map2)) {
134
+ for (const [from, to] of Object.entries(map)) {
879
135
  if (key.startsWith(`${from}/`)) {
880
136
  return [to + key.slice(from.length), value];
881
137
  }
@@ -884,17 +140,17 @@ function renameRules(rules, map2) {
884
140
  })
885
141
  );
886
142
  }
887
- function renamePluginInConfigs(configs2, map2) {
143
+ function renamePluginInConfigs(configs2, map) {
888
144
  return configs2.map((i) => {
889
145
  const clone = { ...i };
890
146
  if (clone.rules) {
891
- clone.rules = renameRules(clone.rules, map2);
147
+ clone.rules = renameRules(clone.rules, map);
892
148
  }
893
149
  if (clone.plugins) {
894
150
  clone.plugins = Object.fromEntries(
895
151
  Object.entries(clone.plugins).map(([key, value]) => {
896
- if (key in map2) {
897
- return [map2[key], value];
152
+ if (key in map) {
153
+ return [map[key], value];
898
154
  }
899
155
  return [key, value];
900
156
  })
@@ -942,7 +198,7 @@ var STYLISTIC_CONFIG_DEFAULTS = {
942
198
  async function stylistic(options = {}) {
943
199
  const {
944
200
  indent,
945
- jsx,
201
+ jsx: jsx2,
946
202
  overrides = {},
947
203
  quotes,
948
204
  semi
@@ -954,7 +210,7 @@ async function stylistic(options = {}) {
954
210
  const config = pluginStylistic.configs.customize({
955
211
  flat: true,
956
212
  indent,
957
- jsx,
213
+ jsx: jsx2,
958
214
  pluginName: "style",
959
215
  quotes,
960
216
  semi
@@ -968,6 +224,8 @@ async function stylistic(options = {}) {
968
224
  },
969
225
  rules: {
970
226
  ...config.rules,
227
+ "antfu/consistent-list-newline": "error",
228
+ "antfu/top-level-function": "error",
971
229
  "curly": [ERROR, "all"],
972
230
  "style/array-bracket-newline": [ERROR, CONSISTENT],
973
231
  "style/array-bracket-spacing": [ERROR, NEVER],
@@ -1261,6 +519,9 @@ async function javascript(options = {}) {
1261
519
  linterOptions: {
1262
520
  reportUnusedDisableDirectives: true
1263
521
  },
522
+ name: "vinicunca/javascript/setup"
523
+ },
524
+ {
1264
525
  name: "vinicunca/javascript/rules",
1265
526
  plugins: {
1266
527
  "antfu": default2,
@@ -1546,7 +807,7 @@ async function jsonc(options = {}) {
1546
807
  } = options;
1547
808
  const {
1548
809
  indent = 2
1549
- } = isBoolean(stylistic2) ? {} : stylistic2;
810
+ } = e(stylistic2) ? {} : stylistic2;
1550
811
  const [
1551
812
  pluginJsonc,
1552
813
  parserJsonc
@@ -1612,6 +873,23 @@ async function jsonc(options = {}) {
1612
873
  ];
1613
874
  }
1614
875
 
876
+ // src/configs/jsx.ts
877
+ async function jsx() {
878
+ return [
879
+ {
880
+ files: [GLOB_JSX, GLOB_TSX],
881
+ languageOptions: {
882
+ parserOptions: {
883
+ ecmaFeatures: {
884
+ jsx: true
885
+ }
886
+ }
887
+ },
888
+ name: "vinicunca/jsx/setup"
889
+ }
890
+ ];
891
+ }
892
+
1615
893
  // src/configs/markdown.ts
1616
894
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
1617
895
  async function markdown(options = {}) {
@@ -1682,25 +960,6 @@ async function markdown(options = {}) {
1682
960
  "unicode-bom": OFF,
1683
961
  "unused-imports/no-unused-imports": OFF,
1684
962
  "unused-imports/no-unused-vars": OFF,
1685
- // Type aware rules
1686
- ...{
1687
- "ts/await-thenable": OFF,
1688
- "ts/dot-notation": OFF,
1689
- "ts/no-floating-promises": OFF,
1690
- "ts/no-for-in-array": OFF,
1691
- "ts/no-implied-eval": OFF,
1692
- "ts/no-misused-promises": OFF,
1693
- "ts/no-throw-literal": OFF,
1694
- "ts/no-unnecessary-type-assertion": OFF,
1695
- "ts/no-unsafe-argument": OFF,
1696
- "ts/no-unsafe-assignment": OFF,
1697
- "ts/no-unsafe-call": OFF,
1698
- "ts/no-unsafe-member-access": OFF,
1699
- "ts/no-unsafe-return": OFF,
1700
- "ts/restrict-plus-operands": OFF,
1701
- "ts/restrict-template-expressions": OFF,
1702
- "ts/unbound-method": OFF
1703
- },
1704
963
  ...overrides
1705
964
  }
1706
965
  }
@@ -1771,7 +1030,7 @@ async function perfectionist() {
1771
1030
  // src/configs/react.ts
1772
1031
  async function react(options = {}) {
1773
1032
  const {
1774
- files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
1033
+ files = [GLOB_SRC],
1775
1034
  overrides = {}
1776
1035
  } = options;
1777
1036
  const [
@@ -1907,6 +1166,7 @@ async function sortPackageJson() {
1907
1166
  "packageManager",
1908
1167
  "description",
1909
1168
  "author",
1169
+ "contributors",
1910
1170
  "license",
1911
1171
  "funding",
1912
1172
  "homepage",
@@ -2172,12 +1432,14 @@ async function typescript(options = {}) {
2172
1432
  ...componentExts.map((ext) => `**/*.${ext}`)
2173
1433
  ];
2174
1434
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1435
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
1436
+ `${GLOB_MARKDOWN}/**`
1437
+ ];
2175
1438
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2176
1439
  const isTypeAware = !!tsconfigPath;
2177
1440
  const typeAwareRules = {
2178
1441
  "dot-notation": OFF,
2179
1442
  "no-implied-eval": OFF,
2180
- "no-throw-literal": OFF,
2181
1443
  "ts/await-thenable": ERROR,
2182
1444
  "ts/dot-notation": [ERROR, { allowKeywords: true }],
2183
1445
  "ts/no-floating-promises": ERROR,
@@ -2185,16 +1447,18 @@ async function typescript(options = {}) {
2185
1447
  "ts/no-implied-eval": ERROR,
2186
1448
  // Temporary turning it off due to performance
2187
1449
  "ts/no-misused-promises": OFF,
2188
- "ts/no-throw-literal": ERROR,
2189
1450
  "ts/no-unnecessary-type-assertion": ERROR,
2190
1451
  "ts/no-unsafe-argument": ERROR,
2191
1452
  "ts/no-unsafe-assignment": ERROR,
2192
1453
  "ts/no-unsafe-call": ERROR,
2193
1454
  "ts/no-unsafe-member-access": ERROR,
2194
1455
  "ts/no-unsafe-return": ERROR,
1456
+ "ts/promise-function-async": "error",
2195
1457
  "ts/restrict-plus-operands": ERROR,
2196
1458
  "ts/restrict-template-expressions": ERROR,
2197
- "ts/strict-boolean-expressions": ERROR,
1459
+ "ts/return-await": [ERROR, "in-try-catch"],
1460
+ "ts/strict-boolean-expressions": [ERROR, { allowNullableBoolean: true, allowNullableObject: true }],
1461
+ "ts/switch-exhaustiveness-check": ERROR,
2198
1462
  "ts/unbound-method": ERROR
2199
1463
  };
2200
1464
  const [
@@ -2214,7 +1478,10 @@ async function typescript(options = {}) {
2214
1478
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
2215
1479
  sourceType: "module",
2216
1480
  ...typeAware ? {
2217
- project: tsconfigPath,
1481
+ projectService: {
1482
+ allowDefaultProject: ["./*.js"],
1483
+ defaultProject: tsconfigPath
1484
+ },
2218
1485
  tsconfigRootDir: process.cwd()
2219
1486
  } : {},
2220
1487
  ...parserOptions
@@ -2234,9 +1501,11 @@ async function typescript(options = {}) {
2234
1501
  },
2235
1502
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
2236
1503
  ...isTypeAware ? [
2237
- makeParser({ files: filesTypeAware, typeAware: true }),
1504
+ makeParser({ files: filesTypeAware, ignores: ignoresTypeAware, typeAware: true }),
2238
1505
  makeParser({ files, ignores: filesTypeAware, typeAware: false })
2239
- ] : [makeParser({ files, typeAware: false })],
1506
+ ] : [
1507
+ makeParser({ files, typeAware: false })
1508
+ ],
2240
1509
  {
2241
1510
  files,
2242
1511
  name: "vinicunca/typescript/rules",
@@ -2258,7 +1527,6 @@ async function typescript(options = {}) {
2258
1527
  "no-useless-constructor": OFF,
2259
1528
  "ts/array-type": [ERROR, { default: "generic" }],
2260
1529
  "ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
2261
- "ts/ban-types": [ERROR, { types: { Function: false } }],
2262
1530
  "ts/consistent-type-definitions": [ERROR, "interface"],
2263
1531
  "ts/consistent-type-imports": [ERROR, { disallowTypeAnnotations: false, prefer: "type-imports" }],
2264
1532
  "ts/explicit-function-return-type": OFF,
@@ -2299,8 +1567,14 @@ async function typescript(options = {}) {
2299
1567
  ...overrides
2300
1568
  }
2301
1569
  },
1570
+ ...isTypeAware ? [{
1571
+ files: filesTypeAware,
1572
+ ignores: ignoresTypeAware,
1573
+ name: "vinicunca/typescript/rules-type-aware",
1574
+ rules: typeAwareRules
1575
+ }] : [],
2302
1576
  {
2303
- files: ["**/*.d.ts"],
1577
+ files: ["**/*.d.?([cm])ts"],
2304
1578
  name: "vinicunca/typescript/disables/dts",
2305
1579
  rules: {
2306
1580
  "eslint-comments/no-unlimited-disable": OFF,
@@ -2395,7 +1669,7 @@ async function vue(options = {}) {
2395
1669
  const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
2396
1670
  const {
2397
1671
  indent = 2
2398
- } = isBoolean(stylistic2) ? {} : stylistic2;
1672
+ } = e(stylistic2) ? {} : stylistic2;
2399
1673
  const [
2400
1674
  pluginVue,
2401
1675
  parserVue,
@@ -2546,7 +1820,7 @@ async function yaml(options = {}) {
2546
1820
  const {
2547
1821
  indent = 2,
2548
1822
  quotes = "single"
2549
- } = isBoolean(stylistic2) ? {} : stylistic2;
1823
+ } = e(stylistic2) ? {} : stylistic2;
2550
1824
  const [
2551
1825
  pluginYaml,
2552
1826
  parserYaml
@@ -2627,7 +1901,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2627
1901
  autoRenamePlugins = true,
2628
1902
  componentExts = [],
2629
1903
  gitignore: enableGitignore = true,
2630
- isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
1904
+ isInEditor = !!((process2.env.VSCODE_PID || process2.env.VSCODE_CWD || process2.env.JETBRAINS_IDE || process2.env.VIM || process2.env.NVIM) && !process2.env.CI),
1905
+ jsx: enableJsx = true,
2631
1906
  react: enableReact = false,
2632
1907
  regexp: enableRegexp = true,
2633
1908
  typescript: enableTypeScript = isPackageExists("typescript"),
@@ -2637,19 +1912,22 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2637
1912
  let stylisticOptions = {};
2638
1913
  if (options.stylistic === false) {
2639
1914
  stylisticOptions = false;
2640
- } else if (isObject(options.stylistic)) {
1915
+ } else if (r(options.stylistic)) {
2641
1916
  stylisticOptions = {
2642
1917
  ...options.stylistic,
2643
1918
  jsx: options.jsx ?? true
2644
1919
  };
2645
1920
  }
1921
+ if (stylisticOptions && !("jsx" in stylisticOptions)) {
1922
+ stylisticOptions.jsx = enableJsx;
1923
+ }
2646
1924
  const configs2 = [];
2647
1925
  if (enableGitignore) {
2648
1926
  if (typeof enableGitignore !== "boolean") {
2649
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
1927
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2(enableGitignore)]));
2650
1928
  } else {
2651
1929
  if (fs.existsSync(".gitignore")) {
2652
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
1930
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2()]));
2653
1931
  }
2654
1932
  }
2655
1933
  }
@@ -2674,6 +1952,9 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2674
1952
  if (enableVue) {
2675
1953
  componentExts.push("vue");
2676
1954
  }
1955
+ if (enableJsx) {
1956
+ configs2.push(jsx());
1957
+ }
2677
1958
  if (enableTypeScript) {
2678
1959
  configs2.push(typescript({
2679
1960
  ...typescriptOptions,
@@ -2776,7 +2057,7 @@ function getOverrides(options, key) {
2776
2057
  };
2777
2058
  }
2778
2059
  function resolveSubOptions(options, key) {
2779
- return isBoolean(options[key]) ? {} : options[key] || {};
2060
+ return e(options[key]) ? {} : options[key] || {};
2780
2061
  }
2781
2062
  export {
2782
2063
  GLOB_ALL_SRC,
@@ -2813,6 +2094,7 @@ export {
2813
2094
  javascript,
2814
2095
  jsdoc,
2815
2096
  jsonc,
2097
+ jsx,
2816
2098
  markdown,
2817
2099
  node,
2818
2100
  parserPlain,