@vinicunca/eslint-config 2.2.0 → 2.4.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 +1345 -581
- package/dist/index.d.cts +10958 -23
- package/dist/index.d.ts +10958 -23
- package/dist/index.js +1344 -582
- package/package.json +16 -17
package/dist/index.js
CHANGED
|
@@ -1,126 +1,1206 @@
|
|
|
1
|
-
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3
|
|
1
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.5.3/node_modules/@vinicunca/perkakas/dist/index.mjs
|
|
2
|
+
function purry(fn, args, lazyFactory) {
|
|
3
|
+
const callArgs = Array.from(args);
|
|
4
|
+
const diff = fn.length - args.length;
|
|
5
|
+
if (diff === 0) {
|
|
6
|
+
return fn(...callArgs);
|
|
7
|
+
}
|
|
8
|
+
if (diff === 1) {
|
|
9
|
+
const ret = (data) => fn(data, ...callArgs);
|
|
10
|
+
const lazy = lazyFactory ?? fn.lazy;
|
|
11
|
+
return lazy === void 0 ? ret : Object.assign(ret, { lazy, lazyArgs: args });
|
|
12
|
+
}
|
|
13
|
+
throw new Error("Wrong number of arguments");
|
|
14
|
+
}
|
|
15
|
+
function purryOn(isArg, implementation, args) {
|
|
16
|
+
const callArgs = Array.from(args);
|
|
17
|
+
return isArg(args[0]) ? (data) => implementation(data, ...callArgs) : implementation(...callArgs);
|
|
18
|
+
}
|
|
19
|
+
function conditional(...args) {
|
|
20
|
+
return purryOn(isCase, conditionalImplementation, args);
|
|
21
|
+
}
|
|
22
|
+
function conditionalImplementation(data, ...cases) {
|
|
23
|
+
for (const [when, then] of cases) {
|
|
24
|
+
if (when(data)) {
|
|
25
|
+
return then(data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw new Error("conditional: data failed for all cases");
|
|
29
|
+
}
|
|
30
|
+
function isCase(maybeCase) {
|
|
31
|
+
if (!Array.isArray(maybeCase)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const [when, then, ...rest] = maybeCase;
|
|
35
|
+
return typeof when === "function" && when.length <= 1 && typeof then === "function" && then.length <= 1 && rest.length === 0;
|
|
36
|
+
}
|
|
37
|
+
var trivialDefaultCase = () => void 0;
|
|
38
|
+
((conditional2) => {
|
|
39
|
+
function defaultCase(then = trivialDefaultCase) {
|
|
40
|
+
return [() => true, then];
|
|
41
|
+
}
|
|
42
|
+
conditional2.defaultCase = defaultCase;
|
|
43
|
+
})(conditional || (conditional = {}));
|
|
44
|
+
function _reduceLazy(array, lazy, isIndexed = false) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (let index = 0; index < array.length; index++) {
|
|
47
|
+
const item = array[index];
|
|
48
|
+
const result = isIndexed ? lazy(item, index, array) : lazy(item);
|
|
49
|
+
if (result.hasMany === true) {
|
|
50
|
+
out.push(...result.next);
|
|
51
|
+
} else if (result.hasNext) {
|
|
52
|
+
out.push(result.next);
|
|
53
|
+
}
|
|
54
|
+
if (result.done) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
function differenceWith(...args) {
|
|
61
|
+
return purry(differenceWith_, args, differenceWith.lazy);
|
|
62
|
+
}
|
|
63
|
+
function differenceWith_(array, other, isEquals) {
|
|
64
|
+
const lazy = differenceWith.lazy(other, isEquals);
|
|
65
|
+
return _reduceLazy(array, lazy);
|
|
66
|
+
}
|
|
67
|
+
((differenceWith2) => {
|
|
68
|
+
function lazy(other, isEquals) {
|
|
69
|
+
return (value) => other.every((otherValue) => !isEquals(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
70
|
+
}
|
|
71
|
+
differenceWith2.lazy = lazy;
|
|
72
|
+
})(differenceWith || (differenceWith = {}));
|
|
73
|
+
var COMPARATORS = {
|
|
74
|
+
asc: (x, y) => x > y,
|
|
75
|
+
desc: (x, y) => x < y
|
|
76
|
+
};
|
|
77
|
+
function purryOrderRules(func, inputArgs) {
|
|
78
|
+
const [dataOrRule, ...rules] = Array.isArray(inputArgs) ? inputArgs : Array.from(inputArgs);
|
|
79
|
+
if (!isOrderRule(dataOrRule)) {
|
|
80
|
+
const compareFn2 = orderRuleComparer(...rules);
|
|
81
|
+
return func(dataOrRule, compareFn2);
|
|
82
|
+
}
|
|
83
|
+
const compareFn = orderRuleComparer(dataOrRule, ...rules);
|
|
84
|
+
return (data) => func(data, compareFn);
|
|
85
|
+
}
|
|
86
|
+
function orderRuleComparer(primaryRule, secondaryRule, ...otherRules) {
|
|
87
|
+
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
88
|
+
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
89
|
+
const { [direction]: comparator } = COMPARATORS;
|
|
90
|
+
const nextComparer = secondaryRule === void 0 ? void 0 : orderRuleComparer(secondaryRule, ...otherRules);
|
|
91
|
+
return (a, b) => {
|
|
92
|
+
const projectedA = projector(a);
|
|
93
|
+
const projectedB = projector(b);
|
|
94
|
+
if (comparator(projectedA, projectedB)) {
|
|
95
|
+
return 1;
|
|
96
|
+
}
|
|
97
|
+
if (comparator(projectedB, projectedA)) {
|
|
98
|
+
return -1;
|
|
99
|
+
}
|
|
100
|
+
return (nextComparer == null ? void 0 : nextComparer(a, b)) ?? 0;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function isOrderRule(x) {
|
|
104
|
+
if (isProjection(x)) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
if (typeof x !== "object" || !Array.isArray(x)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
111
|
+
return isProjection(maybeProjection) && maybeDirection in COMPARATORS && rest.length === 0;
|
|
112
|
+
}
|
|
113
|
+
function isProjection(x) {
|
|
114
|
+
return typeof x === "function" && x.length === 1;
|
|
115
|
+
}
|
|
116
|
+
function drop(...args) {
|
|
117
|
+
return purry(drop_, args, drop.lazy);
|
|
118
|
+
}
|
|
119
|
+
function drop_(array, n) {
|
|
120
|
+
return _reduceLazy(array, drop.lazy(n));
|
|
121
|
+
}
|
|
122
|
+
((drop2) => {
|
|
123
|
+
function lazy(n) {
|
|
124
|
+
let left = n;
|
|
125
|
+
return (value) => {
|
|
126
|
+
if (left > 0) {
|
|
127
|
+
left -= 1;
|
|
128
|
+
return { done: false, hasNext: false };
|
|
129
|
+
}
|
|
130
|
+
return { done: false, hasNext: true, next: value };
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
drop2.lazy = lazy;
|
|
134
|
+
})(drop || (drop = {}));
|
|
135
|
+
function entries(...args) {
|
|
136
|
+
return purry(Object.entries, args);
|
|
137
|
+
}
|
|
138
|
+
((entries2) => {
|
|
139
|
+
entries2.strict = entries2;
|
|
140
|
+
})(entries || (entries = {}));
|
|
141
|
+
function _toLazyIndexed(fn) {
|
|
142
|
+
return Object.assign(fn, { indexed: true });
|
|
143
|
+
}
|
|
144
|
+
function filter(...args) {
|
|
145
|
+
return purry(filter_(false), args, filter.lazy);
|
|
146
|
+
}
|
|
147
|
+
function filter_(indexed) {
|
|
148
|
+
return (array, fn) => {
|
|
149
|
+
return _reduceLazy(
|
|
150
|
+
array,
|
|
151
|
+
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
152
|
+
indexed
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function lazy_$5(indexed) {
|
|
157
|
+
return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
158
|
+
}
|
|
159
|
+
((filter2) => {
|
|
160
|
+
function indexed(...args) {
|
|
161
|
+
return purry(filter_(true), args, filter2.lazyIndexed);
|
|
162
|
+
}
|
|
163
|
+
filter2.indexed = indexed;
|
|
164
|
+
filter2.lazy = lazy_$5(false);
|
|
165
|
+
filter2.lazyIndexed = _toLazyIndexed(lazy_$5(true));
|
|
166
|
+
})(filter || (filter = {}));
|
|
167
|
+
function _toSingle(fn) {
|
|
168
|
+
return Object.assign(fn, { single: true });
|
|
169
|
+
}
|
|
170
|
+
function findIndex(...args) {
|
|
171
|
+
return purry(findIndex_(false), args, findIndex.lazy);
|
|
172
|
+
}
|
|
173
|
+
function findIndex_(indexed) {
|
|
174
|
+
return (array, fn) => array.findIndex((item, index, input) => indexed ? fn(item, index, input) : fn(item));
|
|
175
|
+
}
|
|
176
|
+
function lazy_$4(indexed) {
|
|
177
|
+
return (fn) => {
|
|
178
|
+
let actualIndex = 0;
|
|
179
|
+
return (value, index, array) => {
|
|
180
|
+
if (indexed ? fn(value, index, array) : fn(value)) {
|
|
181
|
+
return { done: true, hasNext: true, next: actualIndex };
|
|
182
|
+
}
|
|
183
|
+
actualIndex += 1;
|
|
184
|
+
return { done: false, hasNext: false };
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
((findIndex2) => {
|
|
189
|
+
function indexed(...args) {
|
|
190
|
+
return purry(findIndex_(true), args, findIndex2.lazyIndexed);
|
|
191
|
+
}
|
|
192
|
+
findIndex2.indexed = indexed;
|
|
193
|
+
findIndex2.lazy = _toSingle(lazy_$4(false));
|
|
194
|
+
findIndex2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$4(true)));
|
|
195
|
+
})(findIndex || (findIndex = {}));
|
|
196
|
+
function findLastIndex(...args) {
|
|
197
|
+
return purry(findLastIndex_(false), args);
|
|
198
|
+
}
|
|
199
|
+
function findLastIndex_(indexed) {
|
|
200
|
+
return (array, fn) => {
|
|
201
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
202
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
203
|
+
return i;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return -1;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
((findLastIndex2) => {
|
|
210
|
+
function indexed(...args) {
|
|
211
|
+
return purry(findLastIndex_(true), args);
|
|
212
|
+
}
|
|
213
|
+
findLastIndex2.indexed = indexed;
|
|
214
|
+
})(findLastIndex || (findLastIndex = {}));
|
|
215
|
+
function findLast(...args) {
|
|
216
|
+
return purry(findLast_(false), args);
|
|
217
|
+
}
|
|
218
|
+
function findLast_(indexed) {
|
|
219
|
+
return (array, fn) => {
|
|
220
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
221
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
222
|
+
return array[i];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return void 0;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
((findLast2) => {
|
|
229
|
+
function indexed(...args) {
|
|
230
|
+
return purry(findLast_(true), args);
|
|
231
|
+
}
|
|
232
|
+
findLast2.indexed = indexed;
|
|
233
|
+
})(findLast || (findLast = {}));
|
|
234
|
+
function find(...args) {
|
|
235
|
+
return purry(find_(false), args, find.lazy);
|
|
236
|
+
}
|
|
237
|
+
function find_(indexed) {
|
|
238
|
+
return (array, fn) => array.find((item, index, input) => indexed ? fn(item, index, input) : fn(item));
|
|
239
|
+
}
|
|
240
|
+
function lazy_$3(indexed) {
|
|
241
|
+
return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: true, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
242
|
+
}
|
|
243
|
+
((find2) => {
|
|
244
|
+
function indexed(...args) {
|
|
245
|
+
return purry(find_(true), args, find2.lazyIndexed);
|
|
246
|
+
}
|
|
247
|
+
find2.indexed = indexed;
|
|
248
|
+
find2.lazy = _toSingle(lazy_$3(false));
|
|
249
|
+
find2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$3(true)));
|
|
250
|
+
})(find || (find = {}));
|
|
251
|
+
function first(...args) {
|
|
252
|
+
return purry(first_, args, first.lazy);
|
|
253
|
+
}
|
|
254
|
+
function first_([item]) {
|
|
255
|
+
return item;
|
|
256
|
+
}
|
|
257
|
+
((first2) => {
|
|
258
|
+
function lazy() {
|
|
259
|
+
return (value) => ({ done: true, hasNext: true, next: value });
|
|
260
|
+
}
|
|
261
|
+
first2.lazy = lazy;
|
|
262
|
+
((lazy2) => {
|
|
263
|
+
lazy2.single = true;
|
|
264
|
+
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
265
|
+
})(first || (first = {}));
|
|
266
|
+
function flatten(...args) {
|
|
267
|
+
return purry(flatten_, args, flatten.lazy);
|
|
268
|
+
}
|
|
269
|
+
function flatten_(items) {
|
|
270
|
+
return _reduceLazy(items, flatten.lazy());
|
|
271
|
+
}
|
|
272
|
+
((flatten2) => {
|
|
273
|
+
function lazy() {
|
|
274
|
+
return (item) => (
|
|
275
|
+
// @ts-expect-error [ts2322] - We need to make LazyMany better so it accommodate the typing here...
|
|
276
|
+
Array.isArray(item) ? { done: false, hasMany: true, hasNext: true, next: item } : { done: false, hasNext: true, next: item }
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
flatten2.lazy = lazy;
|
|
280
|
+
})(flatten || (flatten = {}));
|
|
281
|
+
function flatMap(...args) {
|
|
282
|
+
return purry(flatMap_, args, flatMap.lazy);
|
|
283
|
+
}
|
|
284
|
+
function flatMap_(array, fn) {
|
|
285
|
+
return flatten(array.map((item) => fn(item)));
|
|
286
|
+
}
|
|
287
|
+
((flatMap2) => {
|
|
288
|
+
function lazy(fn) {
|
|
289
|
+
return (value) => {
|
|
290
|
+
const next = fn(value);
|
|
291
|
+
return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
flatMap2.lazy = lazy;
|
|
295
|
+
})(flatMap || (flatMap = {}));
|
|
296
|
+
function flattenDeep(...args) {
|
|
297
|
+
return purry(flattenDeep_, args, flattenDeep.lazy);
|
|
298
|
+
}
|
|
299
|
+
function flattenDeep_(items) {
|
|
300
|
+
return _reduceLazy(items, flattenDeep.lazy());
|
|
301
|
+
}
|
|
302
|
+
function flattenDeepValue_(value) {
|
|
303
|
+
if (!Array.isArray(value)) {
|
|
304
|
+
return value;
|
|
305
|
+
}
|
|
306
|
+
const ret = [];
|
|
307
|
+
for (const item of value) {
|
|
308
|
+
if (Array.isArray(item)) {
|
|
309
|
+
ret.push(...flattenDeep(item));
|
|
310
|
+
} else {
|
|
311
|
+
ret.push(item);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return ret;
|
|
315
|
+
}
|
|
316
|
+
((flattenDeep2) => {
|
|
317
|
+
function lazy() {
|
|
318
|
+
return (value) => {
|
|
319
|
+
const next = flattenDeepValue_(value);
|
|
320
|
+
return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
flattenDeep2.lazy = lazy;
|
|
324
|
+
})(flattenDeep || (flattenDeep = {}));
|
|
325
|
+
function forEachObj(...args) {
|
|
326
|
+
return purry(forEachObj_(false), args);
|
|
327
|
+
}
|
|
328
|
+
function forEachObj_(indexed) {
|
|
329
|
+
return (data, fn) => {
|
|
330
|
+
for (const key in data) {
|
|
331
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
332
|
+
const { [key]: val } = data;
|
|
333
|
+
if (indexed) {
|
|
334
|
+
fn(val, key, data);
|
|
335
|
+
} else {
|
|
336
|
+
fn(val);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return data;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
((forEachObj2) => {
|
|
344
|
+
function indexed(...args) {
|
|
345
|
+
return purry(forEachObj_(true), args);
|
|
346
|
+
}
|
|
347
|
+
forEachObj2.indexed = indexed;
|
|
348
|
+
})(forEachObj || (forEachObj = {}));
|
|
349
|
+
function forEach(...args) {
|
|
350
|
+
return purry(forEach_(false), args, forEach.lazy);
|
|
351
|
+
}
|
|
352
|
+
function forEach_(indexed) {
|
|
353
|
+
return (array, fn) => _reduceLazy(
|
|
354
|
+
array,
|
|
355
|
+
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
356
|
+
indexed
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
function lazy_$2(indexed) {
|
|
360
|
+
return (fn) => (value, index, array) => {
|
|
361
|
+
if (indexed) {
|
|
362
|
+
fn(value, index, array);
|
|
363
|
+
} else {
|
|
364
|
+
fn(value);
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
done: false,
|
|
368
|
+
hasNext: true,
|
|
369
|
+
next: value
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
((forEach2) => {
|
|
374
|
+
function indexed(...args) {
|
|
375
|
+
return purry(forEach_(true), args, forEach2.lazyIndexed);
|
|
376
|
+
}
|
|
377
|
+
forEach2.indexed = indexed;
|
|
378
|
+
forEach2.lazy = lazy_$2(false);
|
|
379
|
+
forEach2.lazyIndexed = _toLazyIndexed(lazy_$2(true));
|
|
380
|
+
})(forEach || (forEach = {}));
|
|
381
|
+
function fromEntries(...args) {
|
|
382
|
+
return purry(fromEntriesImplementation, args);
|
|
383
|
+
}
|
|
384
|
+
function fromEntriesImplementation(entries2) {
|
|
385
|
+
const out = {};
|
|
386
|
+
for (const [key, value] of entries2) {
|
|
387
|
+
out[key] = value;
|
|
388
|
+
}
|
|
389
|
+
return out;
|
|
390
|
+
}
|
|
391
|
+
((fromEntries2) => {
|
|
392
|
+
fromEntries2.strict = fromEntries2;
|
|
393
|
+
})(fromEntries || (fromEntries = {}));
|
|
394
|
+
function groupBy(...args) {
|
|
395
|
+
return purry(groupBy_(false), args);
|
|
396
|
+
}
|
|
397
|
+
function groupBy_(indexed) {
|
|
398
|
+
return (array, fn) => {
|
|
399
|
+
const ret = {};
|
|
400
|
+
for (const [index, item] of array.entries()) {
|
|
401
|
+
const key = indexed ? fn(item, index, array) : fn(item);
|
|
402
|
+
if (key !== void 0) {
|
|
403
|
+
const actualKey = String(key);
|
|
404
|
+
let items = ret[actualKey];
|
|
405
|
+
if (items === void 0) {
|
|
406
|
+
items = [];
|
|
407
|
+
ret[actualKey] = items;
|
|
408
|
+
}
|
|
409
|
+
items.push(item);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return ret;
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
((groupBy2) => {
|
|
416
|
+
function indexed(...args) {
|
|
417
|
+
return purry(groupBy_(true), args);
|
|
418
|
+
}
|
|
419
|
+
groupBy2.indexed = indexed;
|
|
420
|
+
groupBy2.strict = groupBy2;
|
|
421
|
+
})(groupBy || (groupBy = {}));
|
|
422
|
+
function indexBy(...args) {
|
|
423
|
+
return purry(indexBy_(false), args);
|
|
424
|
+
}
|
|
425
|
+
function indexBy_(indexed) {
|
|
426
|
+
return (array, fn) => {
|
|
427
|
+
const out = {};
|
|
428
|
+
for (const [index, item] of array.entries()) {
|
|
429
|
+
const value = indexed ? fn(item, index, array) : fn(item);
|
|
430
|
+
const key = String(value);
|
|
431
|
+
out[key] = item;
|
|
432
|
+
}
|
|
433
|
+
return out;
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function indexByStrict(...args) {
|
|
437
|
+
return purry(indexByStrict_, args);
|
|
438
|
+
}
|
|
439
|
+
function indexByStrict_(array, fn) {
|
|
440
|
+
const out = {};
|
|
441
|
+
for (const item of array) {
|
|
442
|
+
const key = fn(item);
|
|
443
|
+
out[key] = item;
|
|
444
|
+
}
|
|
445
|
+
return out;
|
|
446
|
+
}
|
|
447
|
+
((indexBy2) => {
|
|
448
|
+
function indexed(...args) {
|
|
449
|
+
return purry(indexBy_(true), args);
|
|
450
|
+
}
|
|
451
|
+
indexBy2.indexed = indexed;
|
|
452
|
+
indexBy2.strict = indexByStrict;
|
|
453
|
+
})(indexBy || (indexBy = {}));
|
|
454
|
+
function intersectionWith(...args) {
|
|
455
|
+
return purry(intersectionWith_, args, intersectionWith.lazy);
|
|
456
|
+
}
|
|
457
|
+
function intersectionWith_(array, other, comparator) {
|
|
458
|
+
const lazy = intersectionWith.lazy(other, comparator);
|
|
459
|
+
return _reduceLazy(array, lazy);
|
|
460
|
+
}
|
|
461
|
+
((intersectionWith2) => {
|
|
462
|
+
function lazy(other, comparator) {
|
|
463
|
+
return (value) => other.some((otherValue) => comparator(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
464
|
+
}
|
|
465
|
+
intersectionWith2.lazy = lazy;
|
|
466
|
+
})(intersectionWith || (intersectionWith = {}));
|
|
2
467
|
function isBoolean(data) {
|
|
3
468
|
return typeof data === "boolean";
|
|
4
469
|
}
|
|
5
|
-
|
|
6
|
-
|
|
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 = {}));
|
|
7
479
|
function isObject(data) {
|
|
8
480
|
if (typeof data !== "object" || data === null) {
|
|
9
481
|
return false;
|
|
10
482
|
}
|
|
11
|
-
const proto = Object.getPrototypeOf(data);
|
|
12
|
-
return proto === null || proto === Object.prototype;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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;
|
|
754
|
+
}
|
|
755
|
+
((zip2) => {
|
|
756
|
+
zip2.strict = zip2;
|
|
757
|
+
})(zip || (zip = {}));
|
|
758
|
+
|
|
759
|
+
// src/base.ts
|
|
760
|
+
import { FlatConfigPipeline } from "eslint-flat-config-utils";
|
|
761
|
+
import { isPackageExists } from "local-pkg";
|
|
762
|
+
import fs from "node:fs";
|
|
763
|
+
import process2 from "node:process";
|
|
764
|
+
|
|
765
|
+
// src/flags.ts
|
|
766
|
+
var ERROR = "error";
|
|
767
|
+
var OFF = "off";
|
|
768
|
+
var WARN = "warn";
|
|
769
|
+
var CONSISTENT = "consistent";
|
|
770
|
+
var NEVER = "never";
|
|
771
|
+
var ALWAYS = "always";
|
|
772
|
+
|
|
773
|
+
// src/plugins.ts
|
|
774
|
+
import { default as default2 } from "@vinicunca/eslint-plugin-vinicunca";
|
|
775
|
+
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
776
|
+
import * as pluginImport from "eslint-plugin-import-x";
|
|
777
|
+
import { default as default4 } from "eslint-plugin-n";
|
|
778
|
+
import { default as default5 } from "eslint-plugin-perfectionist";
|
|
779
|
+
import { default as default6 } from "eslint-plugin-unicorn";
|
|
780
|
+
import { default as default7 } from "eslint-plugin-unused-imports";
|
|
781
|
+
|
|
782
|
+
// src/configs/comments.ts
|
|
783
|
+
async function comments() {
|
|
784
|
+
return [
|
|
785
|
+
{
|
|
786
|
+
name: "vinicunca:eslint-comments",
|
|
787
|
+
plugins: {
|
|
788
|
+
"eslint-comments": default3
|
|
789
|
+
},
|
|
790
|
+
rules: {
|
|
791
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
792
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
793
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
794
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
];
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// src/globs.ts
|
|
801
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
802
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
803
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
804
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
805
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
806
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
807
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
808
|
+
var GLOB_CSS = "**/*.css";
|
|
809
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
810
|
+
var GLOB_LESS = "**/*.less";
|
|
811
|
+
var GLOB_SCSS = "**/*.scss";
|
|
812
|
+
var GLOB_JSON = "**/*.json";
|
|
813
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
814
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
815
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
816
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
817
|
+
var GLOB_VUE = "**/*.vue";
|
|
818
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
819
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
820
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
821
|
+
var GLOB_TESTS = [
|
|
822
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
823
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
824
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
825
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
826
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
827
|
+
];
|
|
828
|
+
var GLOB_ALL_SRC = [
|
|
829
|
+
GLOB_SRC,
|
|
830
|
+
GLOB_STYLE,
|
|
831
|
+
GLOB_JSON,
|
|
832
|
+
GLOB_JSON5,
|
|
833
|
+
GLOB_MARKDOWN,
|
|
834
|
+
GLOB_VUE,
|
|
835
|
+
GLOB_YAML,
|
|
836
|
+
GLOB_HTML
|
|
837
|
+
];
|
|
838
|
+
var GLOB_EXCLUDE = [
|
|
839
|
+
"**/node_modules",
|
|
840
|
+
"**/dist",
|
|
841
|
+
"**/package-lock.json",
|
|
842
|
+
"**/yarn.lock",
|
|
843
|
+
"**/pnpm-lock.yaml",
|
|
844
|
+
"**/bun.lockb",
|
|
845
|
+
"**/output",
|
|
846
|
+
"**/coverage",
|
|
847
|
+
"**/temp",
|
|
848
|
+
"**/.temp",
|
|
849
|
+
"**/tmp",
|
|
850
|
+
"**/.tmp",
|
|
851
|
+
"**/.history",
|
|
852
|
+
"**/.vitepress/cache",
|
|
853
|
+
"**/.nuxt",
|
|
854
|
+
"**/.next",
|
|
855
|
+
"**/.vercel",
|
|
856
|
+
"**/.changeset",
|
|
857
|
+
"**/.idea",
|
|
858
|
+
"**/.cache",
|
|
859
|
+
"**/.output",
|
|
860
|
+
"**/.vite-inspect",
|
|
861
|
+
"**/CHANGELOG*.md",
|
|
862
|
+
"**/*.min.*",
|
|
863
|
+
"**/LICENSE*",
|
|
864
|
+
"**/__snapshots__",
|
|
865
|
+
"**/auto-import?(s).d.ts",
|
|
866
|
+
"**/components.d.ts"
|
|
867
|
+
];
|
|
868
|
+
|
|
869
|
+
// src/utils.ts
|
|
870
|
+
async function combineConfigs(...configs) {
|
|
871
|
+
const resolved = await Promise.all(configs);
|
|
872
|
+
return resolved.flat();
|
|
873
|
+
}
|
|
874
|
+
function renameRules(rules, map2) {
|
|
875
|
+
return Object.fromEntries(
|
|
876
|
+
Object.entries(rules).map(([key, value]) => {
|
|
877
|
+
for (const [from, to] of Object.entries(map2)) {
|
|
878
|
+
if (key.startsWith(`${from}/`)) {
|
|
879
|
+
return [to + key.slice(from.length), value];
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return [key, value];
|
|
883
|
+
})
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
function renamePluginInConfigs(configs, map2) {
|
|
887
|
+
return configs.map((i) => {
|
|
888
|
+
const clone = { ...i };
|
|
889
|
+
if (clone.rules) {
|
|
890
|
+
clone.rules = renameRules(clone.rules, map2);
|
|
891
|
+
}
|
|
892
|
+
if (clone.plugins) {
|
|
893
|
+
clone.plugins = Object.fromEntries(
|
|
894
|
+
Object.entries(clone.plugins).map(([key, value]) => {
|
|
895
|
+
if (key in map2) {
|
|
896
|
+
return [map2[key], value];
|
|
897
|
+
}
|
|
898
|
+
return [key, value];
|
|
899
|
+
})
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
return clone;
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
async function interopDefault(m) {
|
|
906
|
+
const resolved = await m;
|
|
907
|
+
return resolved.default || resolved;
|
|
908
|
+
}
|
|
909
|
+
var parserPlain = {
|
|
910
|
+
meta: {
|
|
911
|
+
name: "parser-plain"
|
|
912
|
+
},
|
|
913
|
+
parseForESLint: (code) => ({
|
|
914
|
+
ast: {
|
|
915
|
+
body: [],
|
|
916
|
+
comments: [],
|
|
917
|
+
loc: { end: code.length, start: 0 },
|
|
918
|
+
range: [0, code.length],
|
|
919
|
+
tokens: [],
|
|
920
|
+
type: "Program"
|
|
921
|
+
},
|
|
922
|
+
scopeManager: null,
|
|
923
|
+
services: { isPlain: true },
|
|
924
|
+
visitorKeys: {
|
|
925
|
+
Program: []
|
|
926
|
+
}
|
|
927
|
+
})
|
|
928
|
+
};
|
|
929
|
+
function toArray(value) {
|
|
930
|
+
return Array.isArray(value) ? value : [value];
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// src/configs/stylistic.ts
|
|
934
|
+
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
935
|
+
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
936
|
+
indent: 2,
|
|
937
|
+
jsx: true,
|
|
938
|
+
quotes: "single",
|
|
939
|
+
semi: true
|
|
940
|
+
};
|
|
941
|
+
async function stylistic(options = {}) {
|
|
942
|
+
const {
|
|
943
|
+
indent,
|
|
944
|
+
jsx,
|
|
945
|
+
overrides = {},
|
|
946
|
+
quotes,
|
|
947
|
+
semi
|
|
948
|
+
} = {
|
|
949
|
+
...STYLISTIC_CONFIG_DEFAULTS,
|
|
950
|
+
...options
|
|
951
|
+
};
|
|
952
|
+
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
953
|
+
const config = pluginStylistic.configs.customize({
|
|
954
|
+
flat: true,
|
|
955
|
+
indent,
|
|
956
|
+
jsx,
|
|
957
|
+
pluginName: "style",
|
|
958
|
+
quotes,
|
|
959
|
+
semi
|
|
960
|
+
});
|
|
961
|
+
return [
|
|
962
|
+
{
|
|
963
|
+
name: "vinicunca:stylistic",
|
|
964
|
+
plugins: {
|
|
965
|
+
style: pluginStylistic,
|
|
966
|
+
vinicunca: default2
|
|
967
|
+
},
|
|
968
|
+
rules: {
|
|
969
|
+
...config.rules,
|
|
970
|
+
"curly": [ERROR, "all"],
|
|
971
|
+
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
972
|
+
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
973
|
+
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
974
|
+
"style/arrow-parens": [ERROR, ALWAYS],
|
|
975
|
+
"style/brace-style": [ERROR],
|
|
976
|
+
"style/func-call-spacing": [ERROR, NEVER],
|
|
977
|
+
"style/jsx-child-element-spacing": OFF,
|
|
978
|
+
"style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
|
|
979
|
+
"style/jsx-closing-tag-location": ERROR,
|
|
980
|
+
"style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
|
|
981
|
+
"style/jsx-curly-newline": [ERROR, {
|
|
982
|
+
multiline: "consistent",
|
|
983
|
+
singleline: "consistent"
|
|
984
|
+
}],
|
|
985
|
+
"style/jsx-curly-spacing": [ERROR, {
|
|
986
|
+
children: true,
|
|
987
|
+
spacing: {
|
|
988
|
+
objectLiterals: NEVER
|
|
989
|
+
},
|
|
990
|
+
when: "always"
|
|
991
|
+
}],
|
|
992
|
+
"style/jsx-equals-spacing": [ERROR, NEVER],
|
|
993
|
+
"style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
|
|
994
|
+
"style/jsx-indent": [ERROR, 2],
|
|
995
|
+
"style/jsx-indent-props": [ERROR, 2],
|
|
996
|
+
"style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
|
|
997
|
+
"style/jsx-newline": ERROR,
|
|
998
|
+
"style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
|
|
999
|
+
"style/jsx-props-no-multi-spaces": ERROR,
|
|
1000
|
+
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
|
|
1001
|
+
"style/jsx-sort-props": [OFF],
|
|
1002
|
+
"style/jsx-tag-spacing": [ERROR, {
|
|
1003
|
+
afterOpening: NEVER,
|
|
1004
|
+
beforeClosing: NEVER,
|
|
1005
|
+
beforeSelfClosing: "always",
|
|
1006
|
+
closingSlash: NEVER
|
|
1007
|
+
}],
|
|
1008
|
+
"style/jsx-wrap-multilines": [ERROR, {
|
|
1009
|
+
arrow: STR_PARENS_NEW_LINE,
|
|
1010
|
+
assignment: STR_PARENS_NEW_LINE,
|
|
1011
|
+
condition: STR_PARENS_NEW_LINE,
|
|
1012
|
+
declaration: STR_PARENS_NEW_LINE,
|
|
1013
|
+
logical: STR_PARENS_NEW_LINE,
|
|
1014
|
+
prop: STR_PARENS_NEW_LINE,
|
|
1015
|
+
return: STR_PARENS_NEW_LINE
|
|
1016
|
+
}],
|
|
1017
|
+
"style/member-delimiter-style": [ERROR],
|
|
1018
|
+
"style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
1019
|
+
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
1020
|
+
"style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
1021
|
+
"style/operator-linebreak": [ERROR, "before"],
|
|
1022
|
+
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
1023
|
+
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
1024
|
+
"style/quotes": [ERROR, quotes],
|
|
1025
|
+
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
1026
|
+
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
1027
|
+
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
1028
|
+
"vinicunca/consistent-list-newline": ERROR,
|
|
1029
|
+
"vinicunca/if-newline": ERROR,
|
|
1030
|
+
"vinicunca/top-level-function": ERROR,
|
|
1031
|
+
...overrides
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
1036
|
+
rules: {
|
|
1037
|
+
"vinicunca/consistent-list-newline": OFF
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
];
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// src/configs/formatters.ts
|
|
1044
|
+
async function formatters(options = {}, stylistic2 = {}) {
|
|
1045
|
+
if (options === true) {
|
|
1046
|
+
options = {
|
|
1047
|
+
css: true,
|
|
1048
|
+
graphql: true,
|
|
1049
|
+
html: true,
|
|
1050
|
+
markdown: true
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
const {
|
|
1054
|
+
indent,
|
|
1055
|
+
quotes,
|
|
1056
|
+
semi
|
|
1057
|
+
} = {
|
|
1058
|
+
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1059
|
+
...stylistic2
|
|
1060
|
+
};
|
|
1061
|
+
const prettierOptions = Object.assign(
|
|
1062
|
+
{
|
|
1063
|
+
endOfLine: "auto",
|
|
1064
|
+
semi,
|
|
1065
|
+
singleQuote: quotes === "single",
|
|
1066
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
1067
|
+
trailingComma: "all",
|
|
1068
|
+
useTabs: indent === "tab"
|
|
1069
|
+
},
|
|
1070
|
+
options.prettierOptions || {}
|
|
1071
|
+
);
|
|
1072
|
+
const dprintOptions = Object.assign(
|
|
1073
|
+
{
|
|
1074
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
1075
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
1076
|
+
useTabs: indent === "tab"
|
|
1077
|
+
},
|
|
1078
|
+
options.dprintOptions || {}
|
|
1079
|
+
);
|
|
1080
|
+
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
1081
|
+
const configs = [
|
|
1082
|
+
{
|
|
1083
|
+
name: "vinicunca:formatters:setup",
|
|
1084
|
+
plugins: {
|
|
1085
|
+
format: pluginFormat
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
];
|
|
1089
|
+
if (options.css) {
|
|
1090
|
+
configs.push(
|
|
1091
|
+
{
|
|
1092
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1093
|
+
languageOptions: {
|
|
1094
|
+
parser: parserPlain
|
|
1095
|
+
},
|
|
1096
|
+
name: "vinicunca:formatters:css",
|
|
1097
|
+
rules: {
|
|
1098
|
+
"format/prettier": [
|
|
1099
|
+
"error",
|
|
1100
|
+
{
|
|
1101
|
+
...prettierOptions,
|
|
1102
|
+
parser: "css"
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1105
|
+
}
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
files: [GLOB_SCSS],
|
|
1109
|
+
languageOptions: {
|
|
1110
|
+
parser: parserPlain
|
|
1111
|
+
},
|
|
1112
|
+
name: "vinicunca:formatters:scss",
|
|
1113
|
+
rules: {
|
|
1114
|
+
"format/prettier": [
|
|
1115
|
+
"error",
|
|
1116
|
+
{
|
|
1117
|
+
...prettierOptions,
|
|
1118
|
+
parser: "scss"
|
|
1119
|
+
}
|
|
1120
|
+
]
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
files: [GLOB_LESS],
|
|
1125
|
+
languageOptions: {
|
|
1126
|
+
parser: parserPlain
|
|
1127
|
+
},
|
|
1128
|
+
name: "vinicunca:formatters:less",
|
|
1129
|
+
rules: {
|
|
1130
|
+
"format/prettier": [
|
|
1131
|
+
"error",
|
|
1132
|
+
{
|
|
1133
|
+
...prettierOptions,
|
|
1134
|
+
parser: "less"
|
|
1135
|
+
}
|
|
1136
|
+
]
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
if (options.html) {
|
|
1142
|
+
configs.push({
|
|
1143
|
+
files: ["**/*.html"],
|
|
1144
|
+
languageOptions: {
|
|
1145
|
+
parser: parserPlain
|
|
44
1146
|
},
|
|
1147
|
+
name: "vinicunca:formatters:html",
|
|
45
1148
|
rules: {
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1149
|
+
"format/prettier": [
|
|
1150
|
+
"error",
|
|
1151
|
+
{
|
|
1152
|
+
...prettierOptions,
|
|
1153
|
+
parser: "html"
|
|
1154
|
+
}
|
|
1155
|
+
]
|
|
50
1156
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
if (options.markdown) {
|
|
1160
|
+
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
1161
|
+
configs.push({
|
|
1162
|
+
files: [GLOB_MARKDOWN],
|
|
1163
|
+
languageOptions: {
|
|
1164
|
+
parser: parserPlain
|
|
1165
|
+
},
|
|
1166
|
+
name: "vinicunca:formatters:markdown",
|
|
1167
|
+
rules: {
|
|
1168
|
+
[`format/${formater}`]: [
|
|
1169
|
+
"error",
|
|
1170
|
+
formater === "prettier" ? {
|
|
1171
|
+
printWidth: 120,
|
|
1172
|
+
...prettierOptions,
|
|
1173
|
+
embeddedLanguageFormatting: "off",
|
|
1174
|
+
parser: "markdown"
|
|
1175
|
+
} : {
|
|
1176
|
+
...dprintOptions,
|
|
1177
|
+
language: "markdown"
|
|
1178
|
+
}
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
if (options.graphql) {
|
|
1184
|
+
configs.push({
|
|
1185
|
+
files: ["**/*.graphql"],
|
|
1186
|
+
languageOptions: {
|
|
1187
|
+
parser: parserPlain
|
|
1188
|
+
},
|
|
1189
|
+
name: "vinicunca:formatters:graphql",
|
|
1190
|
+
rules: {
|
|
1191
|
+
"format/prettier": [
|
|
1192
|
+
"error",
|
|
1193
|
+
{
|
|
1194
|
+
...prettierOptions,
|
|
1195
|
+
parser: "graphql"
|
|
1196
|
+
}
|
|
1197
|
+
]
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
return configs;
|
|
53
1202
|
}
|
|
54
1203
|
|
|
55
|
-
// src/globs.ts
|
|
56
|
-
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
57
|
-
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
58
|
-
var GLOB_JS = "**/*.?([cm])js";
|
|
59
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
60
|
-
var GLOB_TS = "**/*.?([cm])ts";
|
|
61
|
-
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
62
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
63
|
-
var GLOB_CSS = "**/*.css";
|
|
64
|
-
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
65
|
-
var GLOB_LESS = "**/*.less";
|
|
66
|
-
var GLOB_SCSS = "**/*.scss";
|
|
67
|
-
var GLOB_JSON = "**/*.json";
|
|
68
|
-
var GLOB_JSON5 = "**/*.json5";
|
|
69
|
-
var GLOB_JSONC = "**/*.jsonc";
|
|
70
|
-
var GLOB_MARKDOWN = "**/*.md";
|
|
71
|
-
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
72
|
-
var GLOB_VUE = "**/*.vue";
|
|
73
|
-
var GLOB_YAML = "**/*.y?(a)ml";
|
|
74
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
75
|
-
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
76
|
-
var GLOB_TESTS = [
|
|
77
|
-
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
78
|
-
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
79
|
-
`**/*.test.${GLOB_SRC_EXT}`,
|
|
80
|
-
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
81
|
-
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
82
|
-
];
|
|
83
|
-
var GLOB_ALL_SRC = [
|
|
84
|
-
GLOB_SRC,
|
|
85
|
-
GLOB_STYLE,
|
|
86
|
-
GLOB_JSON,
|
|
87
|
-
GLOB_JSON5,
|
|
88
|
-
GLOB_MARKDOWN,
|
|
89
|
-
GLOB_VUE,
|
|
90
|
-
GLOB_YAML,
|
|
91
|
-
GLOB_HTML
|
|
92
|
-
];
|
|
93
|
-
var GLOB_EXCLUDE = [
|
|
94
|
-
"**/node_modules",
|
|
95
|
-
"**/dist",
|
|
96
|
-
"**/package-lock.json",
|
|
97
|
-
"**/yarn.lock",
|
|
98
|
-
"**/pnpm-lock.yaml",
|
|
99
|
-
"**/bun.lockb",
|
|
100
|
-
"**/output",
|
|
101
|
-
"**/coverage",
|
|
102
|
-
"**/temp",
|
|
103
|
-
"**/.temp",
|
|
104
|
-
"**/tmp",
|
|
105
|
-
"**/.tmp",
|
|
106
|
-
"**/.history",
|
|
107
|
-
"**/.vitepress/cache",
|
|
108
|
-
"**/.nuxt",
|
|
109
|
-
"**/.next",
|
|
110
|
-
"**/.vercel",
|
|
111
|
-
"**/.changeset",
|
|
112
|
-
"**/.idea",
|
|
113
|
-
"**/.cache",
|
|
114
|
-
"**/.output",
|
|
115
|
-
"**/.vite-inspect",
|
|
116
|
-
"**/CHANGELOG*.md",
|
|
117
|
-
"**/*.min.*",
|
|
118
|
-
"**/LICENSE*",
|
|
119
|
-
"**/__snapshots__",
|
|
120
|
-
"**/auto-import?(s).d.ts",
|
|
121
|
-
"**/components.d.ts"
|
|
122
|
-
];
|
|
123
|
-
|
|
124
1204
|
// src/configs/ignores.ts
|
|
125
1205
|
async function ignores() {
|
|
126
1206
|
return [
|
|
@@ -193,7 +1273,6 @@ async function javascript(options = {}) {
|
|
|
193
1273
|
},
|
|
194
1274
|
name: "vinicunca:javascript",
|
|
195
1275
|
plugins: {
|
|
196
|
-
"perfectionist": default5,
|
|
197
1276
|
"unused-imports": default7,
|
|
198
1277
|
"vinicunca": default2
|
|
199
1278
|
},
|
|
@@ -415,106 +1494,18 @@ async function javascript(options = {}) {
|
|
|
415
1494
|
}],
|
|
416
1495
|
"vars-on-top": ERROR,
|
|
417
1496
|
"yoda": [ERROR, NEVER],
|
|
418
|
-
...default2.configs.recommended.rules,
|
|
419
|
-
...
|
|
420
|
-
|
|
421
|
-
ERROR,
|
|
422
|
-
{
|
|
423
|
-
"groups": [
|
|
424
|
-
"type",
|
|
425
|
-
["builtin", "external"],
|
|
426
|
-
"internal-type",
|
|
427
|
-
"internal",
|
|
428
|
-
["parent-type", "sibling-type", "index-type"],
|
|
429
|
-
["parent", "sibling", "index"],
|
|
430
|
-
"object",
|
|
431
|
-
"unknown"
|
|
432
|
-
],
|
|
433
|
-
"internal-pattern": [
|
|
434
|
-
"~/**",
|
|
435
|
-
"~~/**"
|
|
436
|
-
],
|
|
437
|
-
"newlines-between": "always",
|
|
438
|
-
"order": "asc",
|
|
439
|
-
"type": "natural"
|
|
440
|
-
}
|
|
441
|
-
],
|
|
442
|
-
"perfectionist/sort-vue-attributes": [OFF],
|
|
443
|
-
...overrides
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
448
|
-
name: "vinicunca:javascript:overrides",
|
|
449
|
-
rules: {
|
|
450
|
-
"no-console": OFF
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
];
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// src/utils.ts
|
|
457
|
-
async function combineConfigs(...configs) {
|
|
458
|
-
const resolved = await Promise.all(configs);
|
|
459
|
-
return resolved.flat();
|
|
460
|
-
}
|
|
461
|
-
function renameRules(rules, map) {
|
|
462
|
-
return Object.fromEntries(
|
|
463
|
-
Object.entries(rules).map(([key, value]) => {
|
|
464
|
-
for (const [from, to] of Object.entries(map)) {
|
|
465
|
-
if (key.startsWith(`${from}/`)) {
|
|
466
|
-
return [to + key.slice(from.length), value];
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
return [key, value];
|
|
470
|
-
})
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
function renamePluginInConfigs(configs, map) {
|
|
474
|
-
return configs.map((i) => {
|
|
475
|
-
const clone = { ...i };
|
|
476
|
-
if (clone.rules) {
|
|
477
|
-
clone.rules = renameRules(clone.rules, map);
|
|
478
|
-
}
|
|
479
|
-
if (clone.plugins) {
|
|
480
|
-
clone.plugins = Object.fromEntries(
|
|
481
|
-
Object.entries(clone.plugins).map(([key, value]) => {
|
|
482
|
-
if (key in map) {
|
|
483
|
-
return [map[key], value];
|
|
484
|
-
}
|
|
485
|
-
return [key, value];
|
|
486
|
-
})
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
return clone;
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
async function interopDefault(m) {
|
|
493
|
-
const resolved = await m;
|
|
494
|
-
return resolved.default || resolved;
|
|
495
|
-
}
|
|
496
|
-
var parserPlain = {
|
|
497
|
-
meta: {
|
|
498
|
-
name: "parser-plain"
|
|
499
|
-
},
|
|
500
|
-
parseForESLint: (code) => ({
|
|
501
|
-
ast: {
|
|
502
|
-
body: [],
|
|
503
|
-
comments: [],
|
|
504
|
-
loc: { end: code.length, start: 0 },
|
|
505
|
-
range: [0, code.length],
|
|
506
|
-
tokens: [],
|
|
507
|
-
type: "Program"
|
|
1497
|
+
...default2.configs.recommended.rules,
|
|
1498
|
+
...overrides
|
|
1499
|
+
}
|
|
508
1500
|
},
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1501
|
+
{
|
|
1502
|
+
files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1503
|
+
name: "vinicunca:javascript:overrides",
|
|
1504
|
+
rules: {
|
|
1505
|
+
"no-console": OFF
|
|
1506
|
+
}
|
|
513
1507
|
}
|
|
514
|
-
|
|
515
|
-
};
|
|
516
|
-
function toArray(value) {
|
|
517
|
-
return Array.isArray(value) ? value : [value];
|
|
1508
|
+
];
|
|
518
1509
|
}
|
|
519
1510
|
|
|
520
1511
|
// src/configs/jsdoc.ts
|
|
@@ -751,6 +1742,44 @@ async function node() {
|
|
|
751
1742
|
];
|
|
752
1743
|
}
|
|
753
1744
|
|
|
1745
|
+
// src/configs/perfectionist.ts
|
|
1746
|
+
async function perfectionist() {
|
|
1747
|
+
return [
|
|
1748
|
+
{
|
|
1749
|
+
name: "vinicunca:perfectionist",
|
|
1750
|
+
plugins: {
|
|
1751
|
+
perfectionist: default5
|
|
1752
|
+
},
|
|
1753
|
+
rules: {
|
|
1754
|
+
...default5.configs["recommended-natural"].rules,
|
|
1755
|
+
"perfectionist/sort-imports": [
|
|
1756
|
+
ERROR,
|
|
1757
|
+
{
|
|
1758
|
+
"groups": [
|
|
1759
|
+
"type",
|
|
1760
|
+
["builtin", "external"],
|
|
1761
|
+
"internal-type",
|
|
1762
|
+
"internal",
|
|
1763
|
+
["parent-type", "sibling-type", "index-type"],
|
|
1764
|
+
["parent", "sibling", "index"],
|
|
1765
|
+
"object",
|
|
1766
|
+
"unknown"
|
|
1767
|
+
],
|
|
1768
|
+
"internal-pattern": [
|
|
1769
|
+
"~/**",
|
|
1770
|
+
"~~/**"
|
|
1771
|
+
],
|
|
1772
|
+
"newlines-between": "always",
|
|
1773
|
+
"order": "asc",
|
|
1774
|
+
"type": "natural"
|
|
1775
|
+
}
|
|
1776
|
+
],
|
|
1777
|
+
"perfectionist/sort-vue-attributes": [OFF]
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
];
|
|
1781
|
+
}
|
|
1782
|
+
|
|
754
1783
|
// src/configs/react.ts
|
|
755
1784
|
async function react(options = {}) {
|
|
756
1785
|
const {
|
|
@@ -954,211 +1983,101 @@ function sortTsconfig() {
|
|
|
954
1983
|
"composite",
|
|
955
1984
|
"tsBuildInfoFile",
|
|
956
1985
|
"disableSourceOfProjectReferenceRedirect",
|
|
957
|
-
"disableSolutionSearching",
|
|
958
|
-
"disableReferencedProjectLoad",
|
|
959
|
-
/* Language and Environment */
|
|
960
|
-
"target",
|
|
961
|
-
"jsx",
|
|
962
|
-
"jsxFactory",
|
|
963
|
-
"jsxFragmentFactory",
|
|
964
|
-
"jsxImportSource",
|
|
965
|
-
"lib",
|
|
966
|
-
"moduleDetection",
|
|
967
|
-
"noLib",
|
|
968
|
-
"reactNamespace",
|
|
969
|
-
"useDefineForClassFields",
|
|
970
|
-
"emitDecoratorMetadata",
|
|
971
|
-
"experimentalDecorators",
|
|
972
|
-
/* Modules */
|
|
973
|
-
"baseUrl",
|
|
974
|
-
"rootDir",
|
|
975
|
-
"rootDirs",
|
|
976
|
-
"customConditions",
|
|
977
|
-
"module",
|
|
978
|
-
"moduleResolution",
|
|
979
|
-
"moduleSuffixes",
|
|
980
|
-
"noResolve",
|
|
981
|
-
"paths",
|
|
982
|
-
"resolveJsonModule",
|
|
983
|
-
"resolvePackageJsonExports",
|
|
984
|
-
"resolvePackageJsonImports",
|
|
985
|
-
"typeRoots",
|
|
986
|
-
"types",
|
|
987
|
-
"allowArbitraryExtensions",
|
|
988
|
-
"allowImportingTsExtensions",
|
|
989
|
-
"allowUmdGlobalAccess",
|
|
990
|
-
/* JavaScript Support */
|
|
991
|
-
"allowJs",
|
|
992
|
-
"checkJs",
|
|
993
|
-
"maxNodeModuleJsDepth",
|
|
994
|
-
/* Type Checking */
|
|
995
|
-
"strict",
|
|
996
|
-
"strictBindCallApply",
|
|
997
|
-
"strictFunctionTypes",
|
|
998
|
-
"strictNullChecks",
|
|
999
|
-
"strictPropertyInitialization",
|
|
1000
|
-
"allowUnreachableCode",
|
|
1001
|
-
"allowUnusedLabels",
|
|
1002
|
-
"alwaysStrict",
|
|
1003
|
-
"exactOptionalPropertyTypes",
|
|
1004
|
-
"noFallthroughCasesInSwitch",
|
|
1005
|
-
"noImplicitAny",
|
|
1006
|
-
"noImplicitOverride",
|
|
1007
|
-
"noImplicitReturns",
|
|
1008
|
-
"noImplicitThis",
|
|
1009
|
-
"noPropertyAccessFromIndexSignature",
|
|
1010
|
-
"noUncheckedIndexedAccess",
|
|
1011
|
-
"noUnusedLocals",
|
|
1012
|
-
"noUnusedParameters",
|
|
1013
|
-
"useUnknownInCatchVariables",
|
|
1014
|
-
/* Emit */
|
|
1015
|
-
"declaration",
|
|
1016
|
-
"declarationDir",
|
|
1017
|
-
"declarationMap",
|
|
1018
|
-
"downlevelIteration",
|
|
1019
|
-
"emitBOM",
|
|
1020
|
-
"emitDeclarationOnly",
|
|
1021
|
-
"importHelpers",
|
|
1022
|
-
"importsNotUsedAsValues",
|
|
1023
|
-
"inlineSourceMap",
|
|
1024
|
-
"inlineSources",
|
|
1025
|
-
"mapRoot",
|
|
1026
|
-
"newLine",
|
|
1027
|
-
"noEmit",
|
|
1028
|
-
"noEmitHelpers",
|
|
1029
|
-
"noEmitOnError",
|
|
1030
|
-
"outDir",
|
|
1031
|
-
"outFile",
|
|
1032
|
-
"preserveConstEnums",
|
|
1033
|
-
"preserveValueImports",
|
|
1034
|
-
"removeComments",
|
|
1035
|
-
"sourceMap",
|
|
1036
|
-
"sourceRoot",
|
|
1037
|
-
"stripInternal",
|
|
1038
|
-
/* Interop Constraints */
|
|
1039
|
-
"allowSyntheticDefaultImports",
|
|
1040
|
-
"esModuleInterop",
|
|
1041
|
-
"forceConsistentCasingInFileNames",
|
|
1042
|
-
"isolatedModules",
|
|
1043
|
-
"preserveSymlinks",
|
|
1044
|
-
"verbatimModuleSyntax",
|
|
1045
|
-
/* Completeness */
|
|
1046
|
-
"skipDefaultLibCheck",
|
|
1047
|
-
"skipLibCheck"
|
|
1048
|
-
],
|
|
1049
|
-
pathPattern: "^compilerOptions$"
|
|
1050
|
-
}
|
|
1051
|
-
]
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
];
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
// src/configs/stylistic.ts
|
|
1058
|
-
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
1059
|
-
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
1060
|
-
indent: 2,
|
|
1061
|
-
jsx: true,
|
|
1062
|
-
quotes: "single",
|
|
1063
|
-
semi: true
|
|
1064
|
-
};
|
|
1065
|
-
async function stylistic(options = {}) {
|
|
1066
|
-
const {
|
|
1067
|
-
indent,
|
|
1068
|
-
jsx,
|
|
1069
|
-
overrides = {},
|
|
1070
|
-
quotes,
|
|
1071
|
-
semi
|
|
1072
|
-
} = {
|
|
1073
|
-
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1074
|
-
...options
|
|
1075
|
-
};
|
|
1076
|
-
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
1077
|
-
const config = pluginStylistic.configs.customize({
|
|
1078
|
-
flat: true,
|
|
1079
|
-
indent,
|
|
1080
|
-
jsx,
|
|
1081
|
-
pluginName: "style",
|
|
1082
|
-
quotes,
|
|
1083
|
-
semi
|
|
1084
|
-
});
|
|
1085
|
-
return [
|
|
1086
|
-
{
|
|
1087
|
-
name: "vinicunca:stylistic",
|
|
1088
|
-
plugins: {
|
|
1089
|
-
style: pluginStylistic,
|
|
1090
|
-
vinicunca: default2
|
|
1091
|
-
},
|
|
1092
|
-
rules: {
|
|
1093
|
-
...config.rules,
|
|
1094
|
-
"curly": [ERROR, "all"],
|
|
1095
|
-
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
1096
|
-
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
1097
|
-
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
1098
|
-
"style/arrow-parens": [ERROR, ALWAYS],
|
|
1099
|
-
"style/brace-style": [ERROR],
|
|
1100
|
-
"style/func-call-spacing": [ERROR, NEVER],
|
|
1101
|
-
"style/jsx-child-element-spacing": OFF,
|
|
1102
|
-
"style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
|
|
1103
|
-
"style/jsx-closing-tag-location": ERROR,
|
|
1104
|
-
"style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
|
|
1105
|
-
"style/jsx-curly-newline": [ERROR, {
|
|
1106
|
-
multiline: "consistent",
|
|
1107
|
-
singleline: "consistent"
|
|
1108
|
-
}],
|
|
1109
|
-
"style/jsx-curly-spacing": [ERROR, {
|
|
1110
|
-
children: true,
|
|
1111
|
-
spacing: {
|
|
1112
|
-
objectLiterals: NEVER
|
|
1113
|
-
},
|
|
1114
|
-
when: "always"
|
|
1115
|
-
}],
|
|
1116
|
-
"style/jsx-equals-spacing": [ERROR, NEVER],
|
|
1117
|
-
"style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
|
|
1118
|
-
"style/jsx-indent": [ERROR, 2],
|
|
1119
|
-
"style/jsx-indent-props": [ERROR, 2],
|
|
1120
|
-
"style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
|
|
1121
|
-
"style/jsx-newline": ERROR,
|
|
1122
|
-
"style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
|
|
1123
|
-
"style/jsx-props-no-multi-spaces": ERROR,
|
|
1124
|
-
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
|
|
1125
|
-
"style/jsx-sort-props": [OFF],
|
|
1126
|
-
"style/jsx-tag-spacing": [ERROR, {
|
|
1127
|
-
afterOpening: NEVER,
|
|
1128
|
-
beforeClosing: NEVER,
|
|
1129
|
-
beforeSelfClosing: "always",
|
|
1130
|
-
closingSlash: NEVER
|
|
1131
|
-
}],
|
|
1132
|
-
"style/jsx-wrap-multilines": [ERROR, {
|
|
1133
|
-
arrow: STR_PARENS_NEW_LINE,
|
|
1134
|
-
assignment: STR_PARENS_NEW_LINE,
|
|
1135
|
-
condition: STR_PARENS_NEW_LINE,
|
|
1136
|
-
declaration: STR_PARENS_NEW_LINE,
|
|
1137
|
-
logical: STR_PARENS_NEW_LINE,
|
|
1138
|
-
prop: STR_PARENS_NEW_LINE,
|
|
1139
|
-
return: STR_PARENS_NEW_LINE
|
|
1140
|
-
}],
|
|
1141
|
-
"style/member-delimiter-style": [ERROR],
|
|
1142
|
-
"style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
1143
|
-
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
1144
|
-
"style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
1145
|
-
"style/operator-linebreak": [ERROR, "before"],
|
|
1146
|
-
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
1147
|
-
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
1148
|
-
"style/quotes": [ERROR, quotes],
|
|
1149
|
-
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
1150
|
-
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
1151
|
-
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
1152
|
-
"vinicunca/consistent-list-newline": ERROR,
|
|
1153
|
-
"vinicunca/if-newline": ERROR,
|
|
1154
|
-
"vinicunca/top-level-function": ERROR,
|
|
1155
|
-
...overrides
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
|
-
{
|
|
1159
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1160
|
-
rules: {
|
|
1161
|
-
"vinicunca/consistent-list-newline": OFF
|
|
1986
|
+
"disableSolutionSearching",
|
|
1987
|
+
"disableReferencedProjectLoad",
|
|
1988
|
+
/* Language and Environment */
|
|
1989
|
+
"target",
|
|
1990
|
+
"jsx",
|
|
1991
|
+
"jsxFactory",
|
|
1992
|
+
"jsxFragmentFactory",
|
|
1993
|
+
"jsxImportSource",
|
|
1994
|
+
"lib",
|
|
1995
|
+
"moduleDetection",
|
|
1996
|
+
"noLib",
|
|
1997
|
+
"reactNamespace",
|
|
1998
|
+
"useDefineForClassFields",
|
|
1999
|
+
"emitDecoratorMetadata",
|
|
2000
|
+
"experimentalDecorators",
|
|
2001
|
+
/* Modules */
|
|
2002
|
+
"baseUrl",
|
|
2003
|
+
"rootDir",
|
|
2004
|
+
"rootDirs",
|
|
2005
|
+
"customConditions",
|
|
2006
|
+
"module",
|
|
2007
|
+
"moduleResolution",
|
|
2008
|
+
"moduleSuffixes",
|
|
2009
|
+
"noResolve",
|
|
2010
|
+
"paths",
|
|
2011
|
+
"resolveJsonModule",
|
|
2012
|
+
"resolvePackageJsonExports",
|
|
2013
|
+
"resolvePackageJsonImports",
|
|
2014
|
+
"typeRoots",
|
|
2015
|
+
"types",
|
|
2016
|
+
"allowArbitraryExtensions",
|
|
2017
|
+
"allowImportingTsExtensions",
|
|
2018
|
+
"allowUmdGlobalAccess",
|
|
2019
|
+
/* JavaScript Support */
|
|
2020
|
+
"allowJs",
|
|
2021
|
+
"checkJs",
|
|
2022
|
+
"maxNodeModuleJsDepth",
|
|
2023
|
+
/* Type Checking */
|
|
2024
|
+
"strict",
|
|
2025
|
+
"strictBindCallApply",
|
|
2026
|
+
"strictFunctionTypes",
|
|
2027
|
+
"strictNullChecks",
|
|
2028
|
+
"strictPropertyInitialization",
|
|
2029
|
+
"allowUnreachableCode",
|
|
2030
|
+
"allowUnusedLabels",
|
|
2031
|
+
"alwaysStrict",
|
|
2032
|
+
"exactOptionalPropertyTypes",
|
|
2033
|
+
"noFallthroughCasesInSwitch",
|
|
2034
|
+
"noImplicitAny",
|
|
2035
|
+
"noImplicitOverride",
|
|
2036
|
+
"noImplicitReturns",
|
|
2037
|
+
"noImplicitThis",
|
|
2038
|
+
"noPropertyAccessFromIndexSignature",
|
|
2039
|
+
"noUncheckedIndexedAccess",
|
|
2040
|
+
"noUnusedLocals",
|
|
2041
|
+
"noUnusedParameters",
|
|
2042
|
+
"useUnknownInCatchVariables",
|
|
2043
|
+
/* Emit */
|
|
2044
|
+
"declaration",
|
|
2045
|
+
"declarationDir",
|
|
2046
|
+
"declarationMap",
|
|
2047
|
+
"downlevelIteration",
|
|
2048
|
+
"emitBOM",
|
|
2049
|
+
"emitDeclarationOnly",
|
|
2050
|
+
"importHelpers",
|
|
2051
|
+
"importsNotUsedAsValues",
|
|
2052
|
+
"inlineSourceMap",
|
|
2053
|
+
"inlineSources",
|
|
2054
|
+
"mapRoot",
|
|
2055
|
+
"newLine",
|
|
2056
|
+
"noEmit",
|
|
2057
|
+
"noEmitHelpers",
|
|
2058
|
+
"noEmitOnError",
|
|
2059
|
+
"outDir",
|
|
2060
|
+
"outFile",
|
|
2061
|
+
"preserveConstEnums",
|
|
2062
|
+
"preserveValueImports",
|
|
2063
|
+
"removeComments",
|
|
2064
|
+
"sourceMap",
|
|
2065
|
+
"sourceRoot",
|
|
2066
|
+
"stripInternal",
|
|
2067
|
+
/* Interop Constraints */
|
|
2068
|
+
"allowSyntheticDefaultImports",
|
|
2069
|
+
"esModuleInterop",
|
|
2070
|
+
"forceConsistentCasingInFileNames",
|
|
2071
|
+
"isolatedModules",
|
|
2072
|
+
"preserveSymlinks",
|
|
2073
|
+
"verbatimModuleSyntax",
|
|
2074
|
+
/* Completeness */
|
|
2075
|
+
"skipDefaultLibCheck",
|
|
2076
|
+
"skipLibCheck"
|
|
2077
|
+
],
|
|
2078
|
+
pathPattern: "^compilerOptions$"
|
|
2079
|
+
}
|
|
2080
|
+
]
|
|
1162
2081
|
}
|
|
1163
2082
|
}
|
|
1164
2083
|
];
|
|
@@ -1210,7 +2129,7 @@ async function test(options = {}) {
|
|
|
1210
2129
|
}
|
|
1211
2130
|
|
|
1212
2131
|
// src/configs/typescript.ts
|
|
1213
|
-
import process from "process";
|
|
2132
|
+
import process from "node:process";
|
|
1214
2133
|
async function typescript(options = {}) {
|
|
1215
2134
|
const {
|
|
1216
2135
|
componentExts = [],
|
|
@@ -1637,167 +2556,6 @@ async function yaml(options = {}) {
|
|
|
1637
2556
|
];
|
|
1638
2557
|
}
|
|
1639
2558
|
|
|
1640
|
-
// src/configs/formatters.ts
|
|
1641
|
-
async function formatters(options = {}, stylistic2 = {}) {
|
|
1642
|
-
if (options === true) {
|
|
1643
|
-
options = {
|
|
1644
|
-
css: true,
|
|
1645
|
-
graphql: true,
|
|
1646
|
-
html: true,
|
|
1647
|
-
markdown: true
|
|
1648
|
-
};
|
|
1649
|
-
}
|
|
1650
|
-
const {
|
|
1651
|
-
indent,
|
|
1652
|
-
quotes,
|
|
1653
|
-
semi
|
|
1654
|
-
} = {
|
|
1655
|
-
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1656
|
-
...stylistic2
|
|
1657
|
-
};
|
|
1658
|
-
const prettierOptions = Object.assign(
|
|
1659
|
-
{
|
|
1660
|
-
endOfLine: "auto",
|
|
1661
|
-
semi,
|
|
1662
|
-
singleQuote: quotes === "single",
|
|
1663
|
-
tabWidth: typeof indent === "number" ? indent : 2,
|
|
1664
|
-
trailingComma: "all",
|
|
1665
|
-
useTabs: indent === "tab"
|
|
1666
|
-
},
|
|
1667
|
-
options.prettierOptions || {}
|
|
1668
|
-
);
|
|
1669
|
-
const dprintOptions = Object.assign(
|
|
1670
|
-
{
|
|
1671
|
-
indentWidth: typeof indent === "number" ? indent : 2,
|
|
1672
|
-
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
1673
|
-
useTabs: indent === "tab"
|
|
1674
|
-
},
|
|
1675
|
-
options.dprintOptions || {}
|
|
1676
|
-
);
|
|
1677
|
-
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
1678
|
-
const configs = [
|
|
1679
|
-
{
|
|
1680
|
-
name: "vinicunca:formatters:setup",
|
|
1681
|
-
plugins: {
|
|
1682
|
-
format: pluginFormat
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
];
|
|
1686
|
-
if (options.css) {
|
|
1687
|
-
configs.push(
|
|
1688
|
-
{
|
|
1689
|
-
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1690
|
-
languageOptions: {
|
|
1691
|
-
parser: parserPlain
|
|
1692
|
-
},
|
|
1693
|
-
name: "vinicunca:formatters:css",
|
|
1694
|
-
rules: {
|
|
1695
|
-
"format/prettier": [
|
|
1696
|
-
"error",
|
|
1697
|
-
{
|
|
1698
|
-
...prettierOptions,
|
|
1699
|
-
parser: "css"
|
|
1700
|
-
}
|
|
1701
|
-
]
|
|
1702
|
-
}
|
|
1703
|
-
},
|
|
1704
|
-
{
|
|
1705
|
-
files: [GLOB_SCSS],
|
|
1706
|
-
languageOptions: {
|
|
1707
|
-
parser: parserPlain
|
|
1708
|
-
},
|
|
1709
|
-
name: "vinicunca:formatters:scss",
|
|
1710
|
-
rules: {
|
|
1711
|
-
"format/prettier": [
|
|
1712
|
-
"error",
|
|
1713
|
-
{
|
|
1714
|
-
...prettierOptions,
|
|
1715
|
-
parser: "scss"
|
|
1716
|
-
}
|
|
1717
|
-
]
|
|
1718
|
-
}
|
|
1719
|
-
},
|
|
1720
|
-
{
|
|
1721
|
-
files: [GLOB_LESS],
|
|
1722
|
-
languageOptions: {
|
|
1723
|
-
parser: parserPlain
|
|
1724
|
-
},
|
|
1725
|
-
name: "vinicunca:formatters:less",
|
|
1726
|
-
rules: {
|
|
1727
|
-
"format/prettier": [
|
|
1728
|
-
"error",
|
|
1729
|
-
{
|
|
1730
|
-
...prettierOptions,
|
|
1731
|
-
parser: "less"
|
|
1732
|
-
}
|
|
1733
|
-
]
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
);
|
|
1737
|
-
}
|
|
1738
|
-
if (options.html) {
|
|
1739
|
-
configs.push({
|
|
1740
|
-
files: ["**/*.html"],
|
|
1741
|
-
languageOptions: {
|
|
1742
|
-
parser: parserPlain
|
|
1743
|
-
},
|
|
1744
|
-
name: "vinicunca:formatters:html",
|
|
1745
|
-
rules: {
|
|
1746
|
-
"format/prettier": [
|
|
1747
|
-
"error",
|
|
1748
|
-
{
|
|
1749
|
-
...prettierOptions,
|
|
1750
|
-
parser: "html"
|
|
1751
|
-
}
|
|
1752
|
-
]
|
|
1753
|
-
}
|
|
1754
|
-
});
|
|
1755
|
-
}
|
|
1756
|
-
if (options.markdown) {
|
|
1757
|
-
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
1758
|
-
configs.push({
|
|
1759
|
-
files: [GLOB_MARKDOWN],
|
|
1760
|
-
languageOptions: {
|
|
1761
|
-
parser: parserPlain
|
|
1762
|
-
},
|
|
1763
|
-
name: "vinicunca:formatters:markdown",
|
|
1764
|
-
rules: {
|
|
1765
|
-
[`format/${formater}`]: [
|
|
1766
|
-
"error",
|
|
1767
|
-
formater === "prettier" ? {
|
|
1768
|
-
printWidth: 120,
|
|
1769
|
-
...prettierOptions,
|
|
1770
|
-
embeddedLanguageFormatting: "off",
|
|
1771
|
-
parser: "markdown"
|
|
1772
|
-
} : {
|
|
1773
|
-
...dprintOptions,
|
|
1774
|
-
language: "markdown"
|
|
1775
|
-
}
|
|
1776
|
-
]
|
|
1777
|
-
}
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
if (options.graphql) {
|
|
1781
|
-
configs.push({
|
|
1782
|
-
files: ["**/*.graphql"],
|
|
1783
|
-
languageOptions: {
|
|
1784
|
-
parser: parserPlain
|
|
1785
|
-
},
|
|
1786
|
-
name: "vinicunca:formatters:graphql",
|
|
1787
|
-
rules: {
|
|
1788
|
-
"format/prettier": [
|
|
1789
|
-
"error",
|
|
1790
|
-
{
|
|
1791
|
-
...prettierOptions,
|
|
1792
|
-
parser: "graphql"
|
|
1793
|
-
}
|
|
1794
|
-
]
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
}
|
|
1798
|
-
return configs;
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
2559
|
// src/base.ts
|
|
1802
2560
|
var flatConfigProps = [
|
|
1803
2561
|
"name",
|
|
@@ -1824,7 +2582,7 @@ var defaultPluginRenaming = {
|
|
|
1824
2582
|
"vitest": "test",
|
|
1825
2583
|
"yml": "yaml"
|
|
1826
2584
|
};
|
|
1827
|
-
|
|
2585
|
+
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
1828
2586
|
const {
|
|
1829
2587
|
autoRenamePlugins = true,
|
|
1830
2588
|
componentExts = [],
|
|
@@ -1866,7 +2624,8 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
1866
2624
|
stylistic: stylisticOptions
|
|
1867
2625
|
}),
|
|
1868
2626
|
imports(),
|
|
1869
|
-
unicorn()
|
|
2627
|
+
unicorn(),
|
|
2628
|
+
perfectionist()
|
|
1870
2629
|
);
|
|
1871
2630
|
if (enableVue) {
|
|
1872
2631
|
componentExts.push("vue");
|
|
@@ -1953,14 +2712,15 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
1953
2712
|
configs.push([fusedConfig]);
|
|
1954
2713
|
}
|
|
1955
2714
|
;
|
|
1956
|
-
|
|
2715
|
+
let pipeline = new FlatConfigPipeline();
|
|
2716
|
+
pipeline = pipeline.append(
|
|
1957
2717
|
...configs,
|
|
1958
2718
|
...userConfigs
|
|
1959
2719
|
);
|
|
1960
2720
|
if (autoRenamePlugins) {
|
|
1961
|
-
|
|
2721
|
+
pipeline = pipeline.renamePlugins(defaultPluginRenaming);
|
|
1962
2722
|
}
|
|
1963
|
-
return
|
|
2723
|
+
return pipeline;
|
|
1964
2724
|
}
|
|
1965
2725
|
function getOverrides(options, key) {
|
|
1966
2726
|
const sub = resolveSubOptions(options, key);
|
|
@@ -1999,6 +2759,7 @@ export {
|
|
|
1999
2759
|
combineConfigs,
|
|
2000
2760
|
comments,
|
|
2001
2761
|
defaultPluginRenaming,
|
|
2762
|
+
formatters,
|
|
2002
2763
|
ignores,
|
|
2003
2764
|
imports,
|
|
2004
2765
|
interopDefault,
|
|
@@ -2008,6 +2769,7 @@ export {
|
|
|
2008
2769
|
markdown,
|
|
2009
2770
|
node,
|
|
2010
2771
|
parserPlain,
|
|
2772
|
+
perfectionist,
|
|
2011
2773
|
default3 as pluginComments,
|
|
2012
2774
|
pluginImport,
|
|
2013
2775
|
default4 as pluginNode,
|