@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.js
CHANGED
|
@@ -1,964 +1,20 @@
|
|
|
1
|
-
// ../node_modules/.pnpm/@vinicunca+perkakas@0.
|
|
2
|
-
function purry(fn, args, lazy) {
|
|
3
|
-
const diff = fn.length - args.length;
|
|
4
|
-
const arrayArgs = Array.from(args);
|
|
5
|
-
if (diff === 0) {
|
|
6
|
-
return fn(...arrayArgs);
|
|
7
|
-
}
|
|
8
|
-
if (diff === 1) {
|
|
9
|
-
const ret = (data) => fn(data, ...arrayArgs);
|
|
10
|
-
if (lazy || fn.lazy) {
|
|
11
|
-
ret.lazy = lazy || fn.lazy;
|
|
12
|
-
ret.lazyArgs = args;
|
|
13
|
-
}
|
|
14
|
-
return ret;
|
|
15
|
-
}
|
|
16
|
-
throw new Error("Wrong number of arguments");
|
|
17
|
-
}
|
|
1
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3.6/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
|
|
18
2
|
function isBoolean(data) {
|
|
19
3
|
return typeof data === "boolean";
|
|
20
4
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
((isDefined2) => {
|
|
25
|
-
function strict(data) {
|
|
26
|
-
return data !== void 0;
|
|
27
|
-
}
|
|
28
|
-
isDefined2.strict = strict;
|
|
29
|
-
})(isDefined || (isDefined = {}));
|
|
30
|
-
function toString(value) {
|
|
31
|
-
return Object.prototype.toString.call(value);
|
|
32
|
-
}
|
|
5
|
+
|
|
6
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3.6/node_modules/@vinicunca/perkakas/dist/es/guard/is-object.js
|
|
33
7
|
function isObject(data) {
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function _countBy(indexed) {
|
|
37
|
-
return (array, fn) => {
|
|
38
|
-
return array.reduce((ret, item, index) => {
|
|
39
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
40
|
-
return ret + (value ? 1 : 0);
|
|
41
|
-
}, 0);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function countBy(...args) {
|
|
45
|
-
return purry(_countBy(false), args);
|
|
46
|
-
}
|
|
47
|
-
((countBy2) => {
|
|
48
|
-
function indexed(...args) {
|
|
49
|
-
return purry(_countBy(true), args);
|
|
50
|
-
}
|
|
51
|
-
countBy2.indexed = indexed;
|
|
52
|
-
})(countBy || (countBy = {}));
|
|
53
|
-
function _reduceLazy(array, lazy, indexed) {
|
|
54
|
-
const newArray = [];
|
|
55
|
-
for (let index = 0; index < array.length; index++) {
|
|
56
|
-
const item = array[index];
|
|
57
|
-
const result = indexed ? lazy(item, index, array) : lazy(item);
|
|
58
|
-
if (result.hasMany === true) {
|
|
59
|
-
newArray.push(...result.next);
|
|
60
|
-
} else if (result.hasNext) {
|
|
61
|
-
newArray.push(result.next);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return newArray;
|
|
65
|
-
}
|
|
66
|
-
function differenceWith(...args) {
|
|
67
|
-
return purry(_differenceWith, args, differenceWith.lazy);
|
|
68
|
-
}
|
|
69
|
-
function _differenceWith(array, other, isEquals) {
|
|
70
|
-
const lazy = differenceWith.lazy(other, isEquals);
|
|
71
|
-
return _reduceLazy(array, lazy);
|
|
72
|
-
}
|
|
73
|
-
((differenceWith2) => {
|
|
74
|
-
function lazy(other, isEquals) {
|
|
75
|
-
return (value) => {
|
|
76
|
-
if (other.every((otherValue) => !isEquals(value, otherValue))) {
|
|
77
|
-
return {
|
|
78
|
-
done: false,
|
|
79
|
-
hasNext: true,
|
|
80
|
-
next: value
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
done: false,
|
|
85
|
-
hasNext: false
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
differenceWith2.lazy = lazy;
|
|
90
|
-
})(differenceWith || (differenceWith = {}));
|
|
91
|
-
function difference(...args) {
|
|
92
|
-
return purry(_difference, args, difference.lazy);
|
|
93
|
-
}
|
|
94
|
-
function _difference(array, other) {
|
|
95
|
-
const lazy = difference.lazy(other);
|
|
96
|
-
return _reduceLazy(array, lazy);
|
|
97
|
-
}
|
|
98
|
-
((difference2) => {
|
|
99
|
-
function lazy(other) {
|
|
100
|
-
const set2 = new Set(other);
|
|
101
|
-
return (value) => {
|
|
102
|
-
if (!set2.has(value)) {
|
|
103
|
-
return {
|
|
104
|
-
done: false,
|
|
105
|
-
hasNext: true,
|
|
106
|
-
next: value
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
done: false,
|
|
111
|
-
hasNext: false
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
difference2.lazy = lazy;
|
|
116
|
-
})(difference || (difference = {}));
|
|
117
|
-
function drop(...args) {
|
|
118
|
-
return purry(_drop, args, drop.lazy);
|
|
119
|
-
}
|
|
120
|
-
function _drop(array, n) {
|
|
121
|
-
return _reduceLazy(array, drop.lazy(n));
|
|
122
|
-
}
|
|
123
|
-
((drop2) => {
|
|
124
|
-
function lazy(n) {
|
|
125
|
-
let left = n;
|
|
126
|
-
return (value) => {
|
|
127
|
-
if (left > 0) {
|
|
128
|
-
left--;
|
|
129
|
-
return {
|
|
130
|
-
done: false,
|
|
131
|
-
hasNext: false
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
done: false,
|
|
136
|
-
hasNext: true,
|
|
137
|
-
next: value
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
drop2.lazy = lazy;
|
|
142
|
-
})(drop || (drop = {}));
|
|
143
|
-
function toLazyIndexed(fn) {
|
|
144
|
-
fn.indexed = true;
|
|
145
|
-
return fn;
|
|
146
|
-
}
|
|
147
|
-
function filter(...args) {
|
|
148
|
-
return purry(_filter(false), args, filter.lazy);
|
|
149
|
-
}
|
|
150
|
-
function _filter(indexed) {
|
|
151
|
-
return (array, fn) => {
|
|
152
|
-
return _reduceLazy(
|
|
153
|
-
array,
|
|
154
|
-
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
155
|
-
indexed
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function _lazy(indexed) {
|
|
160
|
-
return (fn) => {
|
|
161
|
-
return (value, index, array) => {
|
|
162
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
163
|
-
if (valid) {
|
|
164
|
-
return {
|
|
165
|
-
done: false,
|
|
166
|
-
hasNext: true,
|
|
167
|
-
next: value
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
done: false,
|
|
172
|
-
hasNext: false
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
((filter2) => {
|
|
178
|
-
function indexed(...args) {
|
|
179
|
-
return purry(_filter(true), args, filter2.lazyIndexed);
|
|
180
|
-
}
|
|
181
|
-
filter2.indexed = indexed;
|
|
182
|
-
filter2.lazy = _lazy(false);
|
|
183
|
-
filter2.lazyIndexed = toLazyIndexed(_lazy(true));
|
|
184
|
-
})(filter || (filter = {}));
|
|
185
|
-
function toSingle(fn) {
|
|
186
|
-
fn.single = true;
|
|
187
|
-
return fn;
|
|
188
|
-
}
|
|
189
|
-
function findIndex(...args) {
|
|
190
|
-
return purry(_findIndex(false), args, findIndex.lazy);
|
|
191
|
-
}
|
|
192
|
-
function _findIndex(indexed) {
|
|
193
|
-
return (array, fn) => {
|
|
194
|
-
if (indexed) {
|
|
195
|
-
return array.findIndex(fn);
|
|
196
|
-
}
|
|
197
|
-
return array.findIndex((x) => fn(x));
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
function _lazy2(indexed) {
|
|
201
|
-
return (fn) => {
|
|
202
|
-
let i = 0;
|
|
203
|
-
return (value, index, array) => {
|
|
204
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
205
|
-
if (valid) {
|
|
206
|
-
return {
|
|
207
|
-
done: true,
|
|
208
|
-
hasNext: true,
|
|
209
|
-
next: i
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
i++;
|
|
213
|
-
return {
|
|
214
|
-
done: false,
|
|
215
|
-
hasNext: false
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
((findIndex2) => {
|
|
221
|
-
function indexed(...args) {
|
|
222
|
-
return purry(_findIndex(true), args, findIndex2.lazyIndexed);
|
|
223
|
-
}
|
|
224
|
-
findIndex2.indexed = indexed;
|
|
225
|
-
findIndex2.lazy = toSingle(_lazy2(false));
|
|
226
|
-
findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
|
|
227
|
-
})(findIndex || (findIndex = {}));
|
|
228
|
-
function findLastIndex(...args) {
|
|
229
|
-
return purry(_findLastIndex(false), args);
|
|
230
|
-
}
|
|
231
|
-
function _findLastIndex(indexed) {
|
|
232
|
-
return (array, fn) => {
|
|
233
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
234
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
235
|
-
return i;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return -1;
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
((findLastIndex2) => {
|
|
242
|
-
function indexed(...args) {
|
|
243
|
-
return purry(_findLastIndex(true), args);
|
|
244
|
-
}
|
|
245
|
-
findLastIndex2.indexed = indexed;
|
|
246
|
-
})(findLastIndex || (findLastIndex = {}));
|
|
247
|
-
function findLast(...args) {
|
|
248
|
-
return purry(_findLast(false), args);
|
|
249
|
-
}
|
|
250
|
-
function _findLast(indexed) {
|
|
251
|
-
return (array, fn) => {
|
|
252
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
253
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
254
|
-
return array[i];
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
((findLast2) => {
|
|
260
|
-
function indexed(...args) {
|
|
261
|
-
return purry(_findLast(true), args);
|
|
262
|
-
}
|
|
263
|
-
findLast2.indexed = indexed;
|
|
264
|
-
})(findLast || (findLast = {}));
|
|
265
|
-
function find(...args) {
|
|
266
|
-
return purry(_find(false), args, find.lazy);
|
|
267
|
-
}
|
|
268
|
-
function _find(indexed) {
|
|
269
|
-
return (array, fn) => {
|
|
270
|
-
if (indexed) {
|
|
271
|
-
return array.find(fn);
|
|
272
|
-
}
|
|
273
|
-
return array.find((x) => fn(x));
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function _lazy3(indexed) {
|
|
277
|
-
return (fn) => {
|
|
278
|
-
return (value, index, array) => {
|
|
279
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
280
|
-
return {
|
|
281
|
-
done: valid,
|
|
282
|
-
hasNext: valid,
|
|
283
|
-
next: value
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
((find2) => {
|
|
289
|
-
function indexed(...args) {
|
|
290
|
-
return purry(_find(true), args, find2.lazyIndexed);
|
|
291
|
-
}
|
|
292
|
-
find2.indexed = indexed;
|
|
293
|
-
find2.lazy = toSingle(_lazy3(false));
|
|
294
|
-
find2.lazyIndexed = toSingle(toLazyIndexed(_lazy3(true)));
|
|
295
|
-
})(find || (find = {}));
|
|
296
|
-
function first(...args) {
|
|
297
|
-
return purry(_first, args, first.lazy);
|
|
298
|
-
}
|
|
299
|
-
function _first([first2]) {
|
|
300
|
-
return first2;
|
|
301
|
-
}
|
|
302
|
-
((first2) => {
|
|
303
|
-
function lazy() {
|
|
304
|
-
return (value) => {
|
|
305
|
-
return {
|
|
306
|
-
done: true,
|
|
307
|
-
hasNext: true,
|
|
308
|
-
next: value
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
first2.lazy = lazy;
|
|
313
|
-
((lazy2) => {
|
|
314
|
-
lazy2.single = true;
|
|
315
|
-
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
316
|
-
})(first || (first = {}));
|
|
317
|
-
function flatMapToObj(...args) {
|
|
318
|
-
return purry(_flatMapToObj(false), args);
|
|
319
|
-
}
|
|
320
|
-
function _flatMapToObj(indexed) {
|
|
321
|
-
return (array, fn) => {
|
|
322
|
-
return array.reduce((result, element, index) => {
|
|
323
|
-
const items = indexed ? fn(element, index, array) : fn(element);
|
|
324
|
-
items.forEach(([key, value]) => {
|
|
325
|
-
result[key] = value;
|
|
326
|
-
});
|
|
327
|
-
return result;
|
|
328
|
-
}, {});
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
((flatMapToObj2) => {
|
|
332
|
-
function indexed(...args) {
|
|
333
|
-
return purry(_flatMapToObj(true), args);
|
|
334
|
-
}
|
|
335
|
-
flatMapToObj2.indexed = indexed;
|
|
336
|
-
})(flatMapToObj || (flatMapToObj = {}));
|
|
337
|
-
function flatten(...args) {
|
|
338
|
-
return purry(_flatten, args, flatten.lazy);
|
|
339
|
-
}
|
|
340
|
-
function _flatten(items) {
|
|
341
|
-
return _reduceLazy(items, flatten.lazy());
|
|
342
|
-
}
|
|
343
|
-
((flatten2) => {
|
|
344
|
-
function lazy() {
|
|
345
|
-
return (next) => {
|
|
346
|
-
if (Array.isArray(next)) {
|
|
347
|
-
return {
|
|
348
|
-
done: false,
|
|
349
|
-
hasNext: true,
|
|
350
|
-
hasMany: true,
|
|
351
|
-
next
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
done: false,
|
|
356
|
-
hasNext: true,
|
|
357
|
-
next
|
|
358
|
-
};
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
flatten2.lazy = lazy;
|
|
362
|
-
})(flatten || (flatten = {}));
|
|
363
|
-
function flatMap(...args) {
|
|
364
|
-
return purry(_flatMap, args, flatMap.lazy);
|
|
365
|
-
}
|
|
366
|
-
function _flatMap(array, fn) {
|
|
367
|
-
return flatten(array.map((item) => fn(item)));
|
|
368
|
-
}
|
|
369
|
-
((flatMap2) => {
|
|
370
|
-
function lazy(fn) {
|
|
371
|
-
return (value) => {
|
|
372
|
-
const next = fn(value);
|
|
373
|
-
if (Array.isArray(next)) {
|
|
374
|
-
return {
|
|
375
|
-
done: false,
|
|
376
|
-
hasNext: true,
|
|
377
|
-
hasMany: true,
|
|
378
|
-
next
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
return {
|
|
382
|
-
done: false,
|
|
383
|
-
hasNext: true,
|
|
384
|
-
next
|
|
385
|
-
};
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
flatMap2.lazy = lazy;
|
|
389
|
-
})(flatMap || (flatMap = {}));
|
|
390
|
-
function flattenDeep(...args) {
|
|
391
|
-
return purry(_flattenDeep, args, flattenDeep.lazy);
|
|
392
|
-
}
|
|
393
|
-
function _flattenDeep(items) {
|
|
394
|
-
return _reduceLazy(items, flattenDeep.lazy());
|
|
395
|
-
}
|
|
396
|
-
function _flattenDeepValue(value) {
|
|
397
|
-
if (!Array.isArray(value)) {
|
|
398
|
-
return value;
|
|
399
|
-
}
|
|
400
|
-
const ret = [];
|
|
401
|
-
value.forEach((item) => {
|
|
402
|
-
if (Array.isArray(item)) {
|
|
403
|
-
ret.push(...flattenDeep(item));
|
|
404
|
-
} else {
|
|
405
|
-
ret.push(item);
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
return ret;
|
|
409
|
-
}
|
|
410
|
-
((flattenDeep2) => {
|
|
411
|
-
function lazy() {
|
|
412
|
-
return (value) => {
|
|
413
|
-
const next = _flattenDeepValue(value);
|
|
414
|
-
if (Array.isArray(next)) {
|
|
415
|
-
return {
|
|
416
|
-
done: false,
|
|
417
|
-
hasNext: true,
|
|
418
|
-
hasMany: true,
|
|
419
|
-
next
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
return {
|
|
423
|
-
done: false,
|
|
424
|
-
hasNext: true,
|
|
425
|
-
next
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
flattenDeep2.lazy = lazy;
|
|
430
|
-
})(flattenDeep || (flattenDeep = {}));
|
|
431
|
-
function forEach(...args) {
|
|
432
|
-
return purry(_forEach(false), args, forEach.lazy);
|
|
433
|
-
}
|
|
434
|
-
function _forEach(indexed) {
|
|
435
|
-
return (array, fn) => {
|
|
436
|
-
return _reduceLazy(
|
|
437
|
-
array,
|
|
438
|
-
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
439
|
-
indexed
|
|
440
|
-
);
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
function _lazy4(indexed) {
|
|
444
|
-
return (fn) => {
|
|
445
|
-
return (value, index, array) => {
|
|
446
|
-
if (indexed) {
|
|
447
|
-
fn(value, index, array);
|
|
448
|
-
} else {
|
|
449
|
-
fn(value);
|
|
450
|
-
}
|
|
451
|
-
return {
|
|
452
|
-
done: false,
|
|
453
|
-
hasNext: true,
|
|
454
|
-
next: value
|
|
455
|
-
};
|
|
456
|
-
};
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
((forEach2) => {
|
|
460
|
-
function indexed(...args) {
|
|
461
|
-
return purry(_forEach(true), args, forEach2.lazyIndexed);
|
|
462
|
-
}
|
|
463
|
-
forEach2.indexed = indexed;
|
|
464
|
-
forEach2.lazy = _lazy4(false);
|
|
465
|
-
forEach2.lazyIndexed = toLazyIndexed(_lazy4(true));
|
|
466
|
-
})(forEach || (forEach = {}));
|
|
467
|
-
function groupBy(...args) {
|
|
468
|
-
return purry(_groupBy(false), args);
|
|
469
|
-
}
|
|
470
|
-
function _groupBy(indexed) {
|
|
471
|
-
return (array, fn) => {
|
|
472
|
-
const ret = {};
|
|
473
|
-
array.forEach((item, index) => {
|
|
474
|
-
const key = indexed ? fn(item, index, array) : fn(item);
|
|
475
|
-
if (key !== void 0) {
|
|
476
|
-
const actualKey = String(key);
|
|
477
|
-
if (!ret[actualKey]) {
|
|
478
|
-
ret[actualKey] = [];
|
|
479
|
-
}
|
|
480
|
-
ret[actualKey].push(item);
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
return ret;
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
((groupBy2) => {
|
|
487
|
-
function indexed(...args) {
|
|
488
|
-
return purry(_groupBy(true), args);
|
|
489
|
-
}
|
|
490
|
-
groupBy2.indexed = indexed;
|
|
491
|
-
groupBy2.strict = groupBy2;
|
|
492
|
-
})(groupBy || (groupBy = {}));
|
|
493
|
-
function indexBy(...args) {
|
|
494
|
-
return purry(_indexBy(false), args);
|
|
495
|
-
}
|
|
496
|
-
function _indexBy(indexed) {
|
|
497
|
-
return (array, fn) => {
|
|
498
|
-
return array.reduce((ret, item, index) => {
|
|
499
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
500
|
-
const key = String(value);
|
|
501
|
-
ret[key] = item;
|
|
502
|
-
return ret;
|
|
503
|
-
}, {});
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
((indexBy2) => {
|
|
507
|
-
function indexed(...args) {
|
|
508
|
-
return purry(_indexBy(true), args);
|
|
509
|
-
}
|
|
510
|
-
indexBy2.indexed = indexed;
|
|
511
|
-
})(indexBy || (indexBy = {}));
|
|
512
|
-
function intersection(...args) {
|
|
513
|
-
return purry(_intersection, args, intersection.lazy);
|
|
514
|
-
}
|
|
515
|
-
function _intersection(array, other) {
|
|
516
|
-
const lazy = intersection.lazy(other);
|
|
517
|
-
return _reduceLazy(array, lazy);
|
|
518
|
-
}
|
|
519
|
-
((intersection2) => {
|
|
520
|
-
function lazy(other) {
|
|
521
|
-
return (value) => {
|
|
522
|
-
const set2 = new Set(other);
|
|
523
|
-
if (set2.has(value)) {
|
|
524
|
-
return {
|
|
525
|
-
done: false,
|
|
526
|
-
hasNext: true,
|
|
527
|
-
next: value
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
return {
|
|
531
|
-
done: false,
|
|
532
|
-
hasNext: false
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
intersection2.lazy = lazy;
|
|
537
|
-
})(intersection || (intersection = {}));
|
|
538
|
-
function intersectionWith(...args) {
|
|
539
|
-
return purry(_intersectionWith, args, intersectionWith.lazy);
|
|
540
|
-
}
|
|
541
|
-
function _intersectionWith(array, other, comparator) {
|
|
542
|
-
const lazy = intersectionWith.lazy(other, comparator);
|
|
543
|
-
return _reduceLazy(array, lazy);
|
|
544
|
-
}
|
|
545
|
-
((intersectionWith2) => {
|
|
546
|
-
function lazy(other, comparator) {
|
|
547
|
-
return (value) => {
|
|
548
|
-
if (other.some((otherValue) => comparator(value, otherValue))) {
|
|
549
|
-
return {
|
|
550
|
-
done: false,
|
|
551
|
-
hasNext: true,
|
|
552
|
-
next: value
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
return {
|
|
556
|
-
done: false,
|
|
557
|
-
hasNext: false
|
|
558
|
-
};
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
intersectionWith2.lazy = lazy;
|
|
562
|
-
})(intersectionWith || (intersectionWith = {}));
|
|
563
|
-
function map(...args) {
|
|
564
|
-
return purry(_map(false), args, map.lazy);
|
|
565
|
-
}
|
|
566
|
-
function _map(indexed) {
|
|
567
|
-
return (array, fn) => {
|
|
568
|
-
return _reduceLazy(
|
|
569
|
-
array,
|
|
570
|
-
indexed ? map.lazyIndexed(fn) : map.lazy(fn),
|
|
571
|
-
indexed
|
|
572
|
-
);
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
function _lazy5(indexed) {
|
|
576
|
-
return (fn) => {
|
|
577
|
-
return (value, index, array) => {
|
|
578
|
-
return {
|
|
579
|
-
done: false,
|
|
580
|
-
hasNext: true,
|
|
581
|
-
next: indexed ? fn(value, index, array) : fn(value)
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
((map2) => {
|
|
587
|
-
function indexed(...args) {
|
|
588
|
-
return purry(_map(true), args, map2.lazyIndexed);
|
|
589
|
-
}
|
|
590
|
-
map2.indexed = indexed;
|
|
591
|
-
map2.lazy = _lazy5(false);
|
|
592
|
-
map2.lazyIndexed = toLazyIndexed(_lazy5(true));
|
|
593
|
-
map2.strict = map2;
|
|
594
|
-
})(map || (map = {}));
|
|
595
|
-
function mapToObj(...args) {
|
|
596
|
-
return purry(_mapToObj(false), args);
|
|
597
|
-
}
|
|
598
|
-
function _mapToObj(indexed) {
|
|
599
|
-
return (array, fn) => {
|
|
600
|
-
return array.reduce((result, element, index) => {
|
|
601
|
-
const [key, value] = indexed ? fn(element, index, array) : fn(element);
|
|
602
|
-
result[key] = value;
|
|
603
|
-
return result;
|
|
604
|
-
}, {});
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
((mapToObj2) => {
|
|
608
|
-
function indexed(...args) {
|
|
609
|
-
return purry(_mapToObj(true), args);
|
|
610
|
-
}
|
|
611
|
-
mapToObj2.indexed = indexed;
|
|
612
|
-
})(mapToObj || (mapToObj = {}));
|
|
613
|
-
function _maxBy(indexed) {
|
|
614
|
-
return (array, fn) => {
|
|
615
|
-
let ret;
|
|
616
|
-
let retMax;
|
|
617
|
-
array.forEach((item, i) => {
|
|
618
|
-
const max = indexed ? fn(item, i, array) : fn(item);
|
|
619
|
-
if (retMax === void 0 || max > retMax) {
|
|
620
|
-
ret = item;
|
|
621
|
-
retMax = max;
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
return ret;
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
function maxBy(...args) {
|
|
628
|
-
return purry(_maxBy(false), args);
|
|
629
|
-
}
|
|
630
|
-
((maxBy2) => {
|
|
631
|
-
function indexed(...args) {
|
|
632
|
-
return purry(_maxBy(true), args);
|
|
633
|
-
}
|
|
634
|
-
maxBy2.indexed = indexed;
|
|
635
|
-
})(maxBy || (maxBy = {}));
|
|
636
|
-
function _meanBy(indexed) {
|
|
637
|
-
return (array, fn) => {
|
|
638
|
-
if (array.length === 0) {
|
|
639
|
-
return Number.NaN;
|
|
640
|
-
}
|
|
641
|
-
let sum = 0;
|
|
642
|
-
array.forEach((item, i) => {
|
|
643
|
-
sum += indexed ? fn(item, i, array) : fn(item);
|
|
644
|
-
});
|
|
645
|
-
return sum / array.length;
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
function meanBy(...args) {
|
|
649
|
-
return purry(_meanBy(false), args);
|
|
650
|
-
}
|
|
651
|
-
((meanBy2) => {
|
|
652
|
-
function indexed(...args) {
|
|
653
|
-
return purry(_meanBy(true), args);
|
|
654
|
-
}
|
|
655
|
-
meanBy2.indexed = indexed;
|
|
656
|
-
})(meanBy || (meanBy = {}));
|
|
657
|
-
function _minBy(indexed) {
|
|
658
|
-
return (array, fn) => {
|
|
659
|
-
let ret;
|
|
660
|
-
let retMin;
|
|
661
|
-
array.forEach((item, i) => {
|
|
662
|
-
const min = indexed ? fn(item, i, array) : fn(item);
|
|
663
|
-
if (retMin === void 0 || min < retMin) {
|
|
664
|
-
ret = item;
|
|
665
|
-
retMin = min;
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
return ret;
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
function minBy(...args) {
|
|
672
|
-
return purry(_minBy(false), args);
|
|
673
|
-
}
|
|
674
|
-
((minBy2) => {
|
|
675
|
-
function indexed(...args) {
|
|
676
|
-
return purry(_minBy(true), args);
|
|
677
|
-
}
|
|
678
|
-
minBy2.indexed = indexed;
|
|
679
|
-
})(minBy || (minBy = {}));
|
|
680
|
-
function partition(...args) {
|
|
681
|
-
return purry(_partition(false), args);
|
|
682
|
-
}
|
|
683
|
-
function _partition(indexed) {
|
|
684
|
-
return (array, fn) => {
|
|
685
|
-
const ret = [[], []];
|
|
686
|
-
array.forEach((item, index) => {
|
|
687
|
-
const matches = indexed ? fn(item, index, array) : fn(item);
|
|
688
|
-
ret[matches ? 0 : 1].push(item);
|
|
689
|
-
});
|
|
690
|
-
return ret;
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
((partition2) => {
|
|
694
|
-
function indexed(...args) {
|
|
695
|
-
return purry(_partition(true), args);
|
|
696
|
-
}
|
|
697
|
-
partition2.indexed = indexed;
|
|
698
|
-
})(partition || (partition = {}));
|
|
699
|
-
function reduce(...args) {
|
|
700
|
-
return purry(_reduce(false), args);
|
|
701
|
-
}
|
|
702
|
-
function _reduce(indexed) {
|
|
703
|
-
return (items, fn, initialValue) => {
|
|
704
|
-
return items.reduce(
|
|
705
|
-
(acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
|
|
706
|
-
initialValue
|
|
707
|
-
);
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
((reduce2) => {
|
|
711
|
-
function indexed(...args) {
|
|
712
|
-
return purry(_reduce(true), args);
|
|
713
|
-
}
|
|
714
|
-
reduce2.indexed = indexed;
|
|
715
|
-
})(reduce || (reduce = {}));
|
|
716
|
-
function reject(...args) {
|
|
717
|
-
return purry(_reject(false), args, reject.lazy);
|
|
718
|
-
}
|
|
719
|
-
function _reject(indexed) {
|
|
720
|
-
return (array, fn) => {
|
|
721
|
-
return _reduceLazy(
|
|
722
|
-
array,
|
|
723
|
-
indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
|
|
724
|
-
indexed
|
|
725
|
-
);
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
function _lazy6(indexed) {
|
|
729
|
-
return (fn) => {
|
|
730
|
-
return (value, index, array) => {
|
|
731
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
732
|
-
if (!valid) {
|
|
733
|
-
return {
|
|
734
|
-
done: false,
|
|
735
|
-
hasNext: true,
|
|
736
|
-
next: value
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
return {
|
|
740
|
-
done: false,
|
|
741
|
-
hasNext: false
|
|
742
|
-
};
|
|
743
|
-
};
|
|
744
|
-
};
|
|
745
|
-
}
|
|
746
|
-
((reject2) => {
|
|
747
|
-
function indexed(...args) {
|
|
748
|
-
return purry(_reject(true), args, reject2.lazyIndexed);
|
|
749
|
-
}
|
|
750
|
-
reject2.indexed = indexed;
|
|
751
|
-
reject2.lazy = _lazy6(false);
|
|
752
|
-
reject2.lazyIndexed = toLazyIndexed(_lazy6(true));
|
|
753
|
-
})(reject || (reject = {}));
|
|
754
|
-
function sort(...args) {
|
|
755
|
-
return purry(_sort, args);
|
|
756
|
-
}
|
|
757
|
-
function _sort(items, cmp) {
|
|
758
|
-
const ret = [...items];
|
|
759
|
-
ret.sort(cmp);
|
|
760
|
-
return ret;
|
|
761
|
-
}
|
|
762
|
-
((sort2) => {
|
|
763
|
-
sort2.strict = sort2;
|
|
764
|
-
})(sort || (sort = {}));
|
|
765
|
-
var ALL_DIRECTIONS = ["asc", "desc"];
|
|
766
|
-
var COMPARATOR = {
|
|
767
|
-
asc: (x, y) => x > y,
|
|
768
|
-
desc: (x, y) => x < y
|
|
769
|
-
};
|
|
770
|
-
function sortBy(arrayOrSortRule, ...sortRules) {
|
|
771
|
-
const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
|
|
772
|
-
return purry(_sortBy, args);
|
|
773
|
-
}
|
|
774
|
-
function isSortRule(x) {
|
|
775
|
-
if (typeof x === "function") {
|
|
776
|
-
return true;
|
|
777
|
-
}
|
|
778
|
-
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
779
|
-
if (rest.length > 0) {
|
|
8
|
+
if (typeof data !== "object" || data === null) {
|
|
780
9
|
return false;
|
|
781
10
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
function _sortBy(array, sorts) {
|
|
785
|
-
return [...array].sort(comparer(...sorts));
|
|
786
|
-
}
|
|
787
|
-
function comparer(primaryRule, secondaryRule, ...otherRules) {
|
|
788
|
-
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
789
|
-
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
790
|
-
const comparator = COMPARATOR[direction];
|
|
791
|
-
const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
|
|
792
|
-
return (a, b) => {
|
|
793
|
-
const projectedA = projector(a);
|
|
794
|
-
const projectedB = projector(b);
|
|
795
|
-
if (comparator(projectedA, projectedB)) {
|
|
796
|
-
return 1;
|
|
797
|
-
}
|
|
798
|
-
if (comparator(projectedB, projectedA)) {
|
|
799
|
-
return -1;
|
|
800
|
-
}
|
|
801
|
-
return nextComparer?.(a, b) ?? 0;
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
((sortBy2) => {
|
|
805
|
-
sortBy2.strict = sortBy2;
|
|
806
|
-
})(sortBy || (sortBy = {}));
|
|
807
|
-
function _sumBy(indexed) {
|
|
808
|
-
return (array, fn) => {
|
|
809
|
-
let sum = 0;
|
|
810
|
-
array.forEach((item, i) => {
|
|
811
|
-
const summand = indexed ? fn(item, i, array) : fn(item);
|
|
812
|
-
sum += summand;
|
|
813
|
-
});
|
|
814
|
-
return sum;
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
function sumBy(...args) {
|
|
818
|
-
return purry(_sumBy(false), args);
|
|
819
|
-
}
|
|
820
|
-
((sumBy2) => {
|
|
821
|
-
function indexed(...args) {
|
|
822
|
-
return purry(_sumBy(true), args);
|
|
823
|
-
}
|
|
824
|
-
sumBy2.indexed = indexed;
|
|
825
|
-
})(sumBy || (sumBy = {}));
|
|
826
|
-
function take(...args) {
|
|
827
|
-
return purry(_take, args, take.lazy);
|
|
11
|
+
const proto = Object.getPrototypeOf(data);
|
|
12
|
+
return proto === null || proto === Object.prototype;
|
|
828
13
|
}
|
|
829
|
-
function _take(array, n) {
|
|
830
|
-
return _reduceLazy(array, take.lazy(n));
|
|
831
|
-
}
|
|
832
|
-
((take2) => {
|
|
833
|
-
function lazy(n) {
|
|
834
|
-
return (value) => {
|
|
835
|
-
if (n === 0) {
|
|
836
|
-
return {
|
|
837
|
-
done: true,
|
|
838
|
-
hasNext: false
|
|
839
|
-
};
|
|
840
|
-
}
|
|
841
|
-
n--;
|
|
842
|
-
if (n === 0) {
|
|
843
|
-
return {
|
|
844
|
-
done: true,
|
|
845
|
-
hasNext: true,
|
|
846
|
-
next: value
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
return {
|
|
850
|
-
done: false,
|
|
851
|
-
hasNext: true,
|
|
852
|
-
next: value
|
|
853
|
-
};
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
take2.lazy = lazy;
|
|
857
|
-
})(take || (take = {}));
|
|
858
|
-
function uniq(...args) {
|
|
859
|
-
return purry(_uniq, args, uniq.lazy);
|
|
860
|
-
}
|
|
861
|
-
function _uniq(array) {
|
|
862
|
-
return _reduceLazy(array, uniq.lazy());
|
|
863
|
-
}
|
|
864
|
-
((uniq2) => {
|
|
865
|
-
function lazy() {
|
|
866
|
-
const set2 = /* @__PURE__ */ new Set();
|
|
867
|
-
return (value) => {
|
|
868
|
-
if (set2.has(value)) {
|
|
869
|
-
return {
|
|
870
|
-
done: false,
|
|
871
|
-
hasNext: false
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
set2.add(value);
|
|
875
|
-
return {
|
|
876
|
-
done: false,
|
|
877
|
-
hasNext: true,
|
|
878
|
-
next: value
|
|
879
|
-
};
|
|
880
|
-
};
|
|
881
|
-
}
|
|
882
|
-
uniq2.lazy = lazy;
|
|
883
|
-
})(uniq || (uniq = {}));
|
|
884
|
-
function uniqWith(...args) {
|
|
885
|
-
return purry(_uniqWith, args, uniqWith.lazy);
|
|
886
|
-
}
|
|
887
|
-
function _uniqWith(array, isEquals) {
|
|
888
|
-
const lazy = uniqWith.lazy(isEquals);
|
|
889
|
-
return _reduceLazy(array, lazy, true);
|
|
890
|
-
}
|
|
891
|
-
function _lazy7(isEquals) {
|
|
892
|
-
return (value, index, array) => {
|
|
893
|
-
if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
|
|
894
|
-
return {
|
|
895
|
-
done: false,
|
|
896
|
-
hasNext: true,
|
|
897
|
-
next: value
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
done: false,
|
|
902
|
-
hasNext: false
|
|
903
|
-
};
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
((uniqWith2) => {
|
|
907
|
-
uniqWith2.lazy = toLazyIndexed(_lazy7);
|
|
908
|
-
})(uniqWith || (uniqWith = {}));
|
|
909
|
-
var isArray2 = Array.isArray;
|
|
910
|
-
function forEachObj(...args) {
|
|
911
|
-
return purry(_forEachObj(false), args);
|
|
912
|
-
}
|
|
913
|
-
function _forEachObj(indexed) {
|
|
914
|
-
return (object, fn) => {
|
|
915
|
-
for (const key in object) {
|
|
916
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
917
|
-
const val = object[key];
|
|
918
|
-
if (indexed) {
|
|
919
|
-
fn(val, key, object);
|
|
920
|
-
} else {
|
|
921
|
-
fn(val);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
return object;
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
((forEachObj2) => {
|
|
929
|
-
function indexed(...args) {
|
|
930
|
-
return purry(_forEachObj(true), args);
|
|
931
|
-
}
|
|
932
|
-
forEachObj2.indexed = indexed;
|
|
933
|
-
})(forEachObj || (forEachObj = {}));
|
|
934
|
-
function fromPairs(entries) {
|
|
935
|
-
const out = {};
|
|
936
|
-
for (const [key, value] of entries) {
|
|
937
|
-
out[key] = value;
|
|
938
|
-
}
|
|
939
|
-
return out;
|
|
940
|
-
}
|
|
941
|
-
((fromPairs2) => {
|
|
942
|
-
fromPairs2.strict = fromPairs2;
|
|
943
|
-
})(fromPairs || (fromPairs = {}));
|
|
944
|
-
function keys(source) {
|
|
945
|
-
return Object.keys(source);
|
|
946
|
-
}
|
|
947
|
-
((keys2) => {
|
|
948
|
-
keys2.strict = keys2;
|
|
949
|
-
})(keys || (keys = {}));
|
|
950
|
-
function toPairs(object) {
|
|
951
|
-
return Object.entries(object);
|
|
952
|
-
}
|
|
953
|
-
((toPairs2) => {
|
|
954
|
-
function strict(object) {
|
|
955
|
-
return Object.entries(object);
|
|
956
|
-
}
|
|
957
|
-
toPairs2.strict = strict;
|
|
958
|
-
})(toPairs || (toPairs = {}));
|
|
959
14
|
|
|
960
15
|
// src/base.ts
|
|
961
16
|
import { isPackageExists } from "local-pkg";
|
|
17
|
+
import fs from "fs";
|
|
962
18
|
import process2 from "process";
|
|
963
19
|
|
|
964
20
|
// src/flags.ts
|
|
@@ -996,10 +52,6 @@ async function comments() {
|
|
|
996
52
|
];
|
|
997
53
|
}
|
|
998
54
|
|
|
999
|
-
// src/configs/ignores.ts
|
|
1000
|
-
import fs from "fs";
|
|
1001
|
-
import parseGitignore from "parse-gitignore";
|
|
1002
|
-
|
|
1003
55
|
// src/globs.ts
|
|
1004
56
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
1005
57
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -1070,33 +122,10 @@ var GLOB_EXCLUDE = [
|
|
|
1070
122
|
];
|
|
1071
123
|
|
|
1072
124
|
// src/configs/ignores.ts
|
|
1073
|
-
async function ignores({
|
|
1074
|
-
enableGitignore = true,
|
|
1075
|
-
items = [],
|
|
1076
|
-
replace = false
|
|
1077
|
-
} = {}) {
|
|
1078
|
-
const ignoreList = [];
|
|
1079
|
-
if (enableGitignore && fs.existsSync(".gitignore")) {
|
|
1080
|
-
const gitignoreContent = fs.readFileSync(".gitignore", "utf8");
|
|
1081
|
-
const parsed = parseGitignore(gitignoreContent);
|
|
1082
|
-
const globs = parsed.globs();
|
|
1083
|
-
for (const glob of globs) {
|
|
1084
|
-
if (glob.type === "ignore") {
|
|
1085
|
-
ignoreList.push(...glob.patterns);
|
|
1086
|
-
} else if (glob.type === "unignore") {
|
|
1087
|
-
ignoreList.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
1088
|
-
}
|
|
1089
|
-
;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
if (replace) {
|
|
1093
|
-
ignoreList.push(...items);
|
|
1094
|
-
} else {
|
|
1095
|
-
ignoreList.push(...GLOB_EXCLUDE, ...items);
|
|
1096
|
-
}
|
|
125
|
+
async function ignores() {
|
|
1097
126
|
return [
|
|
1098
127
|
{
|
|
1099
|
-
ignores:
|
|
128
|
+
ignores: GLOB_EXCLUDE
|
|
1100
129
|
}
|
|
1101
130
|
];
|
|
1102
131
|
}
|
|
@@ -2157,6 +1186,8 @@ async function typescript(options = {}) {
|
|
|
2157
1186
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2158
1187
|
];
|
|
2159
1188
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1189
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1190
|
+
const isTypeAware = !!tsconfigPath;
|
|
2160
1191
|
const typeAwareRules = {
|
|
2161
1192
|
"dot-notation": OFF,
|
|
2162
1193
|
"no-implied-eval": OFF,
|
|
@@ -2172,7 +1203,6 @@ async function typescript(options = {}) {
|
|
|
2172
1203
|
"ts/restrict-plus-operands": ERROR,
|
|
2173
1204
|
"ts/restrict-template-expressions": ERROR
|
|
2174
1205
|
};
|
|
2175
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
2176
1206
|
const [
|
|
2177
1207
|
pluginTs,
|
|
2178
1208
|
parserTs
|
|
@@ -2180,29 +1210,41 @@ async function typescript(options = {}) {
|
|
|
2180
1210
|
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
2181
1211
|
interopDefault(import("@typescript-eslint/parser"))
|
|
2182
1212
|
]);
|
|
2183
|
-
|
|
2184
|
-
{
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
plugins: {
|
|
2188
|
-
ts: pluginTs,
|
|
2189
|
-
vinicunca: default2
|
|
2190
|
-
}
|
|
2191
|
-
},
|
|
2192
|
-
{
|
|
2193
|
-
files,
|
|
1213
|
+
function makeParser({ files: files2, ignores: ignores2, typeAware }) {
|
|
1214
|
+
return {
|
|
1215
|
+
files: files2,
|
|
1216
|
+
...ignores2 ? { ignores: ignores2 } : {},
|
|
2194
1217
|
languageOptions: {
|
|
2195
1218
|
parser: parserTs,
|
|
2196
1219
|
parserOptions: {
|
|
2197
1220
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
2198
1221
|
sourceType: "module",
|
|
2199
|
-
...
|
|
1222
|
+
...typeAware ? {
|
|
2200
1223
|
project: tsconfigPath,
|
|
2201
1224
|
tsconfigRootDir: process.cwd()
|
|
2202
1225
|
} : {},
|
|
2203
1226
|
...parserOptions
|
|
2204
1227
|
}
|
|
2205
1228
|
},
|
|
1229
|
+
name: `vinicunca:typescript:${typeAware ? "type-aware-parser" : "parser"}`
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
return [
|
|
1233
|
+
{
|
|
1234
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
1235
|
+
name: "vinicunca:typescript:setup",
|
|
1236
|
+
plugins: {
|
|
1237
|
+
ts: pluginTs,
|
|
1238
|
+
vinicunca: default2
|
|
1239
|
+
}
|
|
1240
|
+
},
|
|
1241
|
+
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1242
|
+
...isTypeAware ? [
|
|
1243
|
+
makeParser({ files: filesTypeAware, typeAware: true }),
|
|
1244
|
+
makeParser({ files, ignores: filesTypeAware, typeAware: false })
|
|
1245
|
+
] : [makeParser({ files, typeAware: false })],
|
|
1246
|
+
{
|
|
1247
|
+
files,
|
|
2206
1248
|
name: "vinicunca:typescript:rules",
|
|
2207
1249
|
rules: {
|
|
2208
1250
|
...renameRules(
|
|
@@ -2222,6 +1264,7 @@ async function typescript(options = {}) {
|
|
|
2222
1264
|
"no-unused-vars": OFF,
|
|
2223
1265
|
"no-use-before-define": OFF,
|
|
2224
1266
|
"no-useless-constructor": OFF,
|
|
1267
|
+
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2225
1268
|
"ts/ban-ts-comment": [ERROR, { "ts-ignore": "allow-with-description" }],
|
|
2226
1269
|
"ts/ban-types": [ERROR, { types: { Function: false } }],
|
|
2227
1270
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2229,6 +1272,8 @@ async function typescript(options = {}) {
|
|
|
2229
1272
|
"ts/explicit-function-return-type": OFF,
|
|
2230
1273
|
"ts/explicit-member-accessibility": OFF,
|
|
2231
1274
|
"ts/explicit-module-boundary-types": OFF,
|
|
1275
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1276
|
+
"ts/method-signature-style": ["error", "property"],
|
|
2232
1277
|
"ts/naming-convention": OFF,
|
|
2233
1278
|
"ts/no-dupe-class-members": ERROR,
|
|
2234
1279
|
"ts/no-empty-function": OFF,
|
|
@@ -2611,7 +1656,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2611
1656
|
languageOptions: {
|
|
2612
1657
|
parser: parserPlain
|
|
2613
1658
|
},
|
|
2614
|
-
name: "vinicunca:
|
|
1659
|
+
name: "vinicunca:formatters:css",
|
|
2615
1660
|
rules: {
|
|
2616
1661
|
"format/prettier": [
|
|
2617
1662
|
"error",
|
|
@@ -2627,7 +1672,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2627
1672
|
languageOptions: {
|
|
2628
1673
|
parser: parserPlain
|
|
2629
1674
|
},
|
|
2630
|
-
name: "vinicunca:
|
|
1675
|
+
name: "vinicunca:formatters:scss",
|
|
2631
1676
|
rules: {
|
|
2632
1677
|
"format/prettier": [
|
|
2633
1678
|
"error",
|
|
@@ -2643,7 +1688,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2643
1688
|
languageOptions: {
|
|
2644
1689
|
parser: parserPlain
|
|
2645
1690
|
},
|
|
2646
|
-
name: "vinicunca:
|
|
1691
|
+
name: "vinicunca:formatters:less",
|
|
2647
1692
|
rules: {
|
|
2648
1693
|
"format/prettier": [
|
|
2649
1694
|
"error",
|
|
@@ -2662,7 +1707,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2662
1707
|
languageOptions: {
|
|
2663
1708
|
parser: parserPlain
|
|
2664
1709
|
},
|
|
2665
|
-
name: "vinicunca:
|
|
1710
|
+
name: "vinicunca:formatters:html",
|
|
2666
1711
|
rules: {
|
|
2667
1712
|
"format/prettier": [
|
|
2668
1713
|
"error",
|
|
@@ -2681,7 +1726,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2681
1726
|
languageOptions: {
|
|
2682
1727
|
parser: parserPlain
|
|
2683
1728
|
},
|
|
2684
|
-
name: "vinicunca:
|
|
1729
|
+
name: "vinicunca:formatters:markdown",
|
|
2685
1730
|
rules: {
|
|
2686
1731
|
[`format/${formater}`]: [
|
|
2687
1732
|
"error",
|
|
@@ -2704,7 +1749,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2704
1749
|
languageOptions: {
|
|
2705
1750
|
parser: parserPlain
|
|
2706
1751
|
},
|
|
2707
|
-
name: "vinicunca:
|
|
1752
|
+
name: "vinicunca:formatters:graphql",
|
|
2708
1753
|
rules: {
|
|
2709
1754
|
"format/prettier": [
|
|
2710
1755
|
"error",
|
|
@@ -2721,6 +1766,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
2721
1766
|
|
|
2722
1767
|
// src/base.ts
|
|
2723
1768
|
var flatConfigProps = [
|
|
1769
|
+
"name",
|
|
2724
1770
|
"files",
|
|
2725
1771
|
"ignores",
|
|
2726
1772
|
"languageOptions",
|
|
@@ -2739,6 +1785,7 @@ var VuePackages = [
|
|
|
2739
1785
|
async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2740
1786
|
const {
|
|
2741
1787
|
componentExts = [],
|
|
1788
|
+
gitignore: enableGitignore = true,
|
|
2742
1789
|
isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
|
|
2743
1790
|
react: enableReact = false,
|
|
2744
1791
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
@@ -2755,8 +1802,17 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2755
1802
|
};
|
|
2756
1803
|
}
|
|
2757
1804
|
const configs = [];
|
|
1805
|
+
if (enableGitignore) {
|
|
1806
|
+
if (typeof enableGitignore !== "boolean") {
|
|
1807
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1808
|
+
} else {
|
|
1809
|
+
if (fs.existsSync(".gitignore")) {
|
|
1810
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
2758
1814
|
configs.push(
|
|
2759
|
-
ignores(
|
|
1815
|
+
ignores(),
|
|
2760
1816
|
javascript({
|
|
2761
1817
|
isInEditor,
|
|
2762
1818
|
overrides: getOverrides(options, "javascript")
|