@vinicunca/eslint-config 2.1.3 → 2.1.6
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.cjs +56 -1000
- package/dist/index.d.cts +21 -20
- package/dist/index.d.ts +21 -20
- package/dist/index.js +56 -1000
- package/package.json +29 -30
package/dist/index.cjs
CHANGED
|
@@ -88,967 +88,23 @@ __export(src_exports, {
|
|
|
88
88
|
});
|
|
89
89
|
module.exports = __toCommonJS(src_exports);
|
|
90
90
|
|
|
91
|
-
// ../node_modules/.pnpm/@vinicunca+perkakas@0.
|
|
92
|
-
function purry(fn, args, lazy) {
|
|
93
|
-
const diff = fn.length - args.length;
|
|
94
|
-
const arrayArgs = Array.from(args);
|
|
95
|
-
if (diff === 0) {
|
|
96
|
-
return fn(...arrayArgs);
|
|
97
|
-
}
|
|
98
|
-
if (diff === 1) {
|
|
99
|
-
const ret = (data) => fn(data, ...arrayArgs);
|
|
100
|
-
if (lazy || fn.lazy) {
|
|
101
|
-
ret.lazy = lazy || fn.lazy;
|
|
102
|
-
ret.lazyArgs = args;
|
|
103
|
-
}
|
|
104
|
-
return ret;
|
|
105
|
-
}
|
|
106
|
-
throw new Error("Wrong number of arguments");
|
|
107
|
-
}
|
|
91
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3.6/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
|
|
108
92
|
function isBoolean(data) {
|
|
109
93
|
return typeof data === "boolean";
|
|
110
94
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
((isDefined2) => {
|
|
115
|
-
function strict(data) {
|
|
116
|
-
return data !== void 0;
|
|
117
|
-
}
|
|
118
|
-
isDefined2.strict = strict;
|
|
119
|
-
})(isDefined || (isDefined = {}));
|
|
120
|
-
function toString(value) {
|
|
121
|
-
return Object.prototype.toString.call(value);
|
|
122
|
-
}
|
|
95
|
+
|
|
96
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3.6/node_modules/@vinicunca/perkakas/dist/es/guard/is-object.js
|
|
123
97
|
function isObject(data) {
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
function _countBy(indexed) {
|
|
127
|
-
return (array, fn) => {
|
|
128
|
-
return array.reduce((ret, item, index) => {
|
|
129
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
130
|
-
return ret + (value ? 1 : 0);
|
|
131
|
-
}, 0);
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function countBy(...args) {
|
|
135
|
-
return purry(_countBy(false), args);
|
|
136
|
-
}
|
|
137
|
-
((countBy2) => {
|
|
138
|
-
function indexed(...args) {
|
|
139
|
-
return purry(_countBy(true), args);
|
|
140
|
-
}
|
|
141
|
-
countBy2.indexed = indexed;
|
|
142
|
-
})(countBy || (countBy = {}));
|
|
143
|
-
function _reduceLazy(array, lazy, indexed) {
|
|
144
|
-
const newArray = [];
|
|
145
|
-
for (let index = 0; index < array.length; index++) {
|
|
146
|
-
const item = array[index];
|
|
147
|
-
const result = indexed ? lazy(item, index, array) : lazy(item);
|
|
148
|
-
if (result.hasMany === true) {
|
|
149
|
-
newArray.push(...result.next);
|
|
150
|
-
} else if (result.hasNext) {
|
|
151
|
-
newArray.push(result.next);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return newArray;
|
|
155
|
-
}
|
|
156
|
-
function differenceWith(...args) {
|
|
157
|
-
return purry(_differenceWith, args, differenceWith.lazy);
|
|
158
|
-
}
|
|
159
|
-
function _differenceWith(array, other, isEquals) {
|
|
160
|
-
const lazy = differenceWith.lazy(other, isEquals);
|
|
161
|
-
return _reduceLazy(array, lazy);
|
|
162
|
-
}
|
|
163
|
-
((differenceWith2) => {
|
|
164
|
-
function lazy(other, isEquals) {
|
|
165
|
-
return (value) => {
|
|
166
|
-
if (other.every((otherValue) => !isEquals(value, otherValue))) {
|
|
167
|
-
return {
|
|
168
|
-
done: false,
|
|
169
|
-
hasNext: true,
|
|
170
|
-
next: value
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return {
|
|
174
|
-
done: false,
|
|
175
|
-
hasNext: false
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
differenceWith2.lazy = lazy;
|
|
180
|
-
})(differenceWith || (differenceWith = {}));
|
|
181
|
-
function difference(...args) {
|
|
182
|
-
return purry(_difference, args, difference.lazy);
|
|
183
|
-
}
|
|
184
|
-
function _difference(array, other) {
|
|
185
|
-
const lazy = difference.lazy(other);
|
|
186
|
-
return _reduceLazy(array, lazy);
|
|
187
|
-
}
|
|
188
|
-
((difference2) => {
|
|
189
|
-
function lazy(other) {
|
|
190
|
-
const set2 = new Set(other);
|
|
191
|
-
return (value) => {
|
|
192
|
-
if (!set2.has(value)) {
|
|
193
|
-
return {
|
|
194
|
-
done: false,
|
|
195
|
-
hasNext: true,
|
|
196
|
-
next: value
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
done: false,
|
|
201
|
-
hasNext: false
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
difference2.lazy = lazy;
|
|
206
|
-
})(difference || (difference = {}));
|
|
207
|
-
function drop(...args) {
|
|
208
|
-
return purry(_drop, args, drop.lazy);
|
|
209
|
-
}
|
|
210
|
-
function _drop(array, n) {
|
|
211
|
-
return _reduceLazy(array, drop.lazy(n));
|
|
212
|
-
}
|
|
213
|
-
((drop2) => {
|
|
214
|
-
function lazy(n) {
|
|
215
|
-
let left = n;
|
|
216
|
-
return (value) => {
|
|
217
|
-
if (left > 0) {
|
|
218
|
-
left--;
|
|
219
|
-
return {
|
|
220
|
-
done: false,
|
|
221
|
-
hasNext: false
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
done: false,
|
|
226
|
-
hasNext: true,
|
|
227
|
-
next: value
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
drop2.lazy = lazy;
|
|
232
|
-
})(drop || (drop = {}));
|
|
233
|
-
function toLazyIndexed(fn) {
|
|
234
|
-
fn.indexed = true;
|
|
235
|
-
return fn;
|
|
236
|
-
}
|
|
237
|
-
function filter(...args) {
|
|
238
|
-
return purry(_filter(false), args, filter.lazy);
|
|
239
|
-
}
|
|
240
|
-
function _filter(indexed) {
|
|
241
|
-
return (array, fn) => {
|
|
242
|
-
return _reduceLazy(
|
|
243
|
-
array,
|
|
244
|
-
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
245
|
-
indexed
|
|
246
|
-
);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function _lazy(indexed) {
|
|
250
|
-
return (fn) => {
|
|
251
|
-
return (value, index, array) => {
|
|
252
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
253
|
-
if (valid) {
|
|
254
|
-
return {
|
|
255
|
-
done: false,
|
|
256
|
-
hasNext: true,
|
|
257
|
-
next: value
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
done: false,
|
|
262
|
-
hasNext: false
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
((filter2) => {
|
|
268
|
-
function indexed(...args) {
|
|
269
|
-
return purry(_filter(true), args, filter2.lazyIndexed);
|
|
270
|
-
}
|
|
271
|
-
filter2.indexed = indexed;
|
|
272
|
-
filter2.lazy = _lazy(false);
|
|
273
|
-
filter2.lazyIndexed = toLazyIndexed(_lazy(true));
|
|
274
|
-
})(filter || (filter = {}));
|
|
275
|
-
function toSingle(fn) {
|
|
276
|
-
fn.single = true;
|
|
277
|
-
return fn;
|
|
278
|
-
}
|
|
279
|
-
function findIndex(...args) {
|
|
280
|
-
return purry(_findIndex(false), args, findIndex.lazy);
|
|
281
|
-
}
|
|
282
|
-
function _findIndex(indexed) {
|
|
283
|
-
return (array, fn) => {
|
|
284
|
-
if (indexed) {
|
|
285
|
-
return array.findIndex(fn);
|
|
286
|
-
}
|
|
287
|
-
return array.findIndex((x) => fn(x));
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function _lazy2(indexed) {
|
|
291
|
-
return (fn) => {
|
|
292
|
-
let i = 0;
|
|
293
|
-
return (value, index, array) => {
|
|
294
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
295
|
-
if (valid) {
|
|
296
|
-
return {
|
|
297
|
-
done: true,
|
|
298
|
-
hasNext: true,
|
|
299
|
-
next: i
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
i++;
|
|
303
|
-
return {
|
|
304
|
-
done: false,
|
|
305
|
-
hasNext: false
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
((findIndex2) => {
|
|
311
|
-
function indexed(...args) {
|
|
312
|
-
return purry(_findIndex(true), args, findIndex2.lazyIndexed);
|
|
313
|
-
}
|
|
314
|
-
findIndex2.indexed = indexed;
|
|
315
|
-
findIndex2.lazy = toSingle(_lazy2(false));
|
|
316
|
-
findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
|
|
317
|
-
})(findIndex || (findIndex = {}));
|
|
318
|
-
function findLastIndex(...args) {
|
|
319
|
-
return purry(_findLastIndex(false), args);
|
|
320
|
-
}
|
|
321
|
-
function _findLastIndex(indexed) {
|
|
322
|
-
return (array, fn) => {
|
|
323
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
324
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
325
|
-
return i;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return -1;
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
((findLastIndex2) => {
|
|
332
|
-
function indexed(...args) {
|
|
333
|
-
return purry(_findLastIndex(true), args);
|
|
334
|
-
}
|
|
335
|
-
findLastIndex2.indexed = indexed;
|
|
336
|
-
})(findLastIndex || (findLastIndex = {}));
|
|
337
|
-
function findLast(...args) {
|
|
338
|
-
return purry(_findLast(false), args);
|
|
339
|
-
}
|
|
340
|
-
function _findLast(indexed) {
|
|
341
|
-
return (array, fn) => {
|
|
342
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
343
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
344
|
-
return array[i];
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
((findLast2) => {
|
|
350
|
-
function indexed(...args) {
|
|
351
|
-
return purry(_findLast(true), args);
|
|
352
|
-
}
|
|
353
|
-
findLast2.indexed = indexed;
|
|
354
|
-
})(findLast || (findLast = {}));
|
|
355
|
-
function find(...args) {
|
|
356
|
-
return purry(_find(false), args, find.lazy);
|
|
357
|
-
}
|
|
358
|
-
function _find(indexed) {
|
|
359
|
-
return (array, fn) => {
|
|
360
|
-
if (indexed) {
|
|
361
|
-
return array.find(fn);
|
|
362
|
-
}
|
|
363
|
-
return array.find((x) => fn(x));
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function _lazy3(indexed) {
|
|
367
|
-
return (fn) => {
|
|
368
|
-
return (value, index, array) => {
|
|
369
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
370
|
-
return {
|
|
371
|
-
done: valid,
|
|
372
|
-
hasNext: valid,
|
|
373
|
-
next: value
|
|
374
|
-
};
|
|
375
|
-
};
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
((find2) => {
|
|
379
|
-
function indexed(...args) {
|
|
380
|
-
return purry(_find(true), args, find2.lazyIndexed);
|
|
381
|
-
}
|
|
382
|
-
find2.indexed = indexed;
|
|
383
|
-
find2.lazy = toSingle(_lazy3(false));
|
|
384
|
-
find2.lazyIndexed = toSingle(toLazyIndexed(_lazy3(true)));
|
|
385
|
-
})(find || (find = {}));
|
|
386
|
-
function first(...args) {
|
|
387
|
-
return purry(_first, args, first.lazy);
|
|
388
|
-
}
|
|
389
|
-
function _first([first2]) {
|
|
390
|
-
return first2;
|
|
391
|
-
}
|
|
392
|
-
((first2) => {
|
|
393
|
-
function lazy() {
|
|
394
|
-
return (value) => {
|
|
395
|
-
return {
|
|
396
|
-
done: true,
|
|
397
|
-
hasNext: true,
|
|
398
|
-
next: value
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
first2.lazy = lazy;
|
|
403
|
-
((lazy2) => {
|
|
404
|
-
lazy2.single = true;
|
|
405
|
-
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
406
|
-
})(first || (first = {}));
|
|
407
|
-
function flatMapToObj(...args) {
|
|
408
|
-
return purry(_flatMapToObj(false), args);
|
|
409
|
-
}
|
|
410
|
-
function _flatMapToObj(indexed) {
|
|
411
|
-
return (array, fn) => {
|
|
412
|
-
return array.reduce((result, element, index) => {
|
|
413
|
-
const items = indexed ? fn(element, index, array) : fn(element);
|
|
414
|
-
items.forEach(([key, value]) => {
|
|
415
|
-
result[key] = value;
|
|
416
|
-
});
|
|
417
|
-
return result;
|
|
418
|
-
}, {});
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
((flatMapToObj2) => {
|
|
422
|
-
function indexed(...args) {
|
|
423
|
-
return purry(_flatMapToObj(true), args);
|
|
424
|
-
}
|
|
425
|
-
flatMapToObj2.indexed = indexed;
|
|
426
|
-
})(flatMapToObj || (flatMapToObj = {}));
|
|
427
|
-
function flatten(...args) {
|
|
428
|
-
return purry(_flatten, args, flatten.lazy);
|
|
429
|
-
}
|
|
430
|
-
function _flatten(items) {
|
|
431
|
-
return _reduceLazy(items, flatten.lazy());
|
|
432
|
-
}
|
|
433
|
-
((flatten2) => {
|
|
434
|
-
function lazy() {
|
|
435
|
-
return (next) => {
|
|
436
|
-
if (Array.isArray(next)) {
|
|
437
|
-
return {
|
|
438
|
-
done: false,
|
|
439
|
-
hasNext: true,
|
|
440
|
-
hasMany: true,
|
|
441
|
-
next
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
return {
|
|
445
|
-
done: false,
|
|
446
|
-
hasNext: true,
|
|
447
|
-
next
|
|
448
|
-
};
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
flatten2.lazy = lazy;
|
|
452
|
-
})(flatten || (flatten = {}));
|
|
453
|
-
function flatMap(...args) {
|
|
454
|
-
return purry(_flatMap, args, flatMap.lazy);
|
|
455
|
-
}
|
|
456
|
-
function _flatMap(array, fn) {
|
|
457
|
-
return flatten(array.map((item) => fn(item)));
|
|
458
|
-
}
|
|
459
|
-
((flatMap2) => {
|
|
460
|
-
function lazy(fn) {
|
|
461
|
-
return (value) => {
|
|
462
|
-
const next = fn(value);
|
|
463
|
-
if (Array.isArray(next)) {
|
|
464
|
-
return {
|
|
465
|
-
done: false,
|
|
466
|
-
hasNext: true,
|
|
467
|
-
hasMany: true,
|
|
468
|
-
next
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
done: false,
|
|
473
|
-
hasNext: true,
|
|
474
|
-
next
|
|
475
|
-
};
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
flatMap2.lazy = lazy;
|
|
479
|
-
})(flatMap || (flatMap = {}));
|
|
480
|
-
function flattenDeep(...args) {
|
|
481
|
-
return purry(_flattenDeep, args, flattenDeep.lazy);
|
|
482
|
-
}
|
|
483
|
-
function _flattenDeep(items) {
|
|
484
|
-
return _reduceLazy(items, flattenDeep.lazy());
|
|
485
|
-
}
|
|
486
|
-
function _flattenDeepValue(value) {
|
|
487
|
-
if (!Array.isArray(value)) {
|
|
488
|
-
return value;
|
|
489
|
-
}
|
|
490
|
-
const ret = [];
|
|
491
|
-
value.forEach((item) => {
|
|
492
|
-
if (Array.isArray(item)) {
|
|
493
|
-
ret.push(...flattenDeep(item));
|
|
494
|
-
} else {
|
|
495
|
-
ret.push(item);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
return ret;
|
|
499
|
-
}
|
|
500
|
-
((flattenDeep2) => {
|
|
501
|
-
function lazy() {
|
|
502
|
-
return (value) => {
|
|
503
|
-
const next = _flattenDeepValue(value);
|
|
504
|
-
if (Array.isArray(next)) {
|
|
505
|
-
return {
|
|
506
|
-
done: false,
|
|
507
|
-
hasNext: true,
|
|
508
|
-
hasMany: true,
|
|
509
|
-
next
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
return {
|
|
513
|
-
done: false,
|
|
514
|
-
hasNext: true,
|
|
515
|
-
next
|
|
516
|
-
};
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
flattenDeep2.lazy = lazy;
|
|
520
|
-
})(flattenDeep || (flattenDeep = {}));
|
|
521
|
-
function forEach(...args) {
|
|
522
|
-
return purry(_forEach(false), args, forEach.lazy);
|
|
523
|
-
}
|
|
524
|
-
function _forEach(indexed) {
|
|
525
|
-
return (array, fn) => {
|
|
526
|
-
return _reduceLazy(
|
|
527
|
-
array,
|
|
528
|
-
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
529
|
-
indexed
|
|
530
|
-
);
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function _lazy4(indexed) {
|
|
534
|
-
return (fn) => {
|
|
535
|
-
return (value, index, array) => {
|
|
536
|
-
if (indexed) {
|
|
537
|
-
fn(value, index, array);
|
|
538
|
-
} else {
|
|
539
|
-
fn(value);
|
|
540
|
-
}
|
|
541
|
-
return {
|
|
542
|
-
done: false,
|
|
543
|
-
hasNext: true,
|
|
544
|
-
next: value
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
((forEach2) => {
|
|
550
|
-
function indexed(...args) {
|
|
551
|
-
return purry(_forEach(true), args, forEach2.lazyIndexed);
|
|
552
|
-
}
|
|
553
|
-
forEach2.indexed = indexed;
|
|
554
|
-
forEach2.lazy = _lazy4(false);
|
|
555
|
-
forEach2.lazyIndexed = toLazyIndexed(_lazy4(true));
|
|
556
|
-
})(forEach || (forEach = {}));
|
|
557
|
-
function groupBy(...args) {
|
|
558
|
-
return purry(_groupBy(false), args);
|
|
559
|
-
}
|
|
560
|
-
function _groupBy(indexed) {
|
|
561
|
-
return (array, fn) => {
|
|
562
|
-
const ret = {};
|
|
563
|
-
array.forEach((item, index) => {
|
|
564
|
-
const key = indexed ? fn(item, index, array) : fn(item);
|
|
565
|
-
if (key !== void 0) {
|
|
566
|
-
const actualKey = String(key);
|
|
567
|
-
if (!ret[actualKey]) {
|
|
568
|
-
ret[actualKey] = [];
|
|
569
|
-
}
|
|
570
|
-
ret[actualKey].push(item);
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
return ret;
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
((groupBy2) => {
|
|
577
|
-
function indexed(...args) {
|
|
578
|
-
return purry(_groupBy(true), args);
|
|
579
|
-
}
|
|
580
|
-
groupBy2.indexed = indexed;
|
|
581
|
-
groupBy2.strict = groupBy2;
|
|
582
|
-
})(groupBy || (groupBy = {}));
|
|
583
|
-
function indexBy(...args) {
|
|
584
|
-
return purry(_indexBy(false), args);
|
|
585
|
-
}
|
|
586
|
-
function _indexBy(indexed) {
|
|
587
|
-
return (array, fn) => {
|
|
588
|
-
return array.reduce((ret, item, index) => {
|
|
589
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
590
|
-
const key = String(value);
|
|
591
|
-
ret[key] = item;
|
|
592
|
-
return ret;
|
|
593
|
-
}, {});
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
((indexBy2) => {
|
|
597
|
-
function indexed(...args) {
|
|
598
|
-
return purry(_indexBy(true), args);
|
|
599
|
-
}
|
|
600
|
-
indexBy2.indexed = indexed;
|
|
601
|
-
})(indexBy || (indexBy = {}));
|
|
602
|
-
function intersection(...args) {
|
|
603
|
-
return purry(_intersection, args, intersection.lazy);
|
|
604
|
-
}
|
|
605
|
-
function _intersection(array, other) {
|
|
606
|
-
const lazy = intersection.lazy(other);
|
|
607
|
-
return _reduceLazy(array, lazy);
|
|
608
|
-
}
|
|
609
|
-
((intersection2) => {
|
|
610
|
-
function lazy(other) {
|
|
611
|
-
return (value) => {
|
|
612
|
-
const set2 = new Set(other);
|
|
613
|
-
if (set2.has(value)) {
|
|
614
|
-
return {
|
|
615
|
-
done: false,
|
|
616
|
-
hasNext: true,
|
|
617
|
-
next: value
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
return {
|
|
621
|
-
done: false,
|
|
622
|
-
hasNext: false
|
|
623
|
-
};
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
intersection2.lazy = lazy;
|
|
627
|
-
})(intersection || (intersection = {}));
|
|
628
|
-
function intersectionWith(...args) {
|
|
629
|
-
return purry(_intersectionWith, args, intersectionWith.lazy);
|
|
630
|
-
}
|
|
631
|
-
function _intersectionWith(array, other, comparator) {
|
|
632
|
-
const lazy = intersectionWith.lazy(other, comparator);
|
|
633
|
-
return _reduceLazy(array, lazy);
|
|
634
|
-
}
|
|
635
|
-
((intersectionWith2) => {
|
|
636
|
-
function lazy(other, comparator) {
|
|
637
|
-
return (value) => {
|
|
638
|
-
if (other.some((otherValue) => comparator(value, otherValue))) {
|
|
639
|
-
return {
|
|
640
|
-
done: false,
|
|
641
|
-
hasNext: true,
|
|
642
|
-
next: value
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
return {
|
|
646
|
-
done: false,
|
|
647
|
-
hasNext: false
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
intersectionWith2.lazy = lazy;
|
|
652
|
-
})(intersectionWith || (intersectionWith = {}));
|
|
653
|
-
function map(...args) {
|
|
654
|
-
return purry(_map(false), args, map.lazy);
|
|
655
|
-
}
|
|
656
|
-
function _map(indexed) {
|
|
657
|
-
return (array, fn) => {
|
|
658
|
-
return _reduceLazy(
|
|
659
|
-
array,
|
|
660
|
-
indexed ? map.lazyIndexed(fn) : map.lazy(fn),
|
|
661
|
-
indexed
|
|
662
|
-
);
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
function _lazy5(indexed) {
|
|
666
|
-
return (fn) => {
|
|
667
|
-
return (value, index, array) => {
|
|
668
|
-
return {
|
|
669
|
-
done: false,
|
|
670
|
-
hasNext: true,
|
|
671
|
-
next: indexed ? fn(value, index, array) : fn(value)
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
((map2) => {
|
|
677
|
-
function indexed(...args) {
|
|
678
|
-
return purry(_map(true), args, map2.lazyIndexed);
|
|
679
|
-
}
|
|
680
|
-
map2.indexed = indexed;
|
|
681
|
-
map2.lazy = _lazy5(false);
|
|
682
|
-
map2.lazyIndexed = toLazyIndexed(_lazy5(true));
|
|
683
|
-
map2.strict = map2;
|
|
684
|
-
})(map || (map = {}));
|
|
685
|
-
function mapToObj(...args) {
|
|
686
|
-
return purry(_mapToObj(false), args);
|
|
687
|
-
}
|
|
688
|
-
function _mapToObj(indexed) {
|
|
689
|
-
return (array, fn) => {
|
|
690
|
-
return array.reduce((result, element, index) => {
|
|
691
|
-
const [key, value] = indexed ? fn(element, index, array) : fn(element);
|
|
692
|
-
result[key] = value;
|
|
693
|
-
return result;
|
|
694
|
-
}, {});
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
((mapToObj2) => {
|
|
698
|
-
function indexed(...args) {
|
|
699
|
-
return purry(_mapToObj(true), args);
|
|
700
|
-
}
|
|
701
|
-
mapToObj2.indexed = indexed;
|
|
702
|
-
})(mapToObj || (mapToObj = {}));
|
|
703
|
-
function _maxBy(indexed) {
|
|
704
|
-
return (array, fn) => {
|
|
705
|
-
let ret;
|
|
706
|
-
let retMax;
|
|
707
|
-
array.forEach((item, i) => {
|
|
708
|
-
const max = indexed ? fn(item, i, array) : fn(item);
|
|
709
|
-
if (retMax === void 0 || max > retMax) {
|
|
710
|
-
ret = item;
|
|
711
|
-
retMax = max;
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
return ret;
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
function maxBy(...args) {
|
|
718
|
-
return purry(_maxBy(false), args);
|
|
719
|
-
}
|
|
720
|
-
((maxBy2) => {
|
|
721
|
-
function indexed(...args) {
|
|
722
|
-
return purry(_maxBy(true), args);
|
|
723
|
-
}
|
|
724
|
-
maxBy2.indexed = indexed;
|
|
725
|
-
})(maxBy || (maxBy = {}));
|
|
726
|
-
function _meanBy(indexed) {
|
|
727
|
-
return (array, fn) => {
|
|
728
|
-
if (array.length === 0) {
|
|
729
|
-
return Number.NaN;
|
|
730
|
-
}
|
|
731
|
-
let sum = 0;
|
|
732
|
-
array.forEach((item, i) => {
|
|
733
|
-
sum += indexed ? fn(item, i, array) : fn(item);
|
|
734
|
-
});
|
|
735
|
-
return sum / array.length;
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
function meanBy(...args) {
|
|
739
|
-
return purry(_meanBy(false), args);
|
|
740
|
-
}
|
|
741
|
-
((meanBy2) => {
|
|
742
|
-
function indexed(...args) {
|
|
743
|
-
return purry(_meanBy(true), args);
|
|
744
|
-
}
|
|
745
|
-
meanBy2.indexed = indexed;
|
|
746
|
-
})(meanBy || (meanBy = {}));
|
|
747
|
-
function _minBy(indexed) {
|
|
748
|
-
return (array, fn) => {
|
|
749
|
-
let ret;
|
|
750
|
-
let retMin;
|
|
751
|
-
array.forEach((item, i) => {
|
|
752
|
-
const min = indexed ? fn(item, i, array) : fn(item);
|
|
753
|
-
if (retMin === void 0 || min < retMin) {
|
|
754
|
-
ret = item;
|
|
755
|
-
retMin = min;
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
return ret;
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
function minBy(...args) {
|
|
762
|
-
return purry(_minBy(false), args);
|
|
763
|
-
}
|
|
764
|
-
((minBy2) => {
|
|
765
|
-
function indexed(...args) {
|
|
766
|
-
return purry(_minBy(true), args);
|
|
767
|
-
}
|
|
768
|
-
minBy2.indexed = indexed;
|
|
769
|
-
})(minBy || (minBy = {}));
|
|
770
|
-
function partition(...args) {
|
|
771
|
-
return purry(_partition(false), args);
|
|
772
|
-
}
|
|
773
|
-
function _partition(indexed) {
|
|
774
|
-
return (array, fn) => {
|
|
775
|
-
const ret = [[], []];
|
|
776
|
-
array.forEach((item, index) => {
|
|
777
|
-
const matches = indexed ? fn(item, index, array) : fn(item);
|
|
778
|
-
ret[matches ? 0 : 1].push(item);
|
|
779
|
-
});
|
|
780
|
-
return ret;
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
((partition2) => {
|
|
784
|
-
function indexed(...args) {
|
|
785
|
-
return purry(_partition(true), args);
|
|
786
|
-
}
|
|
787
|
-
partition2.indexed = indexed;
|
|
788
|
-
})(partition || (partition = {}));
|
|
789
|
-
function reduce(...args) {
|
|
790
|
-
return purry(_reduce(false), args);
|
|
791
|
-
}
|
|
792
|
-
function _reduce(indexed) {
|
|
793
|
-
return (items, fn, initialValue) => {
|
|
794
|
-
return items.reduce(
|
|
795
|
-
(acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
|
|
796
|
-
initialValue
|
|
797
|
-
);
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
((reduce2) => {
|
|
801
|
-
function indexed(...args) {
|
|
802
|
-
return purry(_reduce(true), args);
|
|
803
|
-
}
|
|
804
|
-
reduce2.indexed = indexed;
|
|
805
|
-
})(reduce || (reduce = {}));
|
|
806
|
-
function reject(...args) {
|
|
807
|
-
return purry(_reject(false), args, reject.lazy);
|
|
808
|
-
}
|
|
809
|
-
function _reject(indexed) {
|
|
810
|
-
return (array, fn) => {
|
|
811
|
-
return _reduceLazy(
|
|
812
|
-
array,
|
|
813
|
-
indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
|
|
814
|
-
indexed
|
|
815
|
-
);
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
function _lazy6(indexed) {
|
|
819
|
-
return (fn) => {
|
|
820
|
-
return (value, index, array) => {
|
|
821
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
822
|
-
if (!valid) {
|
|
823
|
-
return {
|
|
824
|
-
done: false,
|
|
825
|
-
hasNext: true,
|
|
826
|
-
next: value
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
return {
|
|
830
|
-
done: false,
|
|
831
|
-
hasNext: false
|
|
832
|
-
};
|
|
833
|
-
};
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
((reject2) => {
|
|
837
|
-
function indexed(...args) {
|
|
838
|
-
return purry(_reject(true), args, reject2.lazyIndexed);
|
|
839
|
-
}
|
|
840
|
-
reject2.indexed = indexed;
|
|
841
|
-
reject2.lazy = _lazy6(false);
|
|
842
|
-
reject2.lazyIndexed = toLazyIndexed(_lazy6(true));
|
|
843
|
-
})(reject || (reject = {}));
|
|
844
|
-
function sort(...args) {
|
|
845
|
-
return purry(_sort, args);
|
|
846
|
-
}
|
|
847
|
-
function _sort(items, cmp) {
|
|
848
|
-
const ret = [...items];
|
|
849
|
-
ret.sort(cmp);
|
|
850
|
-
return ret;
|
|
851
|
-
}
|
|
852
|
-
((sort2) => {
|
|
853
|
-
sort2.strict = sort2;
|
|
854
|
-
})(sort || (sort = {}));
|
|
855
|
-
var ALL_DIRECTIONS = ["asc", "desc"];
|
|
856
|
-
var COMPARATOR = {
|
|
857
|
-
asc: (x, y) => x > y,
|
|
858
|
-
desc: (x, y) => x < y
|
|
859
|
-
};
|
|
860
|
-
function sortBy(arrayOrSortRule, ...sortRules) {
|
|
861
|
-
const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
|
|
862
|
-
return purry(_sortBy, args);
|
|
863
|
-
}
|
|
864
|
-
function isSortRule(x) {
|
|
865
|
-
if (typeof x === "function") {
|
|
866
|
-
return true;
|
|
867
|
-
}
|
|
868
|
-
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
869
|
-
if (rest.length > 0) {
|
|
98
|
+
if (typeof data !== "object" || data === null) {
|
|
870
99
|
return false;
|
|
871
100
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
function _sortBy(array, sorts) {
|
|
875
|
-
return [...array].sort(comparer(...sorts));
|
|
876
|
-
}
|
|
877
|
-
function comparer(primaryRule, secondaryRule, ...otherRules) {
|
|
878
|
-
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
879
|
-
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
880
|
-
const comparator = COMPARATOR[direction];
|
|
881
|
-
const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
|
|
882
|
-
return (a, b) => {
|
|
883
|
-
const projectedA = projector(a);
|
|
884
|
-
const projectedB = projector(b);
|
|
885
|
-
if (comparator(projectedA, projectedB)) {
|
|
886
|
-
return 1;
|
|
887
|
-
}
|
|
888
|
-
if (comparator(projectedB, projectedA)) {
|
|
889
|
-
return -1;
|
|
890
|
-
}
|
|
891
|
-
return nextComparer?.(a, b) ?? 0;
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
((sortBy2) => {
|
|
895
|
-
sortBy2.strict = sortBy2;
|
|
896
|
-
})(sortBy || (sortBy = {}));
|
|
897
|
-
function _sumBy(indexed) {
|
|
898
|
-
return (array, fn) => {
|
|
899
|
-
let sum = 0;
|
|
900
|
-
array.forEach((item, i) => {
|
|
901
|
-
const summand = indexed ? fn(item, i, array) : fn(item);
|
|
902
|
-
sum += summand;
|
|
903
|
-
});
|
|
904
|
-
return sum;
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
function sumBy(...args) {
|
|
908
|
-
return purry(_sumBy(false), args);
|
|
909
|
-
}
|
|
910
|
-
((sumBy2) => {
|
|
911
|
-
function indexed(...args) {
|
|
912
|
-
return purry(_sumBy(true), args);
|
|
913
|
-
}
|
|
914
|
-
sumBy2.indexed = indexed;
|
|
915
|
-
})(sumBy || (sumBy = {}));
|
|
916
|
-
function take(...args) {
|
|
917
|
-
return purry(_take, args, take.lazy);
|
|
101
|
+
const proto = Object.getPrototypeOf(data);
|
|
102
|
+
return proto === null || proto === Object.prototype;
|
|
918
103
|
}
|
|
919
|
-
function _take(array, n) {
|
|
920
|
-
return _reduceLazy(array, take.lazy(n));
|
|
921
|
-
}
|
|
922
|
-
((take2) => {
|
|
923
|
-
function lazy(n) {
|
|
924
|
-
return (value) => {
|
|
925
|
-
if (n === 0) {
|
|
926
|
-
return {
|
|
927
|
-
done: true,
|
|
928
|
-
hasNext: false
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
n--;
|
|
932
|
-
if (n === 0) {
|
|
933
|
-
return {
|
|
934
|
-
done: true,
|
|
935
|
-
hasNext: true,
|
|
936
|
-
next: value
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
return {
|
|
940
|
-
done: false,
|
|
941
|
-
hasNext: true,
|
|
942
|
-
next: value
|
|
943
|
-
};
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
take2.lazy = lazy;
|
|
947
|
-
})(take || (take = {}));
|
|
948
|
-
function uniq(...args) {
|
|
949
|
-
return purry(_uniq, args, uniq.lazy);
|
|
950
|
-
}
|
|
951
|
-
function _uniq(array) {
|
|
952
|
-
return _reduceLazy(array, uniq.lazy());
|
|
953
|
-
}
|
|
954
|
-
((uniq2) => {
|
|
955
|
-
function lazy() {
|
|
956
|
-
const set2 = /* @__PURE__ */ new Set();
|
|
957
|
-
return (value) => {
|
|
958
|
-
if (set2.has(value)) {
|
|
959
|
-
return {
|
|
960
|
-
done: false,
|
|
961
|
-
hasNext: false
|
|
962
|
-
};
|
|
963
|
-
}
|
|
964
|
-
set2.add(value);
|
|
965
|
-
return {
|
|
966
|
-
done: false,
|
|
967
|
-
hasNext: true,
|
|
968
|
-
next: value
|
|
969
|
-
};
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
uniq2.lazy = lazy;
|
|
973
|
-
})(uniq || (uniq = {}));
|
|
974
|
-
function uniqWith(...args) {
|
|
975
|
-
return purry(_uniqWith, args, uniqWith.lazy);
|
|
976
|
-
}
|
|
977
|
-
function _uniqWith(array, isEquals) {
|
|
978
|
-
const lazy = uniqWith.lazy(isEquals);
|
|
979
|
-
return _reduceLazy(array, lazy, true);
|
|
980
|
-
}
|
|
981
|
-
function _lazy7(isEquals) {
|
|
982
|
-
return (value, index, array) => {
|
|
983
|
-
if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
|
|
984
|
-
return {
|
|
985
|
-
done: false,
|
|
986
|
-
hasNext: true,
|
|
987
|
-
next: value
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
return {
|
|
991
|
-
done: false,
|
|
992
|
-
hasNext: false
|
|
993
|
-
};
|
|
994
|
-
};
|
|
995
|
-
}
|
|
996
|
-
((uniqWith2) => {
|
|
997
|
-
uniqWith2.lazy = toLazyIndexed(_lazy7);
|
|
998
|
-
})(uniqWith || (uniqWith = {}));
|
|
999
|
-
var isArray2 = Array.isArray;
|
|
1000
|
-
function forEachObj(...args) {
|
|
1001
|
-
return purry(_forEachObj(false), args);
|
|
1002
|
-
}
|
|
1003
|
-
function _forEachObj(indexed) {
|
|
1004
|
-
return (object, fn) => {
|
|
1005
|
-
for (const key in object) {
|
|
1006
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
1007
|
-
const val = object[key];
|
|
1008
|
-
if (indexed) {
|
|
1009
|
-
fn(val, key, object);
|
|
1010
|
-
} else {
|
|
1011
|
-
fn(val);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
return object;
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
((forEachObj2) => {
|
|
1019
|
-
function indexed(...args) {
|
|
1020
|
-
return purry(_forEachObj(true), args);
|
|
1021
|
-
}
|
|
1022
|
-
forEachObj2.indexed = indexed;
|
|
1023
|
-
})(forEachObj || (forEachObj = {}));
|
|
1024
|
-
function fromPairs(entries) {
|
|
1025
|
-
const out = {};
|
|
1026
|
-
for (const [key, value] of entries) {
|
|
1027
|
-
out[key] = value;
|
|
1028
|
-
}
|
|
1029
|
-
return out;
|
|
1030
|
-
}
|
|
1031
|
-
((fromPairs2) => {
|
|
1032
|
-
fromPairs2.strict = fromPairs2;
|
|
1033
|
-
})(fromPairs || (fromPairs = {}));
|
|
1034
|
-
function keys(source) {
|
|
1035
|
-
return Object.keys(source);
|
|
1036
|
-
}
|
|
1037
|
-
((keys2) => {
|
|
1038
|
-
keys2.strict = keys2;
|
|
1039
|
-
})(keys || (keys = {}));
|
|
1040
|
-
function toPairs(object) {
|
|
1041
|
-
return Object.entries(object);
|
|
1042
|
-
}
|
|
1043
|
-
((toPairs2) => {
|
|
1044
|
-
function strict(object) {
|
|
1045
|
-
return Object.entries(object);
|
|
1046
|
-
}
|
|
1047
|
-
toPairs2.strict = strict;
|
|
1048
|
-
})(toPairs || (toPairs = {}));
|
|
1049
104
|
|
|
1050
105
|
// src/base.ts
|
|
1051
106
|
var import_local_pkg = require("local-pkg");
|
|
107
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
1052
108
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
1053
109
|
|
|
1054
110
|
// src/flags.ts
|
|
@@ -1086,10 +142,6 @@ async function comments() {
|
|
|
1086
142
|
];
|
|
1087
143
|
}
|
|
1088
144
|
|
|
1089
|
-
// src/configs/ignores.ts
|
|
1090
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
1091
|
-
var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
1092
|
-
|
|
1093
145
|
// src/globs.ts
|
|
1094
146
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
1095
147
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -1160,33 +212,10 @@ var GLOB_EXCLUDE = [
|
|
|
1160
212
|
];
|
|
1161
213
|
|
|
1162
214
|
// src/configs/ignores.ts
|
|
1163
|
-
async function ignores({
|
|
1164
|
-
enableGitignore = true,
|
|
1165
|
-
items = [],
|
|
1166
|
-
replace = false
|
|
1167
|
-
} = {}) {
|
|
1168
|
-
const ignoreList = [];
|
|
1169
|
-
if (enableGitignore && import_node_fs.default.existsSync(".gitignore")) {
|
|
1170
|
-
const gitignoreContent = import_node_fs.default.readFileSync(".gitignore", "utf8");
|
|
1171
|
-
const parsed = (0, import_parse_gitignore.default)(gitignoreContent);
|
|
1172
|
-
const globs = parsed.globs();
|
|
1173
|
-
for (const glob of globs) {
|
|
1174
|
-
if (glob.type === "ignore") {
|
|
1175
|
-
ignoreList.push(...glob.patterns);
|
|
1176
|
-
} else if (glob.type === "unignore") {
|
|
1177
|
-
ignoreList.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
1178
|
-
}
|
|
1179
|
-
;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
if (replace) {
|
|
1183
|
-
ignoreList.push(...items);
|
|
1184
|
-
} else {
|
|
1185
|
-
ignoreList.push(...GLOB_EXCLUDE, ...items);
|
|
1186
|
-
}
|
|
215
|
+
async function ignores() {
|
|
1187
216
|
return [
|
|
1188
217
|
{
|
|
1189
|
-
ignores:
|
|
218
|
+
ignores: GLOB_EXCLUDE
|
|
1190
219
|
}
|
|
1191
220
|
];
|
|
1192
221
|
}
|
|
@@ -2247,6 +1276,8 @@ async function typescript(options = {}) {
|
|
|
2247
1276
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2248
1277
|
];
|
|
2249
1278
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1279
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1280
|
+
const isTypeAware = !!tsconfigPath;
|
|
2250
1281
|
const typeAwareRules = {
|
|
2251
1282
|
"dot-notation": OFF,
|
|
2252
1283
|
"no-implied-eval": OFF,
|
|
@@ -2262,7 +1293,6 @@ async function typescript(options = {}) {
|
|
|
2262
1293
|
"ts/restrict-plus-operands": ERROR,
|
|
2263
1294
|
"ts/restrict-template-expressions": ERROR
|
|
2264
1295
|
};
|
|
2265
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
2266
1296
|
const [
|
|
2267
1297
|
pluginTs,
|
|
2268
1298
|
parserTs
|
|
@@ -2270,29 +1300,41 @@ async function typescript(options = {}) {
|
|
|
2270
1300
|
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
2271
1301
|
interopDefault(import("@typescript-eslint/parser"))
|
|
2272
1302
|
]);
|
|
2273
|
-
|
|
2274
|
-
{
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
plugins: {
|
|
2278
|
-
ts: pluginTs,
|
|
2279
|
-
vinicunca: import_eslint_plugin_vinicunca.default
|
|
2280
|
-
}
|
|
2281
|
-
},
|
|
2282
|
-
{
|
|
2283
|
-
files,
|
|
1303
|
+
function makeParser({ files: files2, ignores: ignores2, typeAware }) {
|
|
1304
|
+
return {
|
|
1305
|
+
files: files2,
|
|
1306
|
+
...ignores2 ? { ignores: ignores2 } : {},
|
|
2284
1307
|
languageOptions: {
|
|
2285
1308
|
parser: parserTs,
|
|
2286
1309
|
parserOptions: {
|
|
2287
1310
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
2288
1311
|
sourceType: "module",
|
|
2289
|
-
...
|
|
1312
|
+
...typeAware ? {
|
|
2290
1313
|
project: tsconfigPath,
|
|
2291
1314
|
tsconfigRootDir: import_node_process.default.cwd()
|
|
2292
1315
|
} : {},
|
|
2293
1316
|
...parserOptions
|
|
2294
1317
|
}
|
|
2295
1318
|
},
|
|
1319
|
+
name: `vinicunca:typescript:${typeAware ? "type-aware-parser" : "parser"}`
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
return [
|
|
1323
|
+
{
|
|
1324
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
1325
|
+
name: "vinicunca:typescript:setup",
|
|
1326
|
+
plugins: {
|
|
1327
|
+
ts: pluginTs,
|
|
1328
|
+
vinicunca: import_eslint_plugin_vinicunca.default
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1332
|
+
...isTypeAware ? [
|
|
1333
|
+
makeParser({ files: filesTypeAware, typeAware: true }),
|
|
1334
|
+
makeParser({ files, ignores: filesTypeAware, typeAware: false })
|
|
1335
|
+
] : [makeParser({ files, typeAware: false })],
|
|
1336
|
+
{
|
|
1337
|
+
files,
|
|
2296
1338
|
name: "vinicunca:typescript:rules",
|
|
2297
1339
|
rules: {
|
|
2298
1340
|
...renameRules(
|
|
@@ -2312,6 +1354,7 @@ async function typescript(options = {}) {
|
|
|
2312
1354
|
"no-unused-vars": OFF,
|
|
2313
1355
|
"no-use-before-define": OFF,
|
|
2314
1356
|
"no-useless-constructor": OFF,
|
|
1357
|
+
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2315
1358
|
"ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
|
|
2316
1359
|
"ts/ban-types": [ERROR, { types: { Function: false } }],
|
|
2317
1360
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2319,6 +1362,8 @@ async function typescript(options = {}) {
|
|
|
2319
1362
|
"ts/explicit-function-return-type": OFF,
|
|
2320
1363
|
"ts/explicit-member-accessibility": OFF,
|
|
2321
1364
|
"ts/explicit-module-boundary-types": OFF,
|
|
1365
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1366
|
+
"ts/method-signature-style": ["error", "property"],
|
|
2322
1367
|
"ts/naming-convention": OFF,
|
|
2323
1368
|
"ts/no-dupe-class-members": ERROR,
|
|
2324
1369
|
"ts/no-empty-function": OFF,
|
|
@@ -2701,7 +1746,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2701
1746
|
languageOptions: {
|
|
2702
1747
|
parser: parserPlain
|
|
2703
1748
|
},
|
|
2704
|
-
name: "vinicunca:
|
|
1749
|
+
name: "vinicunca:formatters:css",
|
|
2705
1750
|
rules: {
|
|
2706
1751
|
"format/prettier": [
|
|
2707
1752
|
"error",
|
|
@@ -2717,7 +1762,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2717
1762
|
languageOptions: {
|
|
2718
1763
|
parser: parserPlain
|
|
2719
1764
|
},
|
|
2720
|
-
name: "vinicunca:
|
|
1765
|
+
name: "vinicunca:formatters:scss",
|
|
2721
1766
|
rules: {
|
|
2722
1767
|
"format/prettier": [
|
|
2723
1768
|
"error",
|
|
@@ -2733,7 +1778,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2733
1778
|
languageOptions: {
|
|
2734
1779
|
parser: parserPlain
|
|
2735
1780
|
},
|
|
2736
|
-
name: "vinicunca:
|
|
1781
|
+
name: "vinicunca:formatters:less",
|
|
2737
1782
|
rules: {
|
|
2738
1783
|
"format/prettier": [
|
|
2739
1784
|
"error",
|
|
@@ -2752,7 +1797,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2752
1797
|
languageOptions: {
|
|
2753
1798
|
parser: parserPlain
|
|
2754
1799
|
},
|
|
2755
|
-
name: "vinicunca:
|
|
1800
|
+
name: "vinicunca:formatters:html",
|
|
2756
1801
|
rules: {
|
|
2757
1802
|
"format/prettier": [
|
|
2758
1803
|
"error",
|
|
@@ -2771,7 +1816,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2771
1816
|
languageOptions: {
|
|
2772
1817
|
parser: parserPlain
|
|
2773
1818
|
},
|
|
2774
|
-
name: "vinicunca:
|
|
1819
|
+
name: "vinicunca:formatters:markdown",
|
|
2775
1820
|
rules: {
|
|
2776
1821
|
[`format/${formater}`]: [
|
|
2777
1822
|
"error",
|
|
@@ -2794,7 +1839,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2794
1839
|
languageOptions: {
|
|
2795
1840
|
parser: parserPlain
|
|
2796
1841
|
},
|
|
2797
|
-
name: "vinicunca:
|
|
1842
|
+
name: "vinicunca:formatters:graphql",
|
|
2798
1843
|
rules: {
|
|
2799
1844
|
"format/prettier": [
|
|
2800
1845
|
"error",
|
|
@@ -2811,6 +1856,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2811
1856
|
|
|
2812
1857
|
// src/base.ts
|
|
2813
1858
|
var flatConfigProps = [
|
|
1859
|
+
"name",
|
|
2814
1860
|
"files",
|
|
2815
1861
|
"ignores",
|
|
2816
1862
|
"languageOptions",
|
|
@@ -2829,6 +1875,7 @@ var VuePackages = [
|
|
|
2829
1875
|
async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2830
1876
|
const {
|
|
2831
1877
|
componentExts = [],
|
|
1878
|
+
gitignore: enableGitignore = true,
|
|
2832
1879
|
isInEditor = !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE || import_node_process2.default.env.VIM) && !import_node_process2.default.env.CI),
|
|
2833
1880
|
react: enableReact = false,
|
|
2834
1881
|
typescript: enableTypeScript = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
@@ -2845,8 +1892,17 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2845
1892
|
};
|
|
2846
1893
|
}
|
|
2847
1894
|
const configs = [];
|
|
1895
|
+
if (enableGitignore) {
|
|
1896
|
+
if (typeof enableGitignore !== "boolean") {
|
|
1897
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1898
|
+
} else {
|
|
1899
|
+
if (import_node_fs.default.existsSync(".gitignore")) {
|
|
1900
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
2848
1904
|
configs.push(
|
|
2849
|
-
ignores(
|
|
1905
|
+
ignores(),
|
|
2850
1906
|
javascript({
|
|
2851
1907
|
isInEditor,
|
|
2852
1908
|
overrides: getOverrides(options, "javascript")
|