@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.cjs
CHANGED
|
@@ -57,6 +57,7 @@ __export(src_exports, {
|
|
|
57
57
|
combineConfigs: () => combineConfigs,
|
|
58
58
|
comments: () => comments,
|
|
59
59
|
defaultPluginRenaming: () => defaultPluginRenaming,
|
|
60
|
+
formatters: () => formatters,
|
|
60
61
|
ignores: () => ignores,
|
|
61
62
|
imports: () => imports,
|
|
62
63
|
interopDefault: () => interopDefault,
|
|
@@ -66,6 +67,7 @@ __export(src_exports, {
|
|
|
66
67
|
markdown: () => markdown,
|
|
67
68
|
node: () => node,
|
|
68
69
|
parserPlain: () => parserPlain,
|
|
70
|
+
perfectionist: () => perfectionist,
|
|
69
71
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
70
72
|
pluginImport: () => pluginImport,
|
|
71
73
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
@@ -90,129 +92,1209 @@ __export(src_exports, {
|
|
|
90
92
|
});
|
|
91
93
|
module.exports = __toCommonJS(src_exports);
|
|
92
94
|
|
|
93
|
-
// ../node_modules/.pnpm/@vinicunca+perkakas@0.3
|
|
95
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.5.3/node_modules/@vinicunca/perkakas/dist/index.mjs
|
|
96
|
+
function purry(fn, args, lazyFactory) {
|
|
97
|
+
const callArgs = Array.from(args);
|
|
98
|
+
const diff = fn.length - args.length;
|
|
99
|
+
if (diff === 0) {
|
|
100
|
+
return fn(...callArgs);
|
|
101
|
+
}
|
|
102
|
+
if (diff === 1) {
|
|
103
|
+
const ret = (data) => fn(data, ...callArgs);
|
|
104
|
+
const lazy = lazyFactory ?? fn.lazy;
|
|
105
|
+
return lazy === void 0 ? ret : Object.assign(ret, { lazy, lazyArgs: args });
|
|
106
|
+
}
|
|
107
|
+
throw new Error("Wrong number of arguments");
|
|
108
|
+
}
|
|
109
|
+
function purryOn(isArg, implementation, args) {
|
|
110
|
+
const callArgs = Array.from(args);
|
|
111
|
+
return isArg(args[0]) ? (data) => implementation(data, ...callArgs) : implementation(...callArgs);
|
|
112
|
+
}
|
|
113
|
+
function conditional(...args) {
|
|
114
|
+
return purryOn(isCase, conditionalImplementation, args);
|
|
115
|
+
}
|
|
116
|
+
function conditionalImplementation(data, ...cases) {
|
|
117
|
+
for (const [when, then] of cases) {
|
|
118
|
+
if (when(data)) {
|
|
119
|
+
return then(data);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
throw new Error("conditional: data failed for all cases");
|
|
123
|
+
}
|
|
124
|
+
function isCase(maybeCase) {
|
|
125
|
+
if (!Array.isArray(maybeCase)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
const [when, then, ...rest] = maybeCase;
|
|
129
|
+
return typeof when === "function" && when.length <= 1 && typeof then === "function" && then.length <= 1 && rest.length === 0;
|
|
130
|
+
}
|
|
131
|
+
var trivialDefaultCase = () => void 0;
|
|
132
|
+
((conditional2) => {
|
|
133
|
+
function defaultCase(then = trivialDefaultCase) {
|
|
134
|
+
return [() => true, then];
|
|
135
|
+
}
|
|
136
|
+
conditional2.defaultCase = defaultCase;
|
|
137
|
+
})(conditional || (conditional = {}));
|
|
138
|
+
function _reduceLazy(array, lazy, isIndexed = false) {
|
|
139
|
+
const out = [];
|
|
140
|
+
for (let index = 0; index < array.length; index++) {
|
|
141
|
+
const item = array[index];
|
|
142
|
+
const result = isIndexed ? lazy(item, index, array) : lazy(item);
|
|
143
|
+
if (result.hasMany === true) {
|
|
144
|
+
out.push(...result.next);
|
|
145
|
+
} else if (result.hasNext) {
|
|
146
|
+
out.push(result.next);
|
|
147
|
+
}
|
|
148
|
+
if (result.done) {
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
function differenceWith(...args) {
|
|
155
|
+
return purry(differenceWith_, args, differenceWith.lazy);
|
|
156
|
+
}
|
|
157
|
+
function differenceWith_(array, other, isEquals) {
|
|
158
|
+
const lazy = differenceWith.lazy(other, isEquals);
|
|
159
|
+
return _reduceLazy(array, lazy);
|
|
160
|
+
}
|
|
161
|
+
((differenceWith2) => {
|
|
162
|
+
function lazy(other, isEquals) {
|
|
163
|
+
return (value) => other.every((otherValue) => !isEquals(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
164
|
+
}
|
|
165
|
+
differenceWith2.lazy = lazy;
|
|
166
|
+
})(differenceWith || (differenceWith = {}));
|
|
167
|
+
var COMPARATORS = {
|
|
168
|
+
asc: (x, y) => x > y,
|
|
169
|
+
desc: (x, y) => x < y
|
|
170
|
+
};
|
|
171
|
+
function purryOrderRules(func, inputArgs) {
|
|
172
|
+
const [dataOrRule, ...rules] = Array.isArray(inputArgs) ? inputArgs : Array.from(inputArgs);
|
|
173
|
+
if (!isOrderRule(dataOrRule)) {
|
|
174
|
+
const compareFn2 = orderRuleComparer(...rules);
|
|
175
|
+
return func(dataOrRule, compareFn2);
|
|
176
|
+
}
|
|
177
|
+
const compareFn = orderRuleComparer(dataOrRule, ...rules);
|
|
178
|
+
return (data) => func(data, compareFn);
|
|
179
|
+
}
|
|
180
|
+
function orderRuleComparer(primaryRule, secondaryRule, ...otherRules) {
|
|
181
|
+
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
182
|
+
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
183
|
+
const { [direction]: comparator } = COMPARATORS;
|
|
184
|
+
const nextComparer = secondaryRule === void 0 ? void 0 : orderRuleComparer(secondaryRule, ...otherRules);
|
|
185
|
+
return (a, b) => {
|
|
186
|
+
const projectedA = projector(a);
|
|
187
|
+
const projectedB = projector(b);
|
|
188
|
+
if (comparator(projectedA, projectedB)) {
|
|
189
|
+
return 1;
|
|
190
|
+
}
|
|
191
|
+
if (comparator(projectedB, projectedA)) {
|
|
192
|
+
return -1;
|
|
193
|
+
}
|
|
194
|
+
return (nextComparer == null ? void 0 : nextComparer(a, b)) ?? 0;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function isOrderRule(x) {
|
|
198
|
+
if (isProjection(x)) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
if (typeof x !== "object" || !Array.isArray(x)) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
205
|
+
return isProjection(maybeProjection) && maybeDirection in COMPARATORS && rest.length === 0;
|
|
206
|
+
}
|
|
207
|
+
function isProjection(x) {
|
|
208
|
+
return typeof x === "function" && x.length === 1;
|
|
209
|
+
}
|
|
210
|
+
function drop(...args) {
|
|
211
|
+
return purry(drop_, args, drop.lazy);
|
|
212
|
+
}
|
|
213
|
+
function drop_(array, n) {
|
|
214
|
+
return _reduceLazy(array, drop.lazy(n));
|
|
215
|
+
}
|
|
216
|
+
((drop2) => {
|
|
217
|
+
function lazy(n) {
|
|
218
|
+
let left = n;
|
|
219
|
+
return (value) => {
|
|
220
|
+
if (left > 0) {
|
|
221
|
+
left -= 1;
|
|
222
|
+
return { done: false, hasNext: false };
|
|
223
|
+
}
|
|
224
|
+
return { done: false, hasNext: true, next: value };
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
drop2.lazy = lazy;
|
|
228
|
+
})(drop || (drop = {}));
|
|
229
|
+
function entries(...args) {
|
|
230
|
+
return purry(Object.entries, args);
|
|
231
|
+
}
|
|
232
|
+
((entries2) => {
|
|
233
|
+
entries2.strict = entries2;
|
|
234
|
+
})(entries || (entries = {}));
|
|
235
|
+
function _toLazyIndexed(fn) {
|
|
236
|
+
return Object.assign(fn, { indexed: true });
|
|
237
|
+
}
|
|
238
|
+
function filter(...args) {
|
|
239
|
+
return purry(filter_(false), args, filter.lazy);
|
|
240
|
+
}
|
|
241
|
+
function filter_(indexed) {
|
|
242
|
+
return (array, fn) => {
|
|
243
|
+
return _reduceLazy(
|
|
244
|
+
array,
|
|
245
|
+
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
246
|
+
indexed
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function lazy_$5(indexed) {
|
|
251
|
+
return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
252
|
+
}
|
|
253
|
+
((filter2) => {
|
|
254
|
+
function indexed(...args) {
|
|
255
|
+
return purry(filter_(true), args, filter2.lazyIndexed);
|
|
256
|
+
}
|
|
257
|
+
filter2.indexed = indexed;
|
|
258
|
+
filter2.lazy = lazy_$5(false);
|
|
259
|
+
filter2.lazyIndexed = _toLazyIndexed(lazy_$5(true));
|
|
260
|
+
})(filter || (filter = {}));
|
|
261
|
+
function _toSingle(fn) {
|
|
262
|
+
return Object.assign(fn, { single: true });
|
|
263
|
+
}
|
|
264
|
+
function findIndex(...args) {
|
|
265
|
+
return purry(findIndex_(false), args, findIndex.lazy);
|
|
266
|
+
}
|
|
267
|
+
function findIndex_(indexed) {
|
|
268
|
+
return (array, fn) => array.findIndex((item, index, input) => indexed ? fn(item, index, input) : fn(item));
|
|
269
|
+
}
|
|
270
|
+
function lazy_$4(indexed) {
|
|
271
|
+
return (fn) => {
|
|
272
|
+
let actualIndex = 0;
|
|
273
|
+
return (value, index, array) => {
|
|
274
|
+
if (indexed ? fn(value, index, array) : fn(value)) {
|
|
275
|
+
return { done: true, hasNext: true, next: actualIndex };
|
|
276
|
+
}
|
|
277
|
+
actualIndex += 1;
|
|
278
|
+
return { done: false, hasNext: false };
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
((findIndex2) => {
|
|
283
|
+
function indexed(...args) {
|
|
284
|
+
return purry(findIndex_(true), args, findIndex2.lazyIndexed);
|
|
285
|
+
}
|
|
286
|
+
findIndex2.indexed = indexed;
|
|
287
|
+
findIndex2.lazy = _toSingle(lazy_$4(false));
|
|
288
|
+
findIndex2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$4(true)));
|
|
289
|
+
})(findIndex || (findIndex = {}));
|
|
290
|
+
function findLastIndex(...args) {
|
|
291
|
+
return purry(findLastIndex_(false), args);
|
|
292
|
+
}
|
|
293
|
+
function findLastIndex_(indexed) {
|
|
294
|
+
return (array, fn) => {
|
|
295
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
296
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
297
|
+
return i;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return -1;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
((findLastIndex2) => {
|
|
304
|
+
function indexed(...args) {
|
|
305
|
+
return purry(findLastIndex_(true), args);
|
|
306
|
+
}
|
|
307
|
+
findLastIndex2.indexed = indexed;
|
|
308
|
+
})(findLastIndex || (findLastIndex = {}));
|
|
309
|
+
function findLast(...args) {
|
|
310
|
+
return purry(findLast_(false), args);
|
|
311
|
+
}
|
|
312
|
+
function findLast_(indexed) {
|
|
313
|
+
return (array, fn) => {
|
|
314
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
315
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
316
|
+
return array[i];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return void 0;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
((findLast2) => {
|
|
323
|
+
function indexed(...args) {
|
|
324
|
+
return purry(findLast_(true), args);
|
|
325
|
+
}
|
|
326
|
+
findLast2.indexed = indexed;
|
|
327
|
+
})(findLast || (findLast = {}));
|
|
328
|
+
function find(...args) {
|
|
329
|
+
return purry(find_(false), args, find.lazy);
|
|
330
|
+
}
|
|
331
|
+
function find_(indexed) {
|
|
332
|
+
return (array, fn) => array.find((item, index, input) => indexed ? fn(item, index, input) : fn(item));
|
|
333
|
+
}
|
|
334
|
+
function lazy_$3(indexed) {
|
|
335
|
+
return (fn) => (value, index, array) => (indexed ? fn(value, index, array) : fn(value)) ? { done: true, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
336
|
+
}
|
|
337
|
+
((find2) => {
|
|
338
|
+
function indexed(...args) {
|
|
339
|
+
return purry(find_(true), args, find2.lazyIndexed);
|
|
340
|
+
}
|
|
341
|
+
find2.indexed = indexed;
|
|
342
|
+
find2.lazy = _toSingle(lazy_$3(false));
|
|
343
|
+
find2.lazyIndexed = _toSingle(_toLazyIndexed(lazy_$3(true)));
|
|
344
|
+
})(find || (find = {}));
|
|
345
|
+
function first(...args) {
|
|
346
|
+
return purry(first_, args, first.lazy);
|
|
347
|
+
}
|
|
348
|
+
function first_([item]) {
|
|
349
|
+
return item;
|
|
350
|
+
}
|
|
351
|
+
((first2) => {
|
|
352
|
+
function lazy() {
|
|
353
|
+
return (value) => ({ done: true, hasNext: true, next: value });
|
|
354
|
+
}
|
|
355
|
+
first2.lazy = lazy;
|
|
356
|
+
((lazy2) => {
|
|
357
|
+
lazy2.single = true;
|
|
358
|
+
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
359
|
+
})(first || (first = {}));
|
|
360
|
+
function flatten(...args) {
|
|
361
|
+
return purry(flatten_, args, flatten.lazy);
|
|
362
|
+
}
|
|
363
|
+
function flatten_(items) {
|
|
364
|
+
return _reduceLazy(items, flatten.lazy());
|
|
365
|
+
}
|
|
366
|
+
((flatten2) => {
|
|
367
|
+
function lazy() {
|
|
368
|
+
return (item) => (
|
|
369
|
+
// @ts-expect-error [ts2322] - We need to make LazyMany better so it accommodate the typing here...
|
|
370
|
+
Array.isArray(item) ? { done: false, hasMany: true, hasNext: true, next: item } : { done: false, hasNext: true, next: item }
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
flatten2.lazy = lazy;
|
|
374
|
+
})(flatten || (flatten = {}));
|
|
375
|
+
function flatMap(...args) {
|
|
376
|
+
return purry(flatMap_, args, flatMap.lazy);
|
|
377
|
+
}
|
|
378
|
+
function flatMap_(array, fn) {
|
|
379
|
+
return flatten(array.map((item) => fn(item)));
|
|
380
|
+
}
|
|
381
|
+
((flatMap2) => {
|
|
382
|
+
function lazy(fn) {
|
|
383
|
+
return (value) => {
|
|
384
|
+
const next = fn(value);
|
|
385
|
+
return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
flatMap2.lazy = lazy;
|
|
389
|
+
})(flatMap || (flatMap = {}));
|
|
390
|
+
function flattenDeep(...args) {
|
|
391
|
+
return purry(flattenDeep_, args, flattenDeep.lazy);
|
|
392
|
+
}
|
|
393
|
+
function flattenDeep_(items) {
|
|
394
|
+
return _reduceLazy(items, flattenDeep.lazy());
|
|
395
|
+
}
|
|
396
|
+
function flattenDeepValue_(value) {
|
|
397
|
+
if (!Array.isArray(value)) {
|
|
398
|
+
return value;
|
|
399
|
+
}
|
|
400
|
+
const ret = [];
|
|
401
|
+
for (const item of value) {
|
|
402
|
+
if (Array.isArray(item)) {
|
|
403
|
+
ret.push(...flattenDeep(item));
|
|
404
|
+
} else {
|
|
405
|
+
ret.push(item);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return ret;
|
|
409
|
+
}
|
|
410
|
+
((flattenDeep2) => {
|
|
411
|
+
function lazy() {
|
|
412
|
+
return (value) => {
|
|
413
|
+
const next = flattenDeepValue_(value);
|
|
414
|
+
return Array.isArray(next) ? { done: false, hasMany: true, hasNext: true, next } : { done: false, hasNext: true, next };
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
flattenDeep2.lazy = lazy;
|
|
418
|
+
})(flattenDeep || (flattenDeep = {}));
|
|
419
|
+
function forEachObj(...args) {
|
|
420
|
+
return purry(forEachObj_(false), args);
|
|
421
|
+
}
|
|
422
|
+
function forEachObj_(indexed) {
|
|
423
|
+
return (data, fn) => {
|
|
424
|
+
for (const key in data) {
|
|
425
|
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
426
|
+
const { [key]: val } = data;
|
|
427
|
+
if (indexed) {
|
|
428
|
+
fn(val, key, data);
|
|
429
|
+
} else {
|
|
430
|
+
fn(val);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return data;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
((forEachObj2) => {
|
|
438
|
+
function indexed(...args) {
|
|
439
|
+
return purry(forEachObj_(true), args);
|
|
440
|
+
}
|
|
441
|
+
forEachObj2.indexed = indexed;
|
|
442
|
+
})(forEachObj || (forEachObj = {}));
|
|
443
|
+
function forEach(...args) {
|
|
444
|
+
return purry(forEach_(false), args, forEach.lazy);
|
|
445
|
+
}
|
|
446
|
+
function forEach_(indexed) {
|
|
447
|
+
return (array, fn) => _reduceLazy(
|
|
448
|
+
array,
|
|
449
|
+
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
450
|
+
indexed
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
function lazy_$2(indexed) {
|
|
454
|
+
return (fn) => (value, index, array) => {
|
|
455
|
+
if (indexed) {
|
|
456
|
+
fn(value, index, array);
|
|
457
|
+
} else {
|
|
458
|
+
fn(value);
|
|
459
|
+
}
|
|
460
|
+
return {
|
|
461
|
+
done: false,
|
|
462
|
+
hasNext: true,
|
|
463
|
+
next: value
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
((forEach2) => {
|
|
468
|
+
function indexed(...args) {
|
|
469
|
+
return purry(forEach_(true), args, forEach2.lazyIndexed);
|
|
470
|
+
}
|
|
471
|
+
forEach2.indexed = indexed;
|
|
472
|
+
forEach2.lazy = lazy_$2(false);
|
|
473
|
+
forEach2.lazyIndexed = _toLazyIndexed(lazy_$2(true));
|
|
474
|
+
})(forEach || (forEach = {}));
|
|
475
|
+
function fromEntries(...args) {
|
|
476
|
+
return purry(fromEntriesImplementation, args);
|
|
477
|
+
}
|
|
478
|
+
function fromEntriesImplementation(entries2) {
|
|
479
|
+
const out = {};
|
|
480
|
+
for (const [key, value] of entries2) {
|
|
481
|
+
out[key] = value;
|
|
482
|
+
}
|
|
483
|
+
return out;
|
|
484
|
+
}
|
|
485
|
+
((fromEntries2) => {
|
|
486
|
+
fromEntries2.strict = fromEntries2;
|
|
487
|
+
})(fromEntries || (fromEntries = {}));
|
|
488
|
+
function groupBy(...args) {
|
|
489
|
+
return purry(groupBy_(false), args);
|
|
490
|
+
}
|
|
491
|
+
function groupBy_(indexed) {
|
|
492
|
+
return (array, fn) => {
|
|
493
|
+
const ret = {};
|
|
494
|
+
for (const [index, item] of array.entries()) {
|
|
495
|
+
const key = indexed ? fn(item, index, array) : fn(item);
|
|
496
|
+
if (key !== void 0) {
|
|
497
|
+
const actualKey = String(key);
|
|
498
|
+
let items = ret[actualKey];
|
|
499
|
+
if (items === void 0) {
|
|
500
|
+
items = [];
|
|
501
|
+
ret[actualKey] = items;
|
|
502
|
+
}
|
|
503
|
+
items.push(item);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return ret;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
((groupBy2) => {
|
|
510
|
+
function indexed(...args) {
|
|
511
|
+
return purry(groupBy_(true), args);
|
|
512
|
+
}
|
|
513
|
+
groupBy2.indexed = indexed;
|
|
514
|
+
groupBy2.strict = groupBy2;
|
|
515
|
+
})(groupBy || (groupBy = {}));
|
|
516
|
+
function indexBy(...args) {
|
|
517
|
+
return purry(indexBy_(false), args);
|
|
518
|
+
}
|
|
519
|
+
function indexBy_(indexed) {
|
|
520
|
+
return (array, fn) => {
|
|
521
|
+
const out = {};
|
|
522
|
+
for (const [index, item] of array.entries()) {
|
|
523
|
+
const value = indexed ? fn(item, index, array) : fn(item);
|
|
524
|
+
const key = String(value);
|
|
525
|
+
out[key] = item;
|
|
526
|
+
}
|
|
527
|
+
return out;
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
function indexByStrict(...args) {
|
|
531
|
+
return purry(indexByStrict_, args);
|
|
532
|
+
}
|
|
533
|
+
function indexByStrict_(array, fn) {
|
|
534
|
+
const out = {};
|
|
535
|
+
for (const item of array) {
|
|
536
|
+
const key = fn(item);
|
|
537
|
+
out[key] = item;
|
|
538
|
+
}
|
|
539
|
+
return out;
|
|
540
|
+
}
|
|
541
|
+
((indexBy2) => {
|
|
542
|
+
function indexed(...args) {
|
|
543
|
+
return purry(indexBy_(true), args);
|
|
544
|
+
}
|
|
545
|
+
indexBy2.indexed = indexed;
|
|
546
|
+
indexBy2.strict = indexByStrict;
|
|
547
|
+
})(indexBy || (indexBy = {}));
|
|
548
|
+
function intersectionWith(...args) {
|
|
549
|
+
return purry(intersectionWith_, args, intersectionWith.lazy);
|
|
550
|
+
}
|
|
551
|
+
function intersectionWith_(array, other, comparator) {
|
|
552
|
+
const lazy = intersectionWith.lazy(other, comparator);
|
|
553
|
+
return _reduceLazy(array, lazy);
|
|
554
|
+
}
|
|
555
|
+
((intersectionWith2) => {
|
|
556
|
+
function lazy(other, comparator) {
|
|
557
|
+
return (value) => other.some((otherValue) => comparator(value, otherValue)) ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
558
|
+
}
|
|
559
|
+
intersectionWith2.lazy = lazy;
|
|
560
|
+
})(intersectionWith || (intersectionWith = {}));
|
|
94
561
|
function isBoolean(data) {
|
|
95
562
|
return typeof data === "boolean";
|
|
96
563
|
}
|
|
97
|
-
|
|
98
|
-
|
|
564
|
+
function isDefined(data) {
|
|
565
|
+
return data !== void 0 && data !== null;
|
|
566
|
+
}
|
|
567
|
+
((isDefined2) => {
|
|
568
|
+
function strict(data) {
|
|
569
|
+
return data !== void 0;
|
|
570
|
+
}
|
|
571
|
+
isDefined2.strict = strict;
|
|
572
|
+
})(isDefined || (isDefined = {}));
|
|
99
573
|
function isObject(data) {
|
|
100
574
|
if (typeof data !== "object" || data === null) {
|
|
101
575
|
return false;
|
|
102
576
|
}
|
|
103
|
-
const proto = Object.getPrototypeOf(data);
|
|
104
|
-
return proto === null || proto === Object.prototype;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
577
|
+
const proto = Object.getPrototypeOf(data);
|
|
578
|
+
return proto === null || proto === Object.prototype;
|
|
579
|
+
}
|
|
580
|
+
function keys(...args) {
|
|
581
|
+
return purry(Object.keys, args);
|
|
582
|
+
}
|
|
583
|
+
((keys2) => {
|
|
584
|
+
keys2.strict = keys2;
|
|
585
|
+
})(keys || (keys = {}));
|
|
586
|
+
function mapToObj(...args) {
|
|
587
|
+
return purry(mapToObj_(false), args);
|
|
588
|
+
}
|
|
589
|
+
function mapToObj_(indexed) {
|
|
590
|
+
return (array, fn) => {
|
|
591
|
+
const out = {};
|
|
592
|
+
for (const [index, element] of array.entries()) {
|
|
593
|
+
const [key, value] = indexed ? fn(element, index, array) : fn(element);
|
|
594
|
+
out[key] = value;
|
|
595
|
+
}
|
|
596
|
+
return out;
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
((mapToObj2) => {
|
|
600
|
+
function indexed(...args) {
|
|
601
|
+
return purry(mapToObj_(true), args);
|
|
602
|
+
}
|
|
603
|
+
mapToObj2.indexed = indexed;
|
|
604
|
+
})(mapToObj || (mapToObj = {}));
|
|
605
|
+
function map(...args) {
|
|
606
|
+
return purry(map_(false), args, map.lazy);
|
|
607
|
+
}
|
|
608
|
+
function map_(indexed) {
|
|
609
|
+
return (array, fn) => {
|
|
610
|
+
return _reduceLazy(
|
|
611
|
+
array,
|
|
612
|
+
indexed ? map.lazyIndexed(fn) : map.lazy(fn),
|
|
613
|
+
indexed
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function lazy_$1(indexed) {
|
|
618
|
+
return (fn) => (value, index, array) => ({
|
|
619
|
+
done: false,
|
|
620
|
+
hasNext: true,
|
|
621
|
+
next: indexed ? fn(value, index, array) : fn(value)
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
((map2) => {
|
|
625
|
+
function indexed(...args) {
|
|
626
|
+
return purry(map_(true), args, map2.lazyIndexed);
|
|
627
|
+
}
|
|
628
|
+
map2.indexed = indexed;
|
|
629
|
+
map2.lazy = lazy_$1(false);
|
|
630
|
+
map2.lazyIndexed = _toLazyIndexed(lazy_$1(true));
|
|
631
|
+
map2.strict = map2;
|
|
632
|
+
})(map || (map = {}));
|
|
633
|
+
function meanBy_(indexed) {
|
|
634
|
+
return (array, fn) => {
|
|
635
|
+
if (array.length === 0) {
|
|
636
|
+
return Number.NaN;
|
|
637
|
+
}
|
|
638
|
+
let sum = 0;
|
|
639
|
+
for (const [index, item] of array.entries()) {
|
|
640
|
+
sum += indexed ? fn(item, index, array) : fn(item);
|
|
641
|
+
}
|
|
642
|
+
return sum / array.length;
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function meanBy(...args) {
|
|
646
|
+
return purry(meanBy_(false), args);
|
|
647
|
+
}
|
|
648
|
+
((meanBy2) => {
|
|
649
|
+
function indexed(...args) {
|
|
650
|
+
return purry(meanBy_(true), args);
|
|
651
|
+
}
|
|
652
|
+
meanBy2.indexed = indexed;
|
|
653
|
+
})(meanBy || (meanBy = {}));
|
|
654
|
+
function partition(...args) {
|
|
655
|
+
return purry(partition_(false), args);
|
|
656
|
+
}
|
|
657
|
+
function partition_(indexed) {
|
|
658
|
+
return (array, fn) => {
|
|
659
|
+
const ret = [[], []];
|
|
660
|
+
for (const [index, item] of array.entries()) {
|
|
661
|
+
const matches = indexed ? fn(item, index, array) : fn(item);
|
|
662
|
+
ret[matches ? 0 : 1].push(item);
|
|
663
|
+
}
|
|
664
|
+
return ret;
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
((partition2) => {
|
|
668
|
+
function indexed(...args) {
|
|
669
|
+
return purry(partition_(true), args);
|
|
670
|
+
}
|
|
671
|
+
partition2.indexed = indexed;
|
|
672
|
+
})(partition || (partition = {}));
|
|
673
|
+
function reduce(...args) {
|
|
674
|
+
return purry(reduce_(false), args);
|
|
675
|
+
}
|
|
676
|
+
function reduce_(indexed) {
|
|
677
|
+
return (items, fn, initialValue) => {
|
|
678
|
+
return items.reduce(
|
|
679
|
+
(acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
|
|
680
|
+
initialValue
|
|
681
|
+
);
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
((reduce2) => {
|
|
685
|
+
function indexed(...args) {
|
|
686
|
+
return purry(reduce_(true), args);
|
|
687
|
+
}
|
|
688
|
+
reduce2.indexed = indexed;
|
|
689
|
+
})(reduce || (reduce = {}));
|
|
690
|
+
function sortBy(...args) {
|
|
691
|
+
return purryOrderRules(_sortBy, args);
|
|
692
|
+
}
|
|
693
|
+
function _sortBy(data, compareFn) {
|
|
694
|
+
return data.slice().sort(compareFn);
|
|
695
|
+
}
|
|
696
|
+
((sortBy2) => {
|
|
697
|
+
sortBy2.strict = sortBy2;
|
|
698
|
+
})(sortBy || (sortBy = {}));
|
|
699
|
+
function sort(...args) {
|
|
700
|
+
return purry(sort_, args);
|
|
701
|
+
}
|
|
702
|
+
function sort_(items, cmp) {
|
|
703
|
+
const ret = items.slice();
|
|
704
|
+
ret.sort(cmp);
|
|
705
|
+
return ret;
|
|
706
|
+
}
|
|
707
|
+
((sort2) => {
|
|
708
|
+
sort2.strict = sort2;
|
|
709
|
+
})(sort || (sort = {}));
|
|
710
|
+
function _binarySearchCutoffIndex(array, predicate) {
|
|
711
|
+
let lowIndex = 0;
|
|
712
|
+
let highIndex = array.length;
|
|
713
|
+
while (lowIndex < highIndex) {
|
|
714
|
+
const pivotIndex = lowIndex + highIndex >>> 1;
|
|
715
|
+
const pivot = array[pivotIndex];
|
|
716
|
+
if (predicate(pivot, pivotIndex)) {
|
|
717
|
+
lowIndex = pivotIndex + 1;
|
|
718
|
+
} else {
|
|
719
|
+
highIndex = pivotIndex;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return highIndex;
|
|
723
|
+
}
|
|
724
|
+
function sortedIndexBy(...args) {
|
|
725
|
+
return purry(sortedIndexByImplementation, args);
|
|
726
|
+
}
|
|
727
|
+
((sortedIndexBy2) => {
|
|
728
|
+
function indexed(...args) {
|
|
729
|
+
return purry(sortedIndexByImplementation, args);
|
|
730
|
+
}
|
|
731
|
+
sortedIndexBy2.indexed = indexed;
|
|
732
|
+
})(sortedIndexBy || (sortedIndexBy = {}));
|
|
733
|
+
function sortedIndexByImplementation(array, item, valueFunction) {
|
|
734
|
+
const value = valueFunction(item);
|
|
735
|
+
return _binarySearchCutoffIndex(
|
|
736
|
+
array,
|
|
737
|
+
(pivot, index) => valueFunction(pivot, index) < value
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
function sortedIndexWith(...args) {
|
|
741
|
+
return purry(_binarySearchCutoffIndex, args);
|
|
742
|
+
}
|
|
743
|
+
((sortedIndexWith2) => {
|
|
744
|
+
function indexed(...args) {
|
|
745
|
+
return purry(_binarySearchCutoffIndex, args);
|
|
746
|
+
}
|
|
747
|
+
sortedIndexWith2.indexed = indexed;
|
|
748
|
+
})(sortedIndexWith || (sortedIndexWith = {}));
|
|
749
|
+
function sortedLastIndexBy(...args) {
|
|
750
|
+
return purry(sortedLastIndexByImplementation, args);
|
|
751
|
+
}
|
|
752
|
+
((sortedLastIndexBy2) => {
|
|
753
|
+
function indexed(...args) {
|
|
754
|
+
return purry(sortedLastIndexByImplementation, args);
|
|
755
|
+
}
|
|
756
|
+
sortedLastIndexBy2.indexed = indexed;
|
|
757
|
+
})(sortedLastIndexBy || (sortedLastIndexBy = {}));
|
|
758
|
+
function sortedLastIndexByImplementation(array, item, valueFunction) {
|
|
759
|
+
const value = valueFunction(item);
|
|
760
|
+
return _binarySearchCutoffIndex(
|
|
761
|
+
array,
|
|
762
|
+
// The only difference between the regular implementation and the "last"
|
|
763
|
+
// variation is that we consider the pivot with equality too, so that we
|
|
764
|
+
// skip all equal values in addition to the lower ones.
|
|
765
|
+
(pivot, index) => valueFunction(pivot, index) <= value
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
function sumBy_(indexed) {
|
|
769
|
+
return (array, fn) => {
|
|
770
|
+
let sum = 0;
|
|
771
|
+
for (const [index, item] of array.entries()) {
|
|
772
|
+
const summand = indexed ? fn(item, index, array) : fn(item);
|
|
773
|
+
sum += summand;
|
|
774
|
+
}
|
|
775
|
+
return sum;
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
function sumBy(...args) {
|
|
779
|
+
return purry(sumBy_(false), args);
|
|
780
|
+
}
|
|
781
|
+
((sumBy2) => {
|
|
782
|
+
function indexed(...args) {
|
|
783
|
+
return purry(sumBy_(true), args);
|
|
784
|
+
}
|
|
785
|
+
sumBy2.indexed = indexed;
|
|
786
|
+
})(sumBy || (sumBy = {}));
|
|
787
|
+
function take(...args) {
|
|
788
|
+
return purry(take_, args, take.lazy);
|
|
789
|
+
}
|
|
790
|
+
function take_(array, n) {
|
|
791
|
+
return _reduceLazy(array, take.lazy(n));
|
|
792
|
+
}
|
|
793
|
+
((take2) => {
|
|
794
|
+
function lazy(n) {
|
|
795
|
+
if (n <= 0) {
|
|
796
|
+
return () => ({ done: true, hasNext: false });
|
|
797
|
+
}
|
|
798
|
+
let remaining = n;
|
|
799
|
+
return (value) => {
|
|
800
|
+
remaining -= 1;
|
|
801
|
+
return { done: remaining <= 0, hasNext: true, next: value };
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
take2.lazy = lazy;
|
|
805
|
+
})(take || (take = {}));
|
|
806
|
+
function uniqueWith(...args) {
|
|
807
|
+
return purry(uniqueWithImplementation, args, uniqueWith.lazy);
|
|
808
|
+
}
|
|
809
|
+
function uniqueWithImplementation(array, isEquals) {
|
|
810
|
+
const lazy = uniqueWith.lazy(isEquals);
|
|
811
|
+
return _reduceLazy(array, lazy, true);
|
|
812
|
+
}
|
|
813
|
+
function lazy_(isEquals) {
|
|
814
|
+
return (value, index, array) => array !== void 0 && array.findIndex((otherValue) => isEquals(value, otherValue)) === index ? { done: false, hasNext: true, next: value } : { done: false, hasNext: false };
|
|
815
|
+
}
|
|
816
|
+
((uniqueWith2) => {
|
|
817
|
+
uniqueWith2.lazy = _toLazyIndexed(lazy_);
|
|
818
|
+
})(uniqueWith || (uniqueWith = {}));
|
|
819
|
+
function unique(...args) {
|
|
820
|
+
return purry(uniqueImplementation, args, unique.lazy);
|
|
821
|
+
}
|
|
822
|
+
function uniqueImplementation(array) {
|
|
823
|
+
return _reduceLazy(array, unique.lazy());
|
|
824
|
+
}
|
|
825
|
+
((unique2) => {
|
|
826
|
+
function lazy() {
|
|
827
|
+
const set = /* @__PURE__ */ new Set();
|
|
828
|
+
return (value) => {
|
|
829
|
+
if (set.has(value)) {
|
|
830
|
+
return { done: false, hasNext: false };
|
|
831
|
+
}
|
|
832
|
+
set.add(value);
|
|
833
|
+
return { done: false, hasNext: true, next: value };
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
unique2.lazy = lazy;
|
|
837
|
+
})(unique || (unique = {}));
|
|
838
|
+
function zip(...args) {
|
|
839
|
+
return purry(zip_, args);
|
|
840
|
+
}
|
|
841
|
+
function zip_(first2, second) {
|
|
842
|
+
const resultLength = first2.length > second.length ? second.length : first2.length;
|
|
843
|
+
const result = [];
|
|
844
|
+
for (let i = 0; i < resultLength; i++) {
|
|
845
|
+
result.push([first2[i], second[i]]);
|
|
846
|
+
}
|
|
847
|
+
return result;
|
|
848
|
+
}
|
|
849
|
+
((zip2) => {
|
|
850
|
+
zip2.strict = zip2;
|
|
851
|
+
})(zip || (zip = {}));
|
|
852
|
+
|
|
853
|
+
// src/base.ts
|
|
854
|
+
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
855
|
+
var import_local_pkg = require("local-pkg");
|
|
856
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
857
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
858
|
+
|
|
859
|
+
// src/flags.ts
|
|
860
|
+
var ERROR = "error";
|
|
861
|
+
var OFF = "off";
|
|
862
|
+
var WARN = "warn";
|
|
863
|
+
var CONSISTENT = "consistent";
|
|
864
|
+
var NEVER = "never";
|
|
865
|
+
var ALWAYS = "always";
|
|
866
|
+
|
|
867
|
+
// src/plugins.ts
|
|
868
|
+
var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
|
|
869
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
870
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
871
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
872
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
873
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
874
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
875
|
+
|
|
876
|
+
// src/configs/comments.ts
|
|
877
|
+
async function comments() {
|
|
878
|
+
return [
|
|
879
|
+
{
|
|
880
|
+
name: "vinicunca:eslint-comments",
|
|
881
|
+
plugins: {
|
|
882
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
883
|
+
},
|
|
884
|
+
rules: {
|
|
885
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
886
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
887
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
888
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
];
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// src/globs.ts
|
|
895
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
896
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
897
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
898
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
899
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
900
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
901
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
902
|
+
var GLOB_CSS = "**/*.css";
|
|
903
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
904
|
+
var GLOB_LESS = "**/*.less";
|
|
905
|
+
var GLOB_SCSS = "**/*.scss";
|
|
906
|
+
var GLOB_JSON = "**/*.json";
|
|
907
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
908
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
909
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
910
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
911
|
+
var GLOB_VUE = "**/*.vue";
|
|
912
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
913
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
914
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
915
|
+
var GLOB_TESTS = [
|
|
916
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
917
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
918
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
919
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
920
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
921
|
+
];
|
|
922
|
+
var GLOB_ALL_SRC = [
|
|
923
|
+
GLOB_SRC,
|
|
924
|
+
GLOB_STYLE,
|
|
925
|
+
GLOB_JSON,
|
|
926
|
+
GLOB_JSON5,
|
|
927
|
+
GLOB_MARKDOWN,
|
|
928
|
+
GLOB_VUE,
|
|
929
|
+
GLOB_YAML,
|
|
930
|
+
GLOB_HTML
|
|
931
|
+
];
|
|
932
|
+
var GLOB_EXCLUDE = [
|
|
933
|
+
"**/node_modules",
|
|
934
|
+
"**/dist",
|
|
935
|
+
"**/package-lock.json",
|
|
936
|
+
"**/yarn.lock",
|
|
937
|
+
"**/pnpm-lock.yaml",
|
|
938
|
+
"**/bun.lockb",
|
|
939
|
+
"**/output",
|
|
940
|
+
"**/coverage",
|
|
941
|
+
"**/temp",
|
|
942
|
+
"**/.temp",
|
|
943
|
+
"**/tmp",
|
|
944
|
+
"**/.tmp",
|
|
945
|
+
"**/.history",
|
|
946
|
+
"**/.vitepress/cache",
|
|
947
|
+
"**/.nuxt",
|
|
948
|
+
"**/.next",
|
|
949
|
+
"**/.vercel",
|
|
950
|
+
"**/.changeset",
|
|
951
|
+
"**/.idea",
|
|
952
|
+
"**/.cache",
|
|
953
|
+
"**/.output",
|
|
954
|
+
"**/.vite-inspect",
|
|
955
|
+
"**/CHANGELOG*.md",
|
|
956
|
+
"**/*.min.*",
|
|
957
|
+
"**/LICENSE*",
|
|
958
|
+
"**/__snapshots__",
|
|
959
|
+
"**/auto-import?(s).d.ts",
|
|
960
|
+
"**/components.d.ts"
|
|
961
|
+
];
|
|
962
|
+
|
|
963
|
+
// src/utils.ts
|
|
964
|
+
async function combineConfigs(...configs) {
|
|
965
|
+
const resolved = await Promise.all(configs);
|
|
966
|
+
return resolved.flat();
|
|
967
|
+
}
|
|
968
|
+
function renameRules(rules, map2) {
|
|
969
|
+
return Object.fromEntries(
|
|
970
|
+
Object.entries(rules).map(([key, value]) => {
|
|
971
|
+
for (const [from, to] of Object.entries(map2)) {
|
|
972
|
+
if (key.startsWith(`${from}/`)) {
|
|
973
|
+
return [to + key.slice(from.length), value];
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return [key, value];
|
|
977
|
+
})
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
function renamePluginInConfigs(configs, map2) {
|
|
981
|
+
return configs.map((i) => {
|
|
982
|
+
const clone = { ...i };
|
|
983
|
+
if (clone.rules) {
|
|
984
|
+
clone.rules = renameRules(clone.rules, map2);
|
|
985
|
+
}
|
|
986
|
+
if (clone.plugins) {
|
|
987
|
+
clone.plugins = Object.fromEntries(
|
|
988
|
+
Object.entries(clone.plugins).map(([key, value]) => {
|
|
989
|
+
if (key in map2) {
|
|
990
|
+
return [map2[key], value];
|
|
991
|
+
}
|
|
992
|
+
return [key, value];
|
|
993
|
+
})
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
return clone;
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
async function interopDefault(m) {
|
|
1000
|
+
const resolved = await m;
|
|
1001
|
+
return resolved.default || resolved;
|
|
1002
|
+
}
|
|
1003
|
+
var parserPlain = {
|
|
1004
|
+
meta: {
|
|
1005
|
+
name: "parser-plain"
|
|
1006
|
+
},
|
|
1007
|
+
parseForESLint: (code) => ({
|
|
1008
|
+
ast: {
|
|
1009
|
+
body: [],
|
|
1010
|
+
comments: [],
|
|
1011
|
+
loc: { end: code.length, start: 0 },
|
|
1012
|
+
range: [0, code.length],
|
|
1013
|
+
tokens: [],
|
|
1014
|
+
type: "Program"
|
|
1015
|
+
},
|
|
1016
|
+
scopeManager: null,
|
|
1017
|
+
services: { isPlain: true },
|
|
1018
|
+
visitorKeys: {
|
|
1019
|
+
Program: []
|
|
1020
|
+
}
|
|
1021
|
+
})
|
|
1022
|
+
};
|
|
1023
|
+
function toArray(value) {
|
|
1024
|
+
return Array.isArray(value) ? value : [value];
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// src/configs/stylistic.ts
|
|
1028
|
+
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
1029
|
+
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
1030
|
+
indent: 2,
|
|
1031
|
+
jsx: true,
|
|
1032
|
+
quotes: "single",
|
|
1033
|
+
semi: true
|
|
1034
|
+
};
|
|
1035
|
+
async function stylistic(options = {}) {
|
|
1036
|
+
const {
|
|
1037
|
+
indent,
|
|
1038
|
+
jsx,
|
|
1039
|
+
overrides = {},
|
|
1040
|
+
quotes,
|
|
1041
|
+
semi
|
|
1042
|
+
} = {
|
|
1043
|
+
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1044
|
+
...options
|
|
1045
|
+
};
|
|
1046
|
+
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
1047
|
+
const config = pluginStylistic.configs.customize({
|
|
1048
|
+
flat: true,
|
|
1049
|
+
indent,
|
|
1050
|
+
jsx,
|
|
1051
|
+
pluginName: "style",
|
|
1052
|
+
quotes,
|
|
1053
|
+
semi
|
|
1054
|
+
});
|
|
1055
|
+
return [
|
|
1056
|
+
{
|
|
1057
|
+
name: "vinicunca:stylistic",
|
|
1058
|
+
plugins: {
|
|
1059
|
+
style: pluginStylistic,
|
|
1060
|
+
vinicunca: import_eslint_plugin_vinicunca.default
|
|
1061
|
+
},
|
|
1062
|
+
rules: {
|
|
1063
|
+
...config.rules,
|
|
1064
|
+
"curly": [ERROR, "all"],
|
|
1065
|
+
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
1066
|
+
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
1067
|
+
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
1068
|
+
"style/arrow-parens": [ERROR, ALWAYS],
|
|
1069
|
+
"style/brace-style": [ERROR],
|
|
1070
|
+
"style/func-call-spacing": [ERROR, NEVER],
|
|
1071
|
+
"style/jsx-child-element-spacing": OFF,
|
|
1072
|
+
"style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
|
|
1073
|
+
"style/jsx-closing-tag-location": ERROR,
|
|
1074
|
+
"style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
|
|
1075
|
+
"style/jsx-curly-newline": [ERROR, {
|
|
1076
|
+
multiline: "consistent",
|
|
1077
|
+
singleline: "consistent"
|
|
1078
|
+
}],
|
|
1079
|
+
"style/jsx-curly-spacing": [ERROR, {
|
|
1080
|
+
children: true,
|
|
1081
|
+
spacing: {
|
|
1082
|
+
objectLiterals: NEVER
|
|
1083
|
+
},
|
|
1084
|
+
when: "always"
|
|
1085
|
+
}],
|
|
1086
|
+
"style/jsx-equals-spacing": [ERROR, NEVER],
|
|
1087
|
+
"style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
|
|
1088
|
+
"style/jsx-indent": [ERROR, 2],
|
|
1089
|
+
"style/jsx-indent-props": [ERROR, 2],
|
|
1090
|
+
"style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
|
|
1091
|
+
"style/jsx-newline": ERROR,
|
|
1092
|
+
"style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
|
|
1093
|
+
"style/jsx-props-no-multi-spaces": ERROR,
|
|
1094
|
+
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
|
|
1095
|
+
"style/jsx-sort-props": [OFF],
|
|
1096
|
+
"style/jsx-tag-spacing": [ERROR, {
|
|
1097
|
+
afterOpening: NEVER,
|
|
1098
|
+
beforeClosing: NEVER,
|
|
1099
|
+
beforeSelfClosing: "always",
|
|
1100
|
+
closingSlash: NEVER
|
|
1101
|
+
}],
|
|
1102
|
+
"style/jsx-wrap-multilines": [ERROR, {
|
|
1103
|
+
arrow: STR_PARENS_NEW_LINE,
|
|
1104
|
+
assignment: STR_PARENS_NEW_LINE,
|
|
1105
|
+
condition: STR_PARENS_NEW_LINE,
|
|
1106
|
+
declaration: STR_PARENS_NEW_LINE,
|
|
1107
|
+
logical: STR_PARENS_NEW_LINE,
|
|
1108
|
+
prop: STR_PARENS_NEW_LINE,
|
|
1109
|
+
return: STR_PARENS_NEW_LINE
|
|
1110
|
+
}],
|
|
1111
|
+
"style/member-delimiter-style": [ERROR],
|
|
1112
|
+
"style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
1113
|
+
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
1114
|
+
"style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
1115
|
+
"style/operator-linebreak": [ERROR, "before"],
|
|
1116
|
+
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
1117
|
+
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
1118
|
+
"style/quotes": [ERROR, quotes],
|
|
1119
|
+
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
1120
|
+
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
1121
|
+
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
1122
|
+
"vinicunca/consistent-list-newline": ERROR,
|
|
1123
|
+
"vinicunca/if-newline": ERROR,
|
|
1124
|
+
"vinicunca/top-level-function": ERROR,
|
|
1125
|
+
...overrides
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
1130
|
+
rules: {
|
|
1131
|
+
"vinicunca/consistent-list-newline": OFF
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
];
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// src/configs/formatters.ts
|
|
1138
|
+
async function formatters(options = {}, stylistic2 = {}) {
|
|
1139
|
+
if (options === true) {
|
|
1140
|
+
options = {
|
|
1141
|
+
css: true,
|
|
1142
|
+
graphql: true,
|
|
1143
|
+
html: true,
|
|
1144
|
+
markdown: true
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
const {
|
|
1148
|
+
indent,
|
|
1149
|
+
quotes,
|
|
1150
|
+
semi
|
|
1151
|
+
} = {
|
|
1152
|
+
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1153
|
+
...stylistic2
|
|
1154
|
+
};
|
|
1155
|
+
const prettierOptions = Object.assign(
|
|
1156
|
+
{
|
|
1157
|
+
endOfLine: "auto",
|
|
1158
|
+
semi,
|
|
1159
|
+
singleQuote: quotes === "single",
|
|
1160
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
1161
|
+
trailingComma: "all",
|
|
1162
|
+
useTabs: indent === "tab"
|
|
1163
|
+
},
|
|
1164
|
+
options.prettierOptions || {}
|
|
1165
|
+
);
|
|
1166
|
+
const dprintOptions = Object.assign(
|
|
1167
|
+
{
|
|
1168
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
1169
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
1170
|
+
useTabs: indent === "tab"
|
|
1171
|
+
},
|
|
1172
|
+
options.dprintOptions || {}
|
|
1173
|
+
);
|
|
1174
|
+
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
1175
|
+
const configs = [
|
|
1176
|
+
{
|
|
1177
|
+
name: "vinicunca:formatters:setup",
|
|
1178
|
+
plugins: {
|
|
1179
|
+
format: pluginFormat
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
];
|
|
1183
|
+
if (options.css) {
|
|
1184
|
+
configs.push(
|
|
1185
|
+
{
|
|
1186
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1187
|
+
languageOptions: {
|
|
1188
|
+
parser: parserPlain
|
|
1189
|
+
},
|
|
1190
|
+
name: "vinicunca:formatters:css",
|
|
1191
|
+
rules: {
|
|
1192
|
+
"format/prettier": [
|
|
1193
|
+
"error",
|
|
1194
|
+
{
|
|
1195
|
+
...prettierOptions,
|
|
1196
|
+
parser: "css"
|
|
1197
|
+
}
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
files: [GLOB_SCSS],
|
|
1203
|
+
languageOptions: {
|
|
1204
|
+
parser: parserPlain
|
|
1205
|
+
},
|
|
1206
|
+
name: "vinicunca:formatters:scss",
|
|
1207
|
+
rules: {
|
|
1208
|
+
"format/prettier": [
|
|
1209
|
+
"error",
|
|
1210
|
+
{
|
|
1211
|
+
...prettierOptions,
|
|
1212
|
+
parser: "scss"
|
|
1213
|
+
}
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
files: [GLOB_LESS],
|
|
1219
|
+
languageOptions: {
|
|
1220
|
+
parser: parserPlain
|
|
1221
|
+
},
|
|
1222
|
+
name: "vinicunca:formatters:less",
|
|
1223
|
+
rules: {
|
|
1224
|
+
"format/prettier": [
|
|
1225
|
+
"error",
|
|
1226
|
+
{
|
|
1227
|
+
...prettierOptions,
|
|
1228
|
+
parser: "less"
|
|
1229
|
+
}
|
|
1230
|
+
]
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
);
|
|
1234
|
+
}
|
|
1235
|
+
if (options.html) {
|
|
1236
|
+
configs.push({
|
|
1237
|
+
files: ["**/*.html"],
|
|
1238
|
+
languageOptions: {
|
|
1239
|
+
parser: parserPlain
|
|
136
1240
|
},
|
|
1241
|
+
name: "vinicunca:formatters:html",
|
|
137
1242
|
rules: {
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
1243
|
+
"format/prettier": [
|
|
1244
|
+
"error",
|
|
1245
|
+
{
|
|
1246
|
+
...prettierOptions,
|
|
1247
|
+
parser: "html"
|
|
1248
|
+
}
|
|
1249
|
+
]
|
|
142
1250
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
if (options.markdown) {
|
|
1254
|
+
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
1255
|
+
configs.push({
|
|
1256
|
+
files: [GLOB_MARKDOWN],
|
|
1257
|
+
languageOptions: {
|
|
1258
|
+
parser: parserPlain
|
|
1259
|
+
},
|
|
1260
|
+
name: "vinicunca:formatters:markdown",
|
|
1261
|
+
rules: {
|
|
1262
|
+
[`format/${formater}`]: [
|
|
1263
|
+
"error",
|
|
1264
|
+
formater === "prettier" ? {
|
|
1265
|
+
printWidth: 120,
|
|
1266
|
+
...prettierOptions,
|
|
1267
|
+
embeddedLanguageFormatting: "off",
|
|
1268
|
+
parser: "markdown"
|
|
1269
|
+
} : {
|
|
1270
|
+
...dprintOptions,
|
|
1271
|
+
language: "markdown"
|
|
1272
|
+
}
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
if (options.graphql) {
|
|
1278
|
+
configs.push({
|
|
1279
|
+
files: ["**/*.graphql"],
|
|
1280
|
+
languageOptions: {
|
|
1281
|
+
parser: parserPlain
|
|
1282
|
+
},
|
|
1283
|
+
name: "vinicunca:formatters:graphql",
|
|
1284
|
+
rules: {
|
|
1285
|
+
"format/prettier": [
|
|
1286
|
+
"error",
|
|
1287
|
+
{
|
|
1288
|
+
...prettierOptions,
|
|
1289
|
+
parser: "graphql"
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
return configs;
|
|
145
1296
|
}
|
|
146
1297
|
|
|
147
|
-
// src/globs.ts
|
|
148
|
-
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
149
|
-
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
150
|
-
var GLOB_JS = "**/*.?([cm])js";
|
|
151
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
152
|
-
var GLOB_TS = "**/*.?([cm])ts";
|
|
153
|
-
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
154
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
155
|
-
var GLOB_CSS = "**/*.css";
|
|
156
|
-
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
157
|
-
var GLOB_LESS = "**/*.less";
|
|
158
|
-
var GLOB_SCSS = "**/*.scss";
|
|
159
|
-
var GLOB_JSON = "**/*.json";
|
|
160
|
-
var GLOB_JSON5 = "**/*.json5";
|
|
161
|
-
var GLOB_JSONC = "**/*.jsonc";
|
|
162
|
-
var GLOB_MARKDOWN = "**/*.md";
|
|
163
|
-
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
164
|
-
var GLOB_VUE = "**/*.vue";
|
|
165
|
-
var GLOB_YAML = "**/*.y?(a)ml";
|
|
166
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
167
|
-
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
168
|
-
var GLOB_TESTS = [
|
|
169
|
-
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
170
|
-
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
171
|
-
`**/*.test.${GLOB_SRC_EXT}`,
|
|
172
|
-
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
173
|
-
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
174
|
-
];
|
|
175
|
-
var GLOB_ALL_SRC = [
|
|
176
|
-
GLOB_SRC,
|
|
177
|
-
GLOB_STYLE,
|
|
178
|
-
GLOB_JSON,
|
|
179
|
-
GLOB_JSON5,
|
|
180
|
-
GLOB_MARKDOWN,
|
|
181
|
-
GLOB_VUE,
|
|
182
|
-
GLOB_YAML,
|
|
183
|
-
GLOB_HTML
|
|
184
|
-
];
|
|
185
|
-
var GLOB_EXCLUDE = [
|
|
186
|
-
"**/node_modules",
|
|
187
|
-
"**/dist",
|
|
188
|
-
"**/package-lock.json",
|
|
189
|
-
"**/yarn.lock",
|
|
190
|
-
"**/pnpm-lock.yaml",
|
|
191
|
-
"**/bun.lockb",
|
|
192
|
-
"**/output",
|
|
193
|
-
"**/coverage",
|
|
194
|
-
"**/temp",
|
|
195
|
-
"**/.temp",
|
|
196
|
-
"**/tmp",
|
|
197
|
-
"**/.tmp",
|
|
198
|
-
"**/.history",
|
|
199
|
-
"**/.vitepress/cache",
|
|
200
|
-
"**/.nuxt",
|
|
201
|
-
"**/.next",
|
|
202
|
-
"**/.vercel",
|
|
203
|
-
"**/.changeset",
|
|
204
|
-
"**/.idea",
|
|
205
|
-
"**/.cache",
|
|
206
|
-
"**/.output",
|
|
207
|
-
"**/.vite-inspect",
|
|
208
|
-
"**/CHANGELOG*.md",
|
|
209
|
-
"**/*.min.*",
|
|
210
|
-
"**/LICENSE*",
|
|
211
|
-
"**/__snapshots__",
|
|
212
|
-
"**/auto-import?(s).d.ts",
|
|
213
|
-
"**/components.d.ts"
|
|
214
|
-
];
|
|
215
|
-
|
|
216
1298
|
// src/configs/ignores.ts
|
|
217
1299
|
async function ignores() {
|
|
218
1300
|
return [
|
|
@@ -285,7 +1367,6 @@ async function javascript(options = {}) {
|
|
|
285
1367
|
},
|
|
286
1368
|
name: "vinicunca:javascript",
|
|
287
1369
|
plugins: {
|
|
288
|
-
"perfectionist": import_eslint_plugin_perfectionist.default,
|
|
289
1370
|
"unused-imports": import_eslint_plugin_unused_imports.default,
|
|
290
1371
|
"vinicunca": import_eslint_plugin_vinicunca.default
|
|
291
1372
|
},
|
|
@@ -507,106 +1588,18 @@ async function javascript(options = {}) {
|
|
|
507
1588
|
}],
|
|
508
1589
|
"vars-on-top": ERROR,
|
|
509
1590
|
"yoda": [ERROR, NEVER],
|
|
510
|
-
...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
|
|
511
|
-
...
|
|
512
|
-
|
|
513
|
-
ERROR,
|
|
514
|
-
{
|
|
515
|
-
"groups": [
|
|
516
|
-
"type",
|
|
517
|
-
["builtin", "external"],
|
|
518
|
-
"internal-type",
|
|
519
|
-
"internal",
|
|
520
|
-
["parent-type", "sibling-type", "index-type"],
|
|
521
|
-
["parent", "sibling", "index"],
|
|
522
|
-
"object",
|
|
523
|
-
"unknown"
|
|
524
|
-
],
|
|
525
|
-
"internal-pattern": [
|
|
526
|
-
"~/**",
|
|
527
|
-
"~~/**"
|
|
528
|
-
],
|
|
529
|
-
"newlines-between": "always",
|
|
530
|
-
"order": "asc",
|
|
531
|
-
"type": "natural"
|
|
532
|
-
}
|
|
533
|
-
],
|
|
534
|
-
"perfectionist/sort-vue-attributes": [OFF],
|
|
535
|
-
...overrides
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
540
|
-
name: "vinicunca:javascript:overrides",
|
|
541
|
-
rules: {
|
|
542
|
-
"no-console": OFF
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
];
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// src/utils.ts
|
|
549
|
-
async function combineConfigs(...configs) {
|
|
550
|
-
const resolved = await Promise.all(configs);
|
|
551
|
-
return resolved.flat();
|
|
552
|
-
}
|
|
553
|
-
function renameRules(rules, map) {
|
|
554
|
-
return Object.fromEntries(
|
|
555
|
-
Object.entries(rules).map(([key, value]) => {
|
|
556
|
-
for (const [from, to] of Object.entries(map)) {
|
|
557
|
-
if (key.startsWith(`${from}/`)) {
|
|
558
|
-
return [to + key.slice(from.length), value];
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
return [key, value];
|
|
562
|
-
})
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
function renamePluginInConfigs(configs, map) {
|
|
566
|
-
return configs.map((i) => {
|
|
567
|
-
const clone = { ...i };
|
|
568
|
-
if (clone.rules) {
|
|
569
|
-
clone.rules = renameRules(clone.rules, map);
|
|
570
|
-
}
|
|
571
|
-
if (clone.plugins) {
|
|
572
|
-
clone.plugins = Object.fromEntries(
|
|
573
|
-
Object.entries(clone.plugins).map(([key, value]) => {
|
|
574
|
-
if (key in map) {
|
|
575
|
-
return [map[key], value];
|
|
576
|
-
}
|
|
577
|
-
return [key, value];
|
|
578
|
-
})
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
return clone;
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
async function interopDefault(m) {
|
|
585
|
-
const resolved = await m;
|
|
586
|
-
return resolved.default || resolved;
|
|
587
|
-
}
|
|
588
|
-
var parserPlain = {
|
|
589
|
-
meta: {
|
|
590
|
-
name: "parser-plain"
|
|
591
|
-
},
|
|
592
|
-
parseForESLint: (code) => ({
|
|
593
|
-
ast: {
|
|
594
|
-
body: [],
|
|
595
|
-
comments: [],
|
|
596
|
-
loc: { end: code.length, start: 0 },
|
|
597
|
-
range: [0, code.length],
|
|
598
|
-
tokens: [],
|
|
599
|
-
type: "Program"
|
|
1591
|
+
...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
|
|
1592
|
+
...overrides
|
|
1593
|
+
}
|
|
600
1594
|
},
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
1595
|
+
{
|
|
1596
|
+
files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1597
|
+
name: "vinicunca:javascript:overrides",
|
|
1598
|
+
rules: {
|
|
1599
|
+
"no-console": OFF
|
|
1600
|
+
}
|
|
605
1601
|
}
|
|
606
|
-
|
|
607
|
-
};
|
|
608
|
-
function toArray(value) {
|
|
609
|
-
return Array.isArray(value) ? value : [value];
|
|
1602
|
+
];
|
|
610
1603
|
}
|
|
611
1604
|
|
|
612
1605
|
// src/configs/jsdoc.ts
|
|
@@ -843,6 +1836,44 @@ async function node() {
|
|
|
843
1836
|
];
|
|
844
1837
|
}
|
|
845
1838
|
|
|
1839
|
+
// src/configs/perfectionist.ts
|
|
1840
|
+
async function perfectionist() {
|
|
1841
|
+
return [
|
|
1842
|
+
{
|
|
1843
|
+
name: "vinicunca:perfectionist",
|
|
1844
|
+
plugins: {
|
|
1845
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1846
|
+
},
|
|
1847
|
+
rules: {
|
|
1848
|
+
...import_eslint_plugin_perfectionist.default.configs["recommended-natural"].rules,
|
|
1849
|
+
"perfectionist/sort-imports": [
|
|
1850
|
+
ERROR,
|
|
1851
|
+
{
|
|
1852
|
+
"groups": [
|
|
1853
|
+
"type",
|
|
1854
|
+
["builtin", "external"],
|
|
1855
|
+
"internal-type",
|
|
1856
|
+
"internal",
|
|
1857
|
+
["parent-type", "sibling-type", "index-type"],
|
|
1858
|
+
["parent", "sibling", "index"],
|
|
1859
|
+
"object",
|
|
1860
|
+
"unknown"
|
|
1861
|
+
],
|
|
1862
|
+
"internal-pattern": [
|
|
1863
|
+
"~/**",
|
|
1864
|
+
"~~/**"
|
|
1865
|
+
],
|
|
1866
|
+
"newlines-between": "always",
|
|
1867
|
+
"order": "asc",
|
|
1868
|
+
"type": "natural"
|
|
1869
|
+
}
|
|
1870
|
+
],
|
|
1871
|
+
"perfectionist/sort-vue-attributes": [OFF]
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
];
|
|
1875
|
+
}
|
|
1876
|
+
|
|
846
1877
|
// src/configs/react.ts
|
|
847
1878
|
async function react(options = {}) {
|
|
848
1879
|
const {
|
|
@@ -1046,211 +2077,101 @@ function sortTsconfig() {
|
|
|
1046
2077
|
"composite",
|
|
1047
2078
|
"tsBuildInfoFile",
|
|
1048
2079
|
"disableSourceOfProjectReferenceRedirect",
|
|
1049
|
-
"disableSolutionSearching",
|
|
1050
|
-
"disableReferencedProjectLoad",
|
|
1051
|
-
/* Language and Environment */
|
|
1052
|
-
"target",
|
|
1053
|
-
"jsx",
|
|
1054
|
-
"jsxFactory",
|
|
1055
|
-
"jsxFragmentFactory",
|
|
1056
|
-
"jsxImportSource",
|
|
1057
|
-
"lib",
|
|
1058
|
-
"moduleDetection",
|
|
1059
|
-
"noLib",
|
|
1060
|
-
"reactNamespace",
|
|
1061
|
-
"useDefineForClassFields",
|
|
1062
|
-
"emitDecoratorMetadata",
|
|
1063
|
-
"experimentalDecorators",
|
|
1064
|
-
/* Modules */
|
|
1065
|
-
"baseUrl",
|
|
1066
|
-
"rootDir",
|
|
1067
|
-
"rootDirs",
|
|
1068
|
-
"customConditions",
|
|
1069
|
-
"module",
|
|
1070
|
-
"moduleResolution",
|
|
1071
|
-
"moduleSuffixes",
|
|
1072
|
-
"noResolve",
|
|
1073
|
-
"paths",
|
|
1074
|
-
"resolveJsonModule",
|
|
1075
|
-
"resolvePackageJsonExports",
|
|
1076
|
-
"resolvePackageJsonImports",
|
|
1077
|
-
"typeRoots",
|
|
1078
|
-
"types",
|
|
1079
|
-
"allowArbitraryExtensions",
|
|
1080
|
-
"allowImportingTsExtensions",
|
|
1081
|
-
"allowUmdGlobalAccess",
|
|
1082
|
-
/* JavaScript Support */
|
|
1083
|
-
"allowJs",
|
|
1084
|
-
"checkJs",
|
|
1085
|
-
"maxNodeModuleJsDepth",
|
|
1086
|
-
/* Type Checking */
|
|
1087
|
-
"strict",
|
|
1088
|
-
"strictBindCallApply",
|
|
1089
|
-
"strictFunctionTypes",
|
|
1090
|
-
"strictNullChecks",
|
|
1091
|
-
"strictPropertyInitialization",
|
|
1092
|
-
"allowUnreachableCode",
|
|
1093
|
-
"allowUnusedLabels",
|
|
1094
|
-
"alwaysStrict",
|
|
1095
|
-
"exactOptionalPropertyTypes",
|
|
1096
|
-
"noFallthroughCasesInSwitch",
|
|
1097
|
-
"noImplicitAny",
|
|
1098
|
-
"noImplicitOverride",
|
|
1099
|
-
"noImplicitReturns",
|
|
1100
|
-
"noImplicitThis",
|
|
1101
|
-
"noPropertyAccessFromIndexSignature",
|
|
1102
|
-
"noUncheckedIndexedAccess",
|
|
1103
|
-
"noUnusedLocals",
|
|
1104
|
-
"noUnusedParameters",
|
|
1105
|
-
"useUnknownInCatchVariables",
|
|
1106
|
-
/* Emit */
|
|
1107
|
-
"declaration",
|
|
1108
|
-
"declarationDir",
|
|
1109
|
-
"declarationMap",
|
|
1110
|
-
"downlevelIteration",
|
|
1111
|
-
"emitBOM",
|
|
1112
|
-
"emitDeclarationOnly",
|
|
1113
|
-
"importHelpers",
|
|
1114
|
-
"importsNotUsedAsValues",
|
|
1115
|
-
"inlineSourceMap",
|
|
1116
|
-
"inlineSources",
|
|
1117
|
-
"mapRoot",
|
|
1118
|
-
"newLine",
|
|
1119
|
-
"noEmit",
|
|
1120
|
-
"noEmitHelpers",
|
|
1121
|
-
"noEmitOnError",
|
|
1122
|
-
"outDir",
|
|
1123
|
-
"outFile",
|
|
1124
|
-
"preserveConstEnums",
|
|
1125
|
-
"preserveValueImports",
|
|
1126
|
-
"removeComments",
|
|
1127
|
-
"sourceMap",
|
|
1128
|
-
"sourceRoot",
|
|
1129
|
-
"stripInternal",
|
|
1130
|
-
/* Interop Constraints */
|
|
1131
|
-
"allowSyntheticDefaultImports",
|
|
1132
|
-
"esModuleInterop",
|
|
1133
|
-
"forceConsistentCasingInFileNames",
|
|
1134
|
-
"isolatedModules",
|
|
1135
|
-
"preserveSymlinks",
|
|
1136
|
-
"verbatimModuleSyntax",
|
|
1137
|
-
/* Completeness */
|
|
1138
|
-
"skipDefaultLibCheck",
|
|
1139
|
-
"skipLibCheck"
|
|
1140
|
-
],
|
|
1141
|
-
pathPattern: "^compilerOptions$"
|
|
1142
|
-
}
|
|
1143
|
-
]
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
];
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
// src/configs/stylistic.ts
|
|
1150
|
-
var STR_PARENS_NEW_LINE = "parens-new-line";
|
|
1151
|
-
var STYLISTIC_CONFIG_DEFAULTS = {
|
|
1152
|
-
indent: 2,
|
|
1153
|
-
jsx: true,
|
|
1154
|
-
quotes: "single",
|
|
1155
|
-
semi: true
|
|
1156
|
-
};
|
|
1157
|
-
async function stylistic(options = {}) {
|
|
1158
|
-
const {
|
|
1159
|
-
indent,
|
|
1160
|
-
jsx,
|
|
1161
|
-
overrides = {},
|
|
1162
|
-
quotes,
|
|
1163
|
-
semi
|
|
1164
|
-
} = {
|
|
1165
|
-
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1166
|
-
...options
|
|
1167
|
-
};
|
|
1168
|
-
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
1169
|
-
const config = pluginStylistic.configs.customize({
|
|
1170
|
-
flat: true,
|
|
1171
|
-
indent,
|
|
1172
|
-
jsx,
|
|
1173
|
-
pluginName: "style",
|
|
1174
|
-
quotes,
|
|
1175
|
-
semi
|
|
1176
|
-
});
|
|
1177
|
-
return [
|
|
1178
|
-
{
|
|
1179
|
-
name: "vinicunca:stylistic",
|
|
1180
|
-
plugins: {
|
|
1181
|
-
style: pluginStylistic,
|
|
1182
|
-
vinicunca: import_eslint_plugin_vinicunca.default
|
|
1183
|
-
},
|
|
1184
|
-
rules: {
|
|
1185
|
-
...config.rules,
|
|
1186
|
-
"curly": [ERROR, "all"],
|
|
1187
|
-
"style/array-bracket-newline": [ERROR, CONSISTENT],
|
|
1188
|
-
"style/array-bracket-spacing": [ERROR, NEVER],
|
|
1189
|
-
"style/array-element-newline": [ERROR, CONSISTENT],
|
|
1190
|
-
"style/arrow-parens": [ERROR, ALWAYS],
|
|
1191
|
-
"style/brace-style": [ERROR],
|
|
1192
|
-
"style/func-call-spacing": [ERROR, NEVER],
|
|
1193
|
-
"style/jsx-child-element-spacing": OFF,
|
|
1194
|
-
"style/jsx-closing-bracket-location": [ERROR, "line-aligned"],
|
|
1195
|
-
"style/jsx-closing-tag-location": ERROR,
|
|
1196
|
-
"style/jsx-curly-brace-presence": [ERROR, { children: NEVER, props: NEVER }],
|
|
1197
|
-
"style/jsx-curly-newline": [ERROR, {
|
|
1198
|
-
multiline: "consistent",
|
|
1199
|
-
singleline: "consistent"
|
|
1200
|
-
}],
|
|
1201
|
-
"style/jsx-curly-spacing": [ERROR, {
|
|
1202
|
-
children: true,
|
|
1203
|
-
spacing: {
|
|
1204
|
-
objectLiterals: NEVER
|
|
1205
|
-
},
|
|
1206
|
-
when: "always"
|
|
1207
|
-
}],
|
|
1208
|
-
"style/jsx-equals-spacing": [ERROR, NEVER],
|
|
1209
|
-
"style/jsx-first-prop-new-line": [ERROR, "multiline-multiprop"],
|
|
1210
|
-
"style/jsx-indent": [ERROR, 2],
|
|
1211
|
-
"style/jsx-indent-props": [ERROR, 2],
|
|
1212
|
-
"style/jsx-max-props-per-line": [ERROR, { maximum: 1, when: "multiline" }],
|
|
1213
|
-
"style/jsx-newline": ERROR,
|
|
1214
|
-
"style/jsx-one-expression-per-line": [ERROR, { allow: "single-child" }],
|
|
1215
|
-
"style/jsx-props-no-multi-spaces": ERROR,
|
|
1216
|
-
// Turned off to avoid conflicts with Perfectionist. https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props
|
|
1217
|
-
"style/jsx-sort-props": [OFF],
|
|
1218
|
-
"style/jsx-tag-spacing": [ERROR, {
|
|
1219
|
-
afterOpening: NEVER,
|
|
1220
|
-
beforeClosing: NEVER,
|
|
1221
|
-
beforeSelfClosing: "always",
|
|
1222
|
-
closingSlash: NEVER
|
|
1223
|
-
}],
|
|
1224
|
-
"style/jsx-wrap-multilines": [ERROR, {
|
|
1225
|
-
arrow: STR_PARENS_NEW_LINE,
|
|
1226
|
-
assignment: STR_PARENS_NEW_LINE,
|
|
1227
|
-
condition: STR_PARENS_NEW_LINE,
|
|
1228
|
-
declaration: STR_PARENS_NEW_LINE,
|
|
1229
|
-
logical: STR_PARENS_NEW_LINE,
|
|
1230
|
-
prop: STR_PARENS_NEW_LINE,
|
|
1231
|
-
return: STR_PARENS_NEW_LINE
|
|
1232
|
-
}],
|
|
1233
|
-
"style/member-delimiter-style": [ERROR],
|
|
1234
|
-
"style/object-curly-newline": [ERROR, { consistent: true, multiline: true }],
|
|
1235
|
-
"style/object-curly-spacing": [ERROR, ALWAYS],
|
|
1236
|
-
"style/object-property-newline": [ERROR, { allowMultiplePropertiesPerLine: true }],
|
|
1237
|
-
"style/operator-linebreak": [ERROR, "before"],
|
|
1238
|
-
"style/padded-blocks": [ERROR, { blocks: NEVER, classes: NEVER, switches: NEVER }],
|
|
1239
|
-
"style/quote-props": [ERROR, "consistent-as-needed"],
|
|
1240
|
-
"style/quotes": [ERROR, quotes],
|
|
1241
|
-
"style/rest-spread-spacing": [ERROR, NEVER],
|
|
1242
|
-
"style/semi": [ERROR, semi ? ALWAYS : NEVER],
|
|
1243
|
-
"style/semi-spacing": [ERROR, { after: true, before: false }],
|
|
1244
|
-
"vinicunca/consistent-list-newline": ERROR,
|
|
1245
|
-
"vinicunca/if-newline": ERROR,
|
|
1246
|
-
"vinicunca/top-level-function": ERROR,
|
|
1247
|
-
...overrides
|
|
1248
|
-
}
|
|
1249
|
-
},
|
|
1250
|
-
{
|
|
1251
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1252
|
-
rules: {
|
|
1253
|
-
"vinicunca/consistent-list-newline": OFF
|
|
2080
|
+
"disableSolutionSearching",
|
|
2081
|
+
"disableReferencedProjectLoad",
|
|
2082
|
+
/* Language and Environment */
|
|
2083
|
+
"target",
|
|
2084
|
+
"jsx",
|
|
2085
|
+
"jsxFactory",
|
|
2086
|
+
"jsxFragmentFactory",
|
|
2087
|
+
"jsxImportSource",
|
|
2088
|
+
"lib",
|
|
2089
|
+
"moduleDetection",
|
|
2090
|
+
"noLib",
|
|
2091
|
+
"reactNamespace",
|
|
2092
|
+
"useDefineForClassFields",
|
|
2093
|
+
"emitDecoratorMetadata",
|
|
2094
|
+
"experimentalDecorators",
|
|
2095
|
+
/* Modules */
|
|
2096
|
+
"baseUrl",
|
|
2097
|
+
"rootDir",
|
|
2098
|
+
"rootDirs",
|
|
2099
|
+
"customConditions",
|
|
2100
|
+
"module",
|
|
2101
|
+
"moduleResolution",
|
|
2102
|
+
"moduleSuffixes",
|
|
2103
|
+
"noResolve",
|
|
2104
|
+
"paths",
|
|
2105
|
+
"resolveJsonModule",
|
|
2106
|
+
"resolvePackageJsonExports",
|
|
2107
|
+
"resolvePackageJsonImports",
|
|
2108
|
+
"typeRoots",
|
|
2109
|
+
"types",
|
|
2110
|
+
"allowArbitraryExtensions",
|
|
2111
|
+
"allowImportingTsExtensions",
|
|
2112
|
+
"allowUmdGlobalAccess",
|
|
2113
|
+
/* JavaScript Support */
|
|
2114
|
+
"allowJs",
|
|
2115
|
+
"checkJs",
|
|
2116
|
+
"maxNodeModuleJsDepth",
|
|
2117
|
+
/* Type Checking */
|
|
2118
|
+
"strict",
|
|
2119
|
+
"strictBindCallApply",
|
|
2120
|
+
"strictFunctionTypes",
|
|
2121
|
+
"strictNullChecks",
|
|
2122
|
+
"strictPropertyInitialization",
|
|
2123
|
+
"allowUnreachableCode",
|
|
2124
|
+
"allowUnusedLabels",
|
|
2125
|
+
"alwaysStrict",
|
|
2126
|
+
"exactOptionalPropertyTypes",
|
|
2127
|
+
"noFallthroughCasesInSwitch",
|
|
2128
|
+
"noImplicitAny",
|
|
2129
|
+
"noImplicitOverride",
|
|
2130
|
+
"noImplicitReturns",
|
|
2131
|
+
"noImplicitThis",
|
|
2132
|
+
"noPropertyAccessFromIndexSignature",
|
|
2133
|
+
"noUncheckedIndexedAccess",
|
|
2134
|
+
"noUnusedLocals",
|
|
2135
|
+
"noUnusedParameters",
|
|
2136
|
+
"useUnknownInCatchVariables",
|
|
2137
|
+
/* Emit */
|
|
2138
|
+
"declaration",
|
|
2139
|
+
"declarationDir",
|
|
2140
|
+
"declarationMap",
|
|
2141
|
+
"downlevelIteration",
|
|
2142
|
+
"emitBOM",
|
|
2143
|
+
"emitDeclarationOnly",
|
|
2144
|
+
"importHelpers",
|
|
2145
|
+
"importsNotUsedAsValues",
|
|
2146
|
+
"inlineSourceMap",
|
|
2147
|
+
"inlineSources",
|
|
2148
|
+
"mapRoot",
|
|
2149
|
+
"newLine",
|
|
2150
|
+
"noEmit",
|
|
2151
|
+
"noEmitHelpers",
|
|
2152
|
+
"noEmitOnError",
|
|
2153
|
+
"outDir",
|
|
2154
|
+
"outFile",
|
|
2155
|
+
"preserveConstEnums",
|
|
2156
|
+
"preserveValueImports",
|
|
2157
|
+
"removeComments",
|
|
2158
|
+
"sourceMap",
|
|
2159
|
+
"sourceRoot",
|
|
2160
|
+
"stripInternal",
|
|
2161
|
+
/* Interop Constraints */
|
|
2162
|
+
"allowSyntheticDefaultImports",
|
|
2163
|
+
"esModuleInterop",
|
|
2164
|
+
"forceConsistentCasingInFileNames",
|
|
2165
|
+
"isolatedModules",
|
|
2166
|
+
"preserveSymlinks",
|
|
2167
|
+
"verbatimModuleSyntax",
|
|
2168
|
+
/* Completeness */
|
|
2169
|
+
"skipDefaultLibCheck",
|
|
2170
|
+
"skipLibCheck"
|
|
2171
|
+
],
|
|
2172
|
+
pathPattern: "^compilerOptions$"
|
|
2173
|
+
}
|
|
2174
|
+
]
|
|
1254
2175
|
}
|
|
1255
2176
|
}
|
|
1256
2177
|
];
|
|
@@ -1729,167 +2650,6 @@ async function yaml(options = {}) {
|
|
|
1729
2650
|
];
|
|
1730
2651
|
}
|
|
1731
2652
|
|
|
1732
|
-
// src/configs/formatters.ts
|
|
1733
|
-
async function formatters(options = {}, stylistic2 = {}) {
|
|
1734
|
-
if (options === true) {
|
|
1735
|
-
options = {
|
|
1736
|
-
css: true,
|
|
1737
|
-
graphql: true,
|
|
1738
|
-
html: true,
|
|
1739
|
-
markdown: true
|
|
1740
|
-
};
|
|
1741
|
-
}
|
|
1742
|
-
const {
|
|
1743
|
-
indent,
|
|
1744
|
-
quotes,
|
|
1745
|
-
semi
|
|
1746
|
-
} = {
|
|
1747
|
-
...STYLISTIC_CONFIG_DEFAULTS,
|
|
1748
|
-
...stylistic2
|
|
1749
|
-
};
|
|
1750
|
-
const prettierOptions = Object.assign(
|
|
1751
|
-
{
|
|
1752
|
-
endOfLine: "auto",
|
|
1753
|
-
semi,
|
|
1754
|
-
singleQuote: quotes === "single",
|
|
1755
|
-
tabWidth: typeof indent === "number" ? indent : 2,
|
|
1756
|
-
trailingComma: "all",
|
|
1757
|
-
useTabs: indent === "tab"
|
|
1758
|
-
},
|
|
1759
|
-
options.prettierOptions || {}
|
|
1760
|
-
);
|
|
1761
|
-
const dprintOptions = Object.assign(
|
|
1762
|
-
{
|
|
1763
|
-
indentWidth: typeof indent === "number" ? indent : 2,
|
|
1764
|
-
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
1765
|
-
useTabs: indent === "tab"
|
|
1766
|
-
},
|
|
1767
|
-
options.dprintOptions || {}
|
|
1768
|
-
);
|
|
1769
|
-
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
1770
|
-
const configs = [
|
|
1771
|
-
{
|
|
1772
|
-
name: "vinicunca:formatters:setup",
|
|
1773
|
-
plugins: {
|
|
1774
|
-
format: pluginFormat
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
];
|
|
1778
|
-
if (options.css) {
|
|
1779
|
-
configs.push(
|
|
1780
|
-
{
|
|
1781
|
-
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1782
|
-
languageOptions: {
|
|
1783
|
-
parser: parserPlain
|
|
1784
|
-
},
|
|
1785
|
-
name: "vinicunca:formatters:css",
|
|
1786
|
-
rules: {
|
|
1787
|
-
"format/prettier": [
|
|
1788
|
-
"error",
|
|
1789
|
-
{
|
|
1790
|
-
...prettierOptions,
|
|
1791
|
-
parser: "css"
|
|
1792
|
-
}
|
|
1793
|
-
]
|
|
1794
|
-
}
|
|
1795
|
-
},
|
|
1796
|
-
{
|
|
1797
|
-
files: [GLOB_SCSS],
|
|
1798
|
-
languageOptions: {
|
|
1799
|
-
parser: parserPlain
|
|
1800
|
-
},
|
|
1801
|
-
name: "vinicunca:formatters:scss",
|
|
1802
|
-
rules: {
|
|
1803
|
-
"format/prettier": [
|
|
1804
|
-
"error",
|
|
1805
|
-
{
|
|
1806
|
-
...prettierOptions,
|
|
1807
|
-
parser: "scss"
|
|
1808
|
-
}
|
|
1809
|
-
]
|
|
1810
|
-
}
|
|
1811
|
-
},
|
|
1812
|
-
{
|
|
1813
|
-
files: [GLOB_LESS],
|
|
1814
|
-
languageOptions: {
|
|
1815
|
-
parser: parserPlain
|
|
1816
|
-
},
|
|
1817
|
-
name: "vinicunca:formatters:less",
|
|
1818
|
-
rules: {
|
|
1819
|
-
"format/prettier": [
|
|
1820
|
-
"error",
|
|
1821
|
-
{
|
|
1822
|
-
...prettierOptions,
|
|
1823
|
-
parser: "less"
|
|
1824
|
-
}
|
|
1825
|
-
]
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
);
|
|
1829
|
-
}
|
|
1830
|
-
if (options.html) {
|
|
1831
|
-
configs.push({
|
|
1832
|
-
files: ["**/*.html"],
|
|
1833
|
-
languageOptions: {
|
|
1834
|
-
parser: parserPlain
|
|
1835
|
-
},
|
|
1836
|
-
name: "vinicunca:formatters:html",
|
|
1837
|
-
rules: {
|
|
1838
|
-
"format/prettier": [
|
|
1839
|
-
"error",
|
|
1840
|
-
{
|
|
1841
|
-
...prettierOptions,
|
|
1842
|
-
parser: "html"
|
|
1843
|
-
}
|
|
1844
|
-
]
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
if (options.markdown) {
|
|
1849
|
-
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
1850
|
-
configs.push({
|
|
1851
|
-
files: [GLOB_MARKDOWN],
|
|
1852
|
-
languageOptions: {
|
|
1853
|
-
parser: parserPlain
|
|
1854
|
-
},
|
|
1855
|
-
name: "vinicunca:formatters:markdown",
|
|
1856
|
-
rules: {
|
|
1857
|
-
[`format/${formater}`]: [
|
|
1858
|
-
"error",
|
|
1859
|
-
formater === "prettier" ? {
|
|
1860
|
-
printWidth: 120,
|
|
1861
|
-
...prettierOptions,
|
|
1862
|
-
embeddedLanguageFormatting: "off",
|
|
1863
|
-
parser: "markdown"
|
|
1864
|
-
} : {
|
|
1865
|
-
...dprintOptions,
|
|
1866
|
-
language: "markdown"
|
|
1867
|
-
}
|
|
1868
|
-
]
|
|
1869
|
-
}
|
|
1870
|
-
});
|
|
1871
|
-
}
|
|
1872
|
-
if (options.graphql) {
|
|
1873
|
-
configs.push({
|
|
1874
|
-
files: ["**/*.graphql"],
|
|
1875
|
-
languageOptions: {
|
|
1876
|
-
parser: parserPlain
|
|
1877
|
-
},
|
|
1878
|
-
name: "vinicunca:formatters:graphql",
|
|
1879
|
-
rules: {
|
|
1880
|
-
"format/prettier": [
|
|
1881
|
-
"error",
|
|
1882
|
-
{
|
|
1883
|
-
...prettierOptions,
|
|
1884
|
-
parser: "graphql"
|
|
1885
|
-
}
|
|
1886
|
-
]
|
|
1887
|
-
}
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
return configs;
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
2653
|
// src/base.ts
|
|
1894
2654
|
var flatConfigProps = [
|
|
1895
2655
|
"name",
|
|
@@ -1916,7 +2676,7 @@ var defaultPluginRenaming = {
|
|
|
1916
2676
|
"vitest": "test",
|
|
1917
2677
|
"yml": "yaml"
|
|
1918
2678
|
};
|
|
1919
|
-
|
|
2679
|
+
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
1920
2680
|
const {
|
|
1921
2681
|
autoRenamePlugins = true,
|
|
1922
2682
|
componentExts = [],
|
|
@@ -1958,7 +2718,8 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
1958
2718
|
stylistic: stylisticOptions
|
|
1959
2719
|
}),
|
|
1960
2720
|
imports(),
|
|
1961
|
-
unicorn()
|
|
2721
|
+
unicorn(),
|
|
2722
|
+
perfectionist()
|
|
1962
2723
|
);
|
|
1963
2724
|
if (enableVue) {
|
|
1964
2725
|
componentExts.push("vue");
|
|
@@ -2045,14 +2806,15 @@ async function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2045
2806
|
configs.push([fusedConfig]);
|
|
2046
2807
|
}
|
|
2047
2808
|
;
|
|
2048
|
-
|
|
2809
|
+
let pipeline = new import_eslint_flat_config_utils.FlatConfigPipeline();
|
|
2810
|
+
pipeline = pipeline.append(
|
|
2049
2811
|
...configs,
|
|
2050
2812
|
...userConfigs
|
|
2051
2813
|
);
|
|
2052
2814
|
if (autoRenamePlugins) {
|
|
2053
|
-
|
|
2815
|
+
pipeline = pipeline.renamePlugins(defaultPluginRenaming);
|
|
2054
2816
|
}
|
|
2055
|
-
return
|
|
2817
|
+
return pipeline;
|
|
2056
2818
|
}
|
|
2057
2819
|
function getOverrides(options, key) {
|
|
2058
2820
|
const sub = resolveSubOptions(options, key);
|
|
@@ -2092,6 +2854,7 @@ function resolveSubOptions(options, key) {
|
|
|
2092
2854
|
combineConfigs,
|
|
2093
2855
|
comments,
|
|
2094
2856
|
defaultPluginRenaming,
|
|
2857
|
+
formatters,
|
|
2095
2858
|
ignores,
|
|
2096
2859
|
imports,
|
|
2097
2860
|
interopDefault,
|
|
@@ -2101,6 +2864,7 @@ function resolveSubOptions(options, key) {
|
|
|
2101
2864
|
markdown,
|
|
2102
2865
|
node,
|
|
2103
2866
|
parserPlain,
|
|
2867
|
+
perfectionist,
|
|
2104
2868
|
pluginComments,
|
|
2105
2869
|
pluginImport,
|
|
2106
2870
|
pluginNode,
|