@vinicunca/eslint-config 2.6.2 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +82 -800
- package/dist/index.d.cts +230 -840
- package/dist/index.d.ts +230 -840
- package/dist/index.js +81 -800
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,760 +1,14 @@
|
|
|
1
|
-
// ../node_modules/.pnpm/@vinicunca+perkakas@0.
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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.3/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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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.3/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,
|
|
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(
|
|
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,
|
|
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,
|
|
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
|
|
897
|
-
return [
|
|
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
|
|
@@ -1263,6 +519,9 @@ async function javascript(options = {}) {
|
|
|
1263
519
|
linterOptions: {
|
|
1264
520
|
reportUnusedDisableDirectives: true
|
|
1265
521
|
},
|
|
522
|
+
name: "vinicunca/javascript/setup"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
1266
525
|
name: "vinicunca/javascript/rules",
|
|
1267
526
|
plugins: {
|
|
1268
527
|
"antfu": default2,
|
|
@@ -1548,7 +807,7 @@ async function jsonc(options = {}) {
|
|
|
1548
807
|
} = options;
|
|
1549
808
|
const {
|
|
1550
809
|
indent = 2
|
|
1551
|
-
} =
|
|
810
|
+
} = e(stylistic2) ? {} : stylistic2;
|
|
1552
811
|
const [
|
|
1553
812
|
pluginJsonc,
|
|
1554
813
|
parserJsonc
|
|
@@ -1614,6 +873,23 @@ async function jsonc(options = {}) {
|
|
|
1614
873
|
];
|
|
1615
874
|
}
|
|
1616
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
|
+
|
|
1617
893
|
// src/configs/markdown.ts
|
|
1618
894
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
1619
895
|
async function markdown(options = {}) {
|
|
@@ -1684,25 +960,6 @@ async function markdown(options = {}) {
|
|
|
1684
960
|
"unicode-bom": OFF,
|
|
1685
961
|
"unused-imports/no-unused-imports": OFF,
|
|
1686
962
|
"unused-imports/no-unused-vars": OFF,
|
|
1687
|
-
// Type aware rules
|
|
1688
|
-
...{
|
|
1689
|
-
"ts/await-thenable": OFF,
|
|
1690
|
-
"ts/dot-notation": OFF,
|
|
1691
|
-
"ts/no-floating-promises": OFF,
|
|
1692
|
-
"ts/no-for-in-array": OFF,
|
|
1693
|
-
"ts/no-implied-eval": OFF,
|
|
1694
|
-
"ts/no-misused-promises": OFF,
|
|
1695
|
-
"ts/no-throw-literal": OFF,
|
|
1696
|
-
"ts/no-unnecessary-type-assertion": OFF,
|
|
1697
|
-
"ts/no-unsafe-argument": OFF,
|
|
1698
|
-
"ts/no-unsafe-assignment": OFF,
|
|
1699
|
-
"ts/no-unsafe-call": OFF,
|
|
1700
|
-
"ts/no-unsafe-member-access": OFF,
|
|
1701
|
-
"ts/no-unsafe-return": OFF,
|
|
1702
|
-
"ts/restrict-plus-operands": OFF,
|
|
1703
|
-
"ts/restrict-template-expressions": OFF,
|
|
1704
|
-
"ts/unbound-method": OFF
|
|
1705
|
-
},
|
|
1706
963
|
...overrides
|
|
1707
964
|
}
|
|
1708
965
|
}
|
|
@@ -1773,7 +1030,7 @@ async function perfectionist() {
|
|
|
1773
1030
|
// src/configs/react.ts
|
|
1774
1031
|
async function react(options = {}) {
|
|
1775
1032
|
const {
|
|
1776
|
-
files = [
|
|
1033
|
+
files = [GLOB_SRC],
|
|
1777
1034
|
overrides = {}
|
|
1778
1035
|
} = options;
|
|
1779
1036
|
const [
|
|
@@ -1909,6 +1166,7 @@ async function sortPackageJson() {
|
|
|
1909
1166
|
"packageManager",
|
|
1910
1167
|
"description",
|
|
1911
1168
|
"author",
|
|
1169
|
+
"contributors",
|
|
1912
1170
|
"license",
|
|
1913
1171
|
"funding",
|
|
1914
1172
|
"homepage",
|
|
@@ -2174,12 +1432,14 @@ async function typescript(options = {}) {
|
|
|
2174
1432
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2175
1433
|
];
|
|
2176
1434
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1435
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1436
|
+
`${GLOB_MARKDOWN}/**`
|
|
1437
|
+
];
|
|
2177
1438
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
2178
1439
|
const isTypeAware = !!tsconfigPath;
|
|
2179
1440
|
const typeAwareRules = {
|
|
2180
1441
|
"dot-notation": OFF,
|
|
2181
1442
|
"no-implied-eval": OFF,
|
|
2182
|
-
"no-throw-literal": OFF,
|
|
2183
1443
|
"ts/await-thenable": ERROR,
|
|
2184
1444
|
"ts/dot-notation": [ERROR, { allowKeywords: true }],
|
|
2185
1445
|
"ts/no-floating-promises": ERROR,
|
|
@@ -2187,16 +1447,18 @@ async function typescript(options = {}) {
|
|
|
2187
1447
|
"ts/no-implied-eval": ERROR,
|
|
2188
1448
|
// Temporary turning it off due to performance
|
|
2189
1449
|
"ts/no-misused-promises": OFF,
|
|
2190
|
-
"ts/no-throw-literal": ERROR,
|
|
2191
1450
|
"ts/no-unnecessary-type-assertion": ERROR,
|
|
2192
1451
|
"ts/no-unsafe-argument": ERROR,
|
|
2193
1452
|
"ts/no-unsafe-assignment": ERROR,
|
|
2194
1453
|
"ts/no-unsafe-call": ERROR,
|
|
2195
1454
|
"ts/no-unsafe-member-access": ERROR,
|
|
2196
1455
|
"ts/no-unsafe-return": ERROR,
|
|
1456
|
+
"ts/promise-function-async": "error",
|
|
2197
1457
|
"ts/restrict-plus-operands": ERROR,
|
|
2198
1458
|
"ts/restrict-template-expressions": ERROR,
|
|
2199
|
-
"ts/
|
|
1459
|
+
"ts/return-await": [ERROR, "in-try-catch"],
|
|
1460
|
+
"ts/strict-boolean-expressions": [ERROR, { allowNullableBoolean: true, allowNullableObject: true }],
|
|
1461
|
+
"ts/switch-exhaustiveness-check": ERROR,
|
|
2200
1462
|
"ts/unbound-method": ERROR
|
|
2201
1463
|
};
|
|
2202
1464
|
const [
|
|
@@ -2216,7 +1478,10 @@ async function typescript(options = {}) {
|
|
|
2216
1478
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
2217
1479
|
sourceType: "module",
|
|
2218
1480
|
...typeAware ? {
|
|
2219
|
-
|
|
1481
|
+
projectService: {
|
|
1482
|
+
allowDefaultProject: ["./*.js"],
|
|
1483
|
+
defaultProject: tsconfigPath
|
|
1484
|
+
},
|
|
2220
1485
|
tsconfigRootDir: process.cwd()
|
|
2221
1486
|
} : {},
|
|
2222
1487
|
...parserOptions
|
|
@@ -2236,9 +1501,11 @@ async function typescript(options = {}) {
|
|
|
2236
1501
|
},
|
|
2237
1502
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
2238
1503
|
...isTypeAware ? [
|
|
2239
|
-
makeParser({ files: filesTypeAware, typeAware: true }),
|
|
1504
|
+
makeParser({ files: filesTypeAware, ignores: ignoresTypeAware, typeAware: true }),
|
|
2240
1505
|
makeParser({ files, ignores: filesTypeAware, typeAware: false })
|
|
2241
|
-
] : [
|
|
1506
|
+
] : [
|
|
1507
|
+
makeParser({ files, typeAware: false })
|
|
1508
|
+
],
|
|
2242
1509
|
{
|
|
2243
1510
|
files,
|
|
2244
1511
|
name: "vinicunca/typescript/rules",
|
|
@@ -2259,8 +1526,7 @@ async function typescript(options = {}) {
|
|
|
2259
1526
|
"no-use-before-define": OFF,
|
|
2260
1527
|
"no-useless-constructor": OFF,
|
|
2261
1528
|
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2262
|
-
"ts/ban-ts-comment": [
|
|
2263
|
-
"ts/ban-types": [ERROR, { types: { Function: false } }],
|
|
1529
|
+
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
2264
1530
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
2265
1531
|
"ts/consistent-type-imports": [ERROR, { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
2266
1532
|
"ts/explicit-function-return-type": OFF,
|
|
@@ -2272,6 +1538,7 @@ async function typescript(options = {}) {
|
|
|
2272
1538
|
"ts/no-dupe-class-members": ERROR,
|
|
2273
1539
|
"ts/no-empty-function": OFF,
|
|
2274
1540
|
"ts/no-empty-interface": OFF,
|
|
1541
|
+
"ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
2275
1542
|
"ts/no-explicit-any": OFF,
|
|
2276
1543
|
"ts/no-import-type-side-effects": ERROR,
|
|
2277
1544
|
"ts/no-invalid-this": ERROR,
|
|
@@ -2301,8 +1568,14 @@ async function typescript(options = {}) {
|
|
|
2301
1568
|
...overrides
|
|
2302
1569
|
}
|
|
2303
1570
|
},
|
|
1571
|
+
...isTypeAware ? [{
|
|
1572
|
+
files: filesTypeAware,
|
|
1573
|
+
ignores: ignoresTypeAware,
|
|
1574
|
+
name: "vinicunca/typescript/rules-type-aware",
|
|
1575
|
+
rules: typeAwareRules
|
|
1576
|
+
}] : [],
|
|
2304
1577
|
{
|
|
2305
|
-
files: ["**/*.d
|
|
1578
|
+
files: ["**/*.d.?([cm])ts"],
|
|
2306
1579
|
name: "vinicunca/typescript/disables/dts",
|
|
2307
1580
|
rules: {
|
|
2308
1581
|
"eslint-comments/no-unlimited-disable": OFF,
|
|
@@ -2397,7 +1670,7 @@ async function vue(options = {}) {
|
|
|
2397
1670
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2398
1671
|
const {
|
|
2399
1672
|
indent = 2
|
|
2400
|
-
} =
|
|
1673
|
+
} = e(stylistic2) ? {} : stylistic2;
|
|
2401
1674
|
const [
|
|
2402
1675
|
pluginVue,
|
|
2403
1676
|
parserVue,
|
|
@@ -2548,7 +1821,7 @@ async function yaml(options = {}) {
|
|
|
2548
1821
|
const {
|
|
2549
1822
|
indent = 2,
|
|
2550
1823
|
quotes = "single"
|
|
2551
|
-
} =
|
|
1824
|
+
} = e(stylistic2) ? {} : stylistic2;
|
|
2552
1825
|
const [
|
|
2553
1826
|
pluginYaml,
|
|
2554
1827
|
parserYaml
|
|
@@ -2629,7 +1902,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2629
1902
|
autoRenamePlugins = true,
|
|
2630
1903
|
componentExts = [],
|
|
2631
1904
|
gitignore: enableGitignore = true,
|
|
2632
|
-
isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE || process2.env.VIM) && !process2.env.CI),
|
|
1905
|
+
isInEditor = !!((process2.env.VSCODE_PID || process2.env.VSCODE_CWD || process2.env.JETBRAINS_IDE || process2.env.VIM || process2.env.NVIM) && !process2.env.CI),
|
|
1906
|
+
jsx: enableJsx = true,
|
|
2633
1907
|
react: enableReact = false,
|
|
2634
1908
|
regexp: enableRegexp = true,
|
|
2635
1909
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
@@ -2639,19 +1913,22 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2639
1913
|
let stylisticOptions = {};
|
|
2640
1914
|
if (options.stylistic === false) {
|
|
2641
1915
|
stylisticOptions = false;
|
|
2642
|
-
} else if (
|
|
1916
|
+
} else if (r(options.stylistic)) {
|
|
2643
1917
|
stylisticOptions = {
|
|
2644
1918
|
...options.stylistic,
|
|
2645
1919
|
jsx: options.jsx ?? true
|
|
2646
1920
|
};
|
|
2647
1921
|
}
|
|
1922
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
1923
|
+
stylisticOptions.jsx = enableJsx;
|
|
1924
|
+
}
|
|
2648
1925
|
const configs2 = [];
|
|
2649
1926
|
if (enableGitignore) {
|
|
2650
1927
|
if (typeof enableGitignore !== "boolean") {
|
|
2651
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((
|
|
1928
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2(enableGitignore)]));
|
|
2652
1929
|
} else {
|
|
2653
1930
|
if (fs.existsSync(".gitignore")) {
|
|
2654
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((
|
|
1931
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r2) => [r2()]));
|
|
2655
1932
|
}
|
|
2656
1933
|
}
|
|
2657
1934
|
}
|
|
@@ -2676,6 +1953,9 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2676
1953
|
if (enableVue) {
|
|
2677
1954
|
componentExts.push("vue");
|
|
2678
1955
|
}
|
|
1956
|
+
if (enableJsx) {
|
|
1957
|
+
configs2.push(jsx());
|
|
1958
|
+
}
|
|
2679
1959
|
if (enableTypeScript) {
|
|
2680
1960
|
configs2.push(typescript({
|
|
2681
1961
|
...typescriptOptions,
|
|
@@ -2778,7 +2058,7 @@ function getOverrides(options, key) {
|
|
|
2778
2058
|
};
|
|
2779
2059
|
}
|
|
2780
2060
|
function resolveSubOptions(options, key) {
|
|
2781
|
-
return
|
|
2061
|
+
return e(options[key]) ? {} : options[key] || {};
|
|
2782
2062
|
}
|
|
2783
2063
|
export {
|
|
2784
2064
|
GLOB_ALL_SRC,
|
|
@@ -2815,6 +2095,7 @@ export {
|
|
|
2815
2095
|
javascript,
|
|
2816
2096
|
jsdoc,
|
|
2817
2097
|
jsonc,
|
|
2098
|
+
jsx,
|
|
2818
2099
|
markdown,
|
|
2819
2100
|
node,
|
|
2820
2101
|
parserPlain,
|