@vinicunca/eslint-config 2.0.0-beta.9 → 2.0.1
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 +1012 -85
- package/dist/index.d.cts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +1012 -85
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -91,10 +91,63 @@ __export(src_exports, {
|
|
|
91
91
|
module.exports = __toCommonJS(src_exports);
|
|
92
92
|
|
|
93
93
|
// src/base.ts
|
|
94
|
-
var
|
|
94
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
95
95
|
var import_local_pkg = require("local-pkg");
|
|
96
96
|
|
|
97
|
-
//
|
|
97
|
+
// src/flags.ts
|
|
98
|
+
var ERROR = "error";
|
|
99
|
+
var OFF = "off";
|
|
100
|
+
var WARN = "warn";
|
|
101
|
+
var CONSISTENT = "consistent";
|
|
102
|
+
var NEVER = "never";
|
|
103
|
+
var ALWAYS = "always";
|
|
104
|
+
|
|
105
|
+
// src/plugins.ts
|
|
106
|
+
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
107
|
+
var import_eslint_plugin_vinicunca = __toESM(require("@vinicunca/eslint-plugin-vinicunca"), 1);
|
|
108
|
+
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
109
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
110
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
111
|
+
var pluginImport = __toESM(require("eslint-plugin-i"), 1);
|
|
112
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
113
|
+
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
114
|
+
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
115
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
116
|
+
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
117
|
+
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
118
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
119
|
+
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
120
|
+
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
121
|
+
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
122
|
+
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
123
|
+
var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
|
|
124
|
+
var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
|
|
125
|
+
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
126
|
+
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
127
|
+
|
|
128
|
+
// src/configs/comments.ts
|
|
129
|
+
function comments() {
|
|
130
|
+
return [
|
|
131
|
+
{
|
|
132
|
+
name: "vinicunca:eslint-comments",
|
|
133
|
+
plugins: {
|
|
134
|
+
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
135
|
+
},
|
|
136
|
+
rules: {
|
|
137
|
+
"eslint-comments/no-aggregating-enable": ERROR,
|
|
138
|
+
"eslint-comments/no-duplicate-disable": ERROR,
|
|
139
|
+
"eslint-comments/no-unlimited-disable": ERROR,
|
|
140
|
+
"eslint-comments/no-unused-enable": ERROR
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/configs/ignores.ts
|
|
147
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
148
|
+
var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
149
|
+
|
|
150
|
+
// ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
|
|
98
151
|
function purry(fn, args, lazy) {
|
|
99
152
|
const diff = fn.length - args.length;
|
|
100
153
|
const arrayArgs = Array.from(args);
|
|
@@ -111,13 +164,56 @@ function purry(fn, args, lazy) {
|
|
|
111
164
|
}
|
|
112
165
|
throw new Error("Wrong number of arguments");
|
|
113
166
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
function isBoolean(data) {
|
|
117
|
-
return typeof data === "boolean";
|
|
167
|
+
function isArray(data) {
|
|
168
|
+
return Array.isArray(data);
|
|
118
169
|
}
|
|
119
|
-
|
|
120
|
-
|
|
170
|
+
function isDefined(data) {
|
|
171
|
+
return typeof data !== "undefined" && data !== null;
|
|
172
|
+
}
|
|
173
|
+
((isDefined2) => {
|
|
174
|
+
function strict(data) {
|
|
175
|
+
return data !== void 0;
|
|
176
|
+
}
|
|
177
|
+
isDefined2.strict = strict;
|
|
178
|
+
})(isDefined || (isDefined = {}));
|
|
179
|
+
function toString(value) {
|
|
180
|
+
return Object.prototype.toString.call(value);
|
|
181
|
+
}
|
|
182
|
+
function isObject(data) {
|
|
183
|
+
return toString(data) === "[object Object]";
|
|
184
|
+
}
|
|
185
|
+
function isString(data) {
|
|
186
|
+
return typeof data === "string";
|
|
187
|
+
}
|
|
188
|
+
function isEmpty(data) {
|
|
189
|
+
if (isArray(data) || isString(data)) {
|
|
190
|
+
return data.length === 0;
|
|
191
|
+
}
|
|
192
|
+
if (isObject(data)) {
|
|
193
|
+
for (const _ in data) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return !(data instanceof RegExp);
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
function _countBy(indexed) {
|
|
201
|
+
return (array, fn) => {
|
|
202
|
+
return array.reduce((ret, item, index) => {
|
|
203
|
+
const value = indexed ? fn(item, index, array) : fn(item);
|
|
204
|
+
return ret + (value ? 1 : 0);
|
|
205
|
+
}, 0);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function countBy(...args) {
|
|
209
|
+
return purry(_countBy(false), args);
|
|
210
|
+
}
|
|
211
|
+
((countBy2) => {
|
|
212
|
+
function indexed(...args) {
|
|
213
|
+
return purry(_countBy(true), args);
|
|
214
|
+
}
|
|
215
|
+
countBy2.indexed = indexed;
|
|
216
|
+
})(countBy || (countBy = {}));
|
|
121
217
|
function _reduceLazy(array, lazy, indexed) {
|
|
122
218
|
const newArray = [];
|
|
123
219
|
for (let index = 0; index < array.length; index++) {
|
|
@@ -131,25 +227,815 @@ function _reduceLazy(array, lazy, indexed) {
|
|
|
131
227
|
}
|
|
132
228
|
return newArray;
|
|
133
229
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
230
|
+
function differenceWith(...args) {
|
|
231
|
+
return purry(_differenceWith, args, differenceWith.lazy);
|
|
232
|
+
}
|
|
233
|
+
function _differenceWith(array, other, isEquals) {
|
|
234
|
+
const lazy = differenceWith.lazy(other, isEquals);
|
|
235
|
+
return _reduceLazy(array, lazy);
|
|
236
|
+
}
|
|
237
|
+
((differenceWith2) => {
|
|
238
|
+
function lazy(other, isEquals) {
|
|
239
|
+
return (value) => {
|
|
240
|
+
if (other.every((otherValue) => !isEquals(value, otherValue))) {
|
|
241
|
+
return {
|
|
242
|
+
done: false,
|
|
243
|
+
hasNext: true,
|
|
244
|
+
next: value
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
done: false,
|
|
249
|
+
hasNext: false
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
differenceWith2.lazy = lazy;
|
|
254
|
+
})(differenceWith || (differenceWith = {}));
|
|
255
|
+
function difference(...args) {
|
|
256
|
+
return purry(_difference, args, difference.lazy);
|
|
257
|
+
}
|
|
258
|
+
function _difference(array, other) {
|
|
259
|
+
const lazy = difference.lazy(other);
|
|
260
|
+
return _reduceLazy(array, lazy);
|
|
261
|
+
}
|
|
262
|
+
((difference2) => {
|
|
263
|
+
function lazy(other) {
|
|
264
|
+
const set2 = new Set(other);
|
|
265
|
+
return (value) => {
|
|
266
|
+
if (!set2.has(value)) {
|
|
267
|
+
return {
|
|
268
|
+
done: false,
|
|
269
|
+
hasNext: true,
|
|
270
|
+
next: value
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
done: false,
|
|
275
|
+
hasNext: false
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
difference2.lazy = lazy;
|
|
280
|
+
})(difference || (difference = {}));
|
|
281
|
+
function drop(...args) {
|
|
282
|
+
return purry(_drop, args, drop.lazy);
|
|
283
|
+
}
|
|
284
|
+
function _drop(array, n) {
|
|
285
|
+
return _reduceLazy(array, drop.lazy(n));
|
|
286
|
+
}
|
|
287
|
+
((drop2) => {
|
|
288
|
+
function lazy(n) {
|
|
289
|
+
let left = n;
|
|
290
|
+
return (value) => {
|
|
291
|
+
if (left > 0) {
|
|
292
|
+
left--;
|
|
293
|
+
return {
|
|
294
|
+
done: false,
|
|
295
|
+
hasNext: false
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
done: false,
|
|
300
|
+
hasNext: true,
|
|
301
|
+
next: value
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
drop2.lazy = lazy;
|
|
306
|
+
})(drop || (drop = {}));
|
|
307
|
+
function toLazyIndexed(fn) {
|
|
308
|
+
fn.indexed = true;
|
|
309
|
+
return fn;
|
|
310
|
+
}
|
|
311
|
+
function filter(...args) {
|
|
312
|
+
return purry(_filter(false), args, filter.lazy);
|
|
313
|
+
}
|
|
314
|
+
function _filter(indexed) {
|
|
315
|
+
return (array, fn) => {
|
|
316
|
+
return _reduceLazy(
|
|
317
|
+
array,
|
|
318
|
+
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
319
|
+
indexed
|
|
320
|
+
);
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function _lazy(indexed) {
|
|
324
|
+
return (fn) => {
|
|
325
|
+
return (value, index, array) => {
|
|
326
|
+
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
327
|
+
if (valid) {
|
|
328
|
+
return {
|
|
329
|
+
done: false,
|
|
330
|
+
hasNext: true,
|
|
331
|
+
next: value
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
done: false,
|
|
336
|
+
hasNext: false
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
((filter2) => {
|
|
342
|
+
function indexed(...args) {
|
|
343
|
+
return purry(_filter(true), args, filter2.lazyIndexed);
|
|
344
|
+
}
|
|
345
|
+
filter2.indexed = indexed;
|
|
346
|
+
filter2.lazy = _lazy(false);
|
|
347
|
+
filter2.lazyIndexed = toLazyIndexed(_lazy(true));
|
|
348
|
+
})(filter || (filter = {}));
|
|
349
|
+
function toSingle(fn) {
|
|
350
|
+
fn.single = true;
|
|
351
|
+
return fn;
|
|
352
|
+
}
|
|
353
|
+
function findIndex(...args) {
|
|
354
|
+
return purry(_findIndex(false), args, findIndex.lazy);
|
|
355
|
+
}
|
|
356
|
+
function _findIndex(indexed) {
|
|
357
|
+
return (array, fn) => {
|
|
358
|
+
if (indexed) {
|
|
359
|
+
return array.findIndex(fn);
|
|
360
|
+
}
|
|
361
|
+
return array.findIndex((x) => fn(x));
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function _lazy2(indexed) {
|
|
365
|
+
return (fn) => {
|
|
366
|
+
let i = 0;
|
|
367
|
+
return (value, index, array) => {
|
|
368
|
+
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
369
|
+
if (valid) {
|
|
370
|
+
return {
|
|
371
|
+
done: true,
|
|
372
|
+
hasNext: true,
|
|
373
|
+
next: i
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
i++;
|
|
377
|
+
return {
|
|
378
|
+
done: false,
|
|
379
|
+
hasNext: false
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
((findIndex2) => {
|
|
385
|
+
function indexed(...args) {
|
|
386
|
+
return purry(_findIndex(true), args, findIndex2.lazyIndexed);
|
|
387
|
+
}
|
|
388
|
+
findIndex2.indexed = indexed;
|
|
389
|
+
findIndex2.lazy = toSingle(_lazy2(false));
|
|
390
|
+
findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
|
|
391
|
+
})(findIndex || (findIndex = {}));
|
|
392
|
+
function findLastIndex(...args) {
|
|
393
|
+
return purry(_findLastIndex(false), args);
|
|
394
|
+
}
|
|
395
|
+
function _findLastIndex(indexed) {
|
|
396
|
+
return (array, fn) => {
|
|
397
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
398
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
399
|
+
return i;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return -1;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
((findLastIndex2) => {
|
|
406
|
+
function indexed(...args) {
|
|
407
|
+
return purry(_findLastIndex(true), args);
|
|
408
|
+
}
|
|
409
|
+
findLastIndex2.indexed = indexed;
|
|
410
|
+
})(findLastIndex || (findLastIndex = {}));
|
|
411
|
+
function findLast(...args) {
|
|
412
|
+
return purry(_findLast(false), args);
|
|
413
|
+
}
|
|
414
|
+
function _findLast(indexed) {
|
|
415
|
+
return (array, fn) => {
|
|
416
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
417
|
+
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
418
|
+
return array[i];
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
((findLast2) => {
|
|
424
|
+
function indexed(...args) {
|
|
425
|
+
return purry(_findLast(true), args);
|
|
426
|
+
}
|
|
427
|
+
findLast2.indexed = indexed;
|
|
428
|
+
})(findLast || (findLast = {}));
|
|
429
|
+
function find(...args) {
|
|
430
|
+
return purry(_find(false), args, find.lazy);
|
|
431
|
+
}
|
|
432
|
+
function _find(indexed) {
|
|
433
|
+
return (array, fn) => {
|
|
434
|
+
if (indexed) {
|
|
435
|
+
return array.find(fn);
|
|
436
|
+
}
|
|
437
|
+
return array.find((x) => fn(x));
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function _lazy3(indexed) {
|
|
441
|
+
return (fn) => {
|
|
442
|
+
return (value, index, array) => {
|
|
443
|
+
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
444
|
+
return {
|
|
445
|
+
done: valid,
|
|
446
|
+
hasNext: valid,
|
|
447
|
+
next: value
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
((find2) => {
|
|
453
|
+
function indexed(...args) {
|
|
454
|
+
return purry(_find(true), args, find2.lazyIndexed);
|
|
455
|
+
}
|
|
456
|
+
find2.indexed = indexed;
|
|
457
|
+
find2.lazy = toSingle(_lazy3(false));
|
|
458
|
+
find2.lazyIndexed = toSingle(toLazyIndexed(_lazy3(true)));
|
|
459
|
+
})(find || (find = {}));
|
|
460
|
+
function first(...args) {
|
|
461
|
+
return purry(_first, args, first.lazy);
|
|
462
|
+
}
|
|
463
|
+
function _first([first2]) {
|
|
464
|
+
return first2;
|
|
465
|
+
}
|
|
466
|
+
((first2) => {
|
|
467
|
+
function lazy() {
|
|
468
|
+
return (value) => {
|
|
469
|
+
return {
|
|
470
|
+
done: true,
|
|
471
|
+
hasNext: true,
|
|
472
|
+
next: value
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
first2.lazy = lazy;
|
|
477
|
+
((lazy2) => {
|
|
478
|
+
lazy2.single = true;
|
|
479
|
+
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
480
|
+
})(first || (first = {}));
|
|
481
|
+
function flatMapToObj(...args) {
|
|
482
|
+
return purry(_flatMapToObj(false), args);
|
|
483
|
+
}
|
|
484
|
+
function _flatMapToObj(indexed) {
|
|
485
|
+
return (array, fn) => {
|
|
486
|
+
return array.reduce((result, element, index) => {
|
|
487
|
+
const items = indexed ? fn(element, index, array) : fn(element);
|
|
488
|
+
items.forEach(([key, value]) => {
|
|
489
|
+
result[key] = value;
|
|
490
|
+
});
|
|
491
|
+
return result;
|
|
492
|
+
}, {});
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
((flatMapToObj2) => {
|
|
496
|
+
function indexed(...args) {
|
|
497
|
+
return purry(_flatMapToObj(true), args);
|
|
498
|
+
}
|
|
499
|
+
flatMapToObj2.indexed = indexed;
|
|
500
|
+
})(flatMapToObj || (flatMapToObj = {}));
|
|
501
|
+
function flatten(...args) {
|
|
502
|
+
return purry(_flatten, args, flatten.lazy);
|
|
503
|
+
}
|
|
504
|
+
function _flatten(items) {
|
|
505
|
+
return _reduceLazy(items, flatten.lazy());
|
|
506
|
+
}
|
|
507
|
+
((flatten2) => {
|
|
508
|
+
function lazy() {
|
|
509
|
+
return (next) => {
|
|
510
|
+
if (Array.isArray(next)) {
|
|
511
|
+
return {
|
|
512
|
+
done: false,
|
|
513
|
+
hasNext: true,
|
|
514
|
+
hasMany: true,
|
|
515
|
+
next
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
done: false,
|
|
520
|
+
hasNext: true,
|
|
521
|
+
next
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
flatten2.lazy = lazy;
|
|
526
|
+
})(flatten || (flatten = {}));
|
|
527
|
+
function flatMap(...args) {
|
|
528
|
+
return purry(_flatMap, args, flatMap.lazy);
|
|
529
|
+
}
|
|
530
|
+
function _flatMap(array, fn) {
|
|
531
|
+
return flatten(array.map((item) => fn(item)));
|
|
532
|
+
}
|
|
533
|
+
((flatMap2) => {
|
|
534
|
+
function lazy(fn) {
|
|
535
|
+
return (value) => {
|
|
536
|
+
const next = fn(value);
|
|
537
|
+
if (Array.isArray(next)) {
|
|
538
|
+
return {
|
|
539
|
+
done: false,
|
|
540
|
+
hasNext: true,
|
|
541
|
+
hasMany: true,
|
|
542
|
+
next
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
done: false,
|
|
547
|
+
hasNext: true,
|
|
548
|
+
next
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
flatMap2.lazy = lazy;
|
|
553
|
+
})(flatMap || (flatMap = {}));
|
|
554
|
+
function flattenDeep(...args) {
|
|
555
|
+
return purry(_flattenDeep, args, flattenDeep.lazy);
|
|
556
|
+
}
|
|
557
|
+
function _flattenDeep(items) {
|
|
558
|
+
return _reduceLazy(items, flattenDeep.lazy());
|
|
559
|
+
}
|
|
560
|
+
function _flattenDeepValue(value) {
|
|
561
|
+
if (!Array.isArray(value)) {
|
|
562
|
+
return value;
|
|
563
|
+
}
|
|
564
|
+
const ret = [];
|
|
565
|
+
value.forEach((item) => {
|
|
566
|
+
if (Array.isArray(item)) {
|
|
567
|
+
ret.push(...flattenDeep(item));
|
|
568
|
+
} else {
|
|
569
|
+
ret.push(item);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
return ret;
|
|
573
|
+
}
|
|
574
|
+
((flattenDeep2) => {
|
|
575
|
+
function lazy() {
|
|
576
|
+
return (value) => {
|
|
577
|
+
const next = _flattenDeepValue(value);
|
|
578
|
+
if (Array.isArray(next)) {
|
|
579
|
+
return {
|
|
580
|
+
done: false,
|
|
581
|
+
hasNext: true,
|
|
582
|
+
hasMany: true,
|
|
583
|
+
next
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
return {
|
|
587
|
+
done: false,
|
|
588
|
+
hasNext: true,
|
|
589
|
+
next
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
flattenDeep2.lazy = lazy;
|
|
594
|
+
})(flattenDeep || (flattenDeep = {}));
|
|
595
|
+
function forEach(...args) {
|
|
596
|
+
return purry(_forEach(false), args, forEach.lazy);
|
|
597
|
+
}
|
|
598
|
+
function _forEach(indexed) {
|
|
599
|
+
return (array, fn) => {
|
|
600
|
+
return _reduceLazy(
|
|
601
|
+
array,
|
|
602
|
+
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
603
|
+
indexed
|
|
604
|
+
);
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
function _lazy4(indexed) {
|
|
608
|
+
return (fn) => {
|
|
609
|
+
return (value, index, array) => {
|
|
610
|
+
if (indexed) {
|
|
611
|
+
fn(value, index, array);
|
|
612
|
+
} else {
|
|
613
|
+
fn(value);
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
done: false,
|
|
617
|
+
hasNext: true,
|
|
618
|
+
next: value
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
((forEach2) => {
|
|
624
|
+
function indexed(...args) {
|
|
625
|
+
return purry(_forEach(true), args, forEach2.lazyIndexed);
|
|
626
|
+
}
|
|
627
|
+
forEach2.indexed = indexed;
|
|
628
|
+
forEach2.lazy = _lazy4(false);
|
|
629
|
+
forEach2.lazyIndexed = toLazyIndexed(_lazy4(true));
|
|
630
|
+
})(forEach || (forEach = {}));
|
|
631
|
+
function groupBy(...args) {
|
|
632
|
+
return purry(_groupBy(false), args);
|
|
633
|
+
}
|
|
634
|
+
function _groupBy(indexed) {
|
|
635
|
+
return (array, fn) => {
|
|
636
|
+
const ret = {};
|
|
637
|
+
array.forEach((item, index) => {
|
|
638
|
+
const key = indexed ? fn(item, index, array) : fn(item);
|
|
639
|
+
if (key !== void 0) {
|
|
640
|
+
const actualKey = String(key);
|
|
641
|
+
if (!ret[actualKey]) {
|
|
642
|
+
ret[actualKey] = [];
|
|
643
|
+
}
|
|
644
|
+
ret[actualKey].push(item);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
return ret;
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
((groupBy2) => {
|
|
651
|
+
function indexed(...args) {
|
|
652
|
+
return purry(_groupBy(true), args);
|
|
653
|
+
}
|
|
654
|
+
groupBy2.indexed = indexed;
|
|
655
|
+
groupBy2.strict = groupBy2;
|
|
656
|
+
})(groupBy || (groupBy = {}));
|
|
657
|
+
function indexBy(...args) {
|
|
658
|
+
return purry(_indexBy(false), args);
|
|
659
|
+
}
|
|
660
|
+
function _indexBy(indexed) {
|
|
661
|
+
return (array, fn) => {
|
|
662
|
+
return array.reduce((ret, item, index) => {
|
|
663
|
+
const value = indexed ? fn(item, index, array) : fn(item);
|
|
664
|
+
const key = String(value);
|
|
665
|
+
ret[key] = item;
|
|
666
|
+
return ret;
|
|
667
|
+
}, {});
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
((indexBy2) => {
|
|
671
|
+
function indexed(...args) {
|
|
672
|
+
return purry(_indexBy(true), args);
|
|
673
|
+
}
|
|
674
|
+
indexBy2.indexed = indexed;
|
|
675
|
+
})(indexBy || (indexBy = {}));
|
|
676
|
+
function intersection(...args) {
|
|
677
|
+
return purry(_intersection, args, intersection.lazy);
|
|
678
|
+
}
|
|
679
|
+
function _intersection(array, other) {
|
|
680
|
+
const lazy = intersection.lazy(other);
|
|
681
|
+
return _reduceLazy(array, lazy);
|
|
682
|
+
}
|
|
683
|
+
((intersection2) => {
|
|
684
|
+
function lazy(other) {
|
|
685
|
+
return (value) => {
|
|
686
|
+
const set2 = new Set(other);
|
|
687
|
+
if (set2.has(value)) {
|
|
688
|
+
return {
|
|
689
|
+
done: false,
|
|
690
|
+
hasNext: true,
|
|
691
|
+
next: value
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
return {
|
|
695
|
+
done: false,
|
|
696
|
+
hasNext: false
|
|
697
|
+
};
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
intersection2.lazy = lazy;
|
|
701
|
+
})(intersection || (intersection = {}));
|
|
702
|
+
function intersectionWith(...args) {
|
|
703
|
+
return purry(_intersectionWith, args, intersectionWith.lazy);
|
|
704
|
+
}
|
|
705
|
+
function _intersectionWith(array, other, comparator) {
|
|
706
|
+
const lazy = intersectionWith.lazy(other, comparator);
|
|
707
|
+
return _reduceLazy(array, lazy);
|
|
708
|
+
}
|
|
709
|
+
((intersectionWith2) => {
|
|
710
|
+
function lazy(other, comparator) {
|
|
711
|
+
return (value) => {
|
|
712
|
+
if (other.some((otherValue) => comparator(value, otherValue))) {
|
|
713
|
+
return {
|
|
714
|
+
done: false,
|
|
715
|
+
hasNext: true,
|
|
716
|
+
next: value
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
return {
|
|
720
|
+
done: false,
|
|
721
|
+
hasNext: false
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
intersectionWith2.lazy = lazy;
|
|
726
|
+
})(intersectionWith || (intersectionWith = {}));
|
|
727
|
+
function map(...args) {
|
|
728
|
+
return purry(_map(false), args, map.lazy);
|
|
729
|
+
}
|
|
730
|
+
function _map(indexed) {
|
|
731
|
+
return (array, fn) => {
|
|
732
|
+
return _reduceLazy(
|
|
733
|
+
array,
|
|
734
|
+
indexed ? map.lazyIndexed(fn) : map.lazy(fn),
|
|
735
|
+
indexed
|
|
736
|
+
);
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
function _lazy5(indexed) {
|
|
740
|
+
return (fn) => {
|
|
741
|
+
return (value, index, array) => {
|
|
742
|
+
return {
|
|
743
|
+
done: false,
|
|
744
|
+
hasNext: true,
|
|
745
|
+
next: indexed ? fn(value, index, array) : fn(value)
|
|
746
|
+
};
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
((map2) => {
|
|
751
|
+
function indexed(...args) {
|
|
752
|
+
return purry(_map(true), args, map2.lazyIndexed);
|
|
753
|
+
}
|
|
754
|
+
map2.indexed = indexed;
|
|
755
|
+
map2.lazy = _lazy5(false);
|
|
756
|
+
map2.lazyIndexed = toLazyIndexed(_lazy5(true));
|
|
757
|
+
map2.strict = map2;
|
|
758
|
+
})(map || (map = {}));
|
|
759
|
+
function mapToObj(...args) {
|
|
760
|
+
return purry(_mapToObj(false), args);
|
|
761
|
+
}
|
|
762
|
+
function _mapToObj(indexed) {
|
|
763
|
+
return (array, fn) => {
|
|
764
|
+
return array.reduce((result, element, index) => {
|
|
765
|
+
const [key, value] = indexed ? fn(element, index, array) : fn(element);
|
|
766
|
+
result[key] = value;
|
|
767
|
+
return result;
|
|
768
|
+
}, {});
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
((mapToObj2) => {
|
|
772
|
+
function indexed(...args) {
|
|
773
|
+
return purry(_mapToObj(true), args);
|
|
774
|
+
}
|
|
775
|
+
mapToObj2.indexed = indexed;
|
|
776
|
+
})(mapToObj || (mapToObj = {}));
|
|
777
|
+
function _maxBy(indexed) {
|
|
778
|
+
return (array, fn) => {
|
|
779
|
+
let ret;
|
|
780
|
+
let retMax;
|
|
781
|
+
array.forEach((item, i) => {
|
|
782
|
+
const max = indexed ? fn(item, i, array) : fn(item);
|
|
783
|
+
if (retMax === void 0 || max > retMax) {
|
|
784
|
+
ret = item;
|
|
785
|
+
retMax = max;
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
return ret;
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
function maxBy(...args) {
|
|
792
|
+
return purry(_maxBy(false), args);
|
|
793
|
+
}
|
|
794
|
+
((maxBy2) => {
|
|
795
|
+
function indexed(...args) {
|
|
796
|
+
return purry(_maxBy(true), args);
|
|
797
|
+
}
|
|
798
|
+
maxBy2.indexed = indexed;
|
|
799
|
+
})(maxBy || (maxBy = {}));
|
|
800
|
+
function _meanBy(indexed) {
|
|
801
|
+
return (array, fn) => {
|
|
802
|
+
if (array.length === 0) {
|
|
803
|
+
return Number.NaN;
|
|
804
|
+
}
|
|
805
|
+
let sum = 0;
|
|
806
|
+
array.forEach((item, i) => {
|
|
807
|
+
sum += indexed ? fn(item, i, array) : fn(item);
|
|
808
|
+
});
|
|
809
|
+
return sum / array.length;
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
function meanBy(...args) {
|
|
813
|
+
return purry(_meanBy(false), args);
|
|
814
|
+
}
|
|
815
|
+
((meanBy2) => {
|
|
816
|
+
function indexed(...args) {
|
|
817
|
+
return purry(_meanBy(true), args);
|
|
818
|
+
}
|
|
819
|
+
meanBy2.indexed = indexed;
|
|
820
|
+
})(meanBy || (meanBy = {}));
|
|
821
|
+
function _minBy(indexed) {
|
|
822
|
+
return (array, fn) => {
|
|
823
|
+
let ret;
|
|
824
|
+
let retMin;
|
|
825
|
+
array.forEach((item, i) => {
|
|
826
|
+
const min = indexed ? fn(item, i, array) : fn(item);
|
|
827
|
+
if (retMin === void 0 || min < retMin) {
|
|
828
|
+
ret = item;
|
|
829
|
+
retMin = min;
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
return ret;
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function minBy(...args) {
|
|
836
|
+
return purry(_minBy(false), args);
|
|
837
|
+
}
|
|
838
|
+
((minBy2) => {
|
|
839
|
+
function indexed(...args) {
|
|
840
|
+
return purry(_minBy(true), args);
|
|
841
|
+
}
|
|
842
|
+
minBy2.indexed = indexed;
|
|
843
|
+
})(minBy || (minBy = {}));
|
|
844
|
+
function partition(...args) {
|
|
845
|
+
return purry(_partition(false), args);
|
|
846
|
+
}
|
|
847
|
+
function _partition(indexed) {
|
|
848
|
+
return (array, fn) => {
|
|
849
|
+
const ret = [[], []];
|
|
850
|
+
array.forEach((item, index) => {
|
|
851
|
+
const matches = indexed ? fn(item, index, array) : fn(item);
|
|
852
|
+
ret[matches ? 0 : 1].push(item);
|
|
853
|
+
});
|
|
854
|
+
return ret;
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
((partition2) => {
|
|
858
|
+
function indexed(...args) {
|
|
859
|
+
return purry(_partition(true), args);
|
|
860
|
+
}
|
|
861
|
+
partition2.indexed = indexed;
|
|
862
|
+
})(partition || (partition = {}));
|
|
863
|
+
function reduce(...args) {
|
|
864
|
+
return purry(_reduce(false), args);
|
|
865
|
+
}
|
|
866
|
+
function _reduce(indexed) {
|
|
867
|
+
return (items, fn, initialValue) => {
|
|
868
|
+
return items.reduce(
|
|
869
|
+
(acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
|
|
870
|
+
initialValue
|
|
871
|
+
);
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
((reduce2) => {
|
|
875
|
+
function indexed(...args) {
|
|
876
|
+
return purry(_reduce(true), args);
|
|
877
|
+
}
|
|
878
|
+
reduce2.indexed = indexed;
|
|
879
|
+
})(reduce || (reduce = {}));
|
|
880
|
+
function reject(...args) {
|
|
881
|
+
return purry(_reject(false), args, reject.lazy);
|
|
882
|
+
}
|
|
883
|
+
function _reject(indexed) {
|
|
884
|
+
return (array, fn) => {
|
|
885
|
+
return _reduceLazy(
|
|
886
|
+
array,
|
|
887
|
+
indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
|
|
888
|
+
indexed
|
|
889
|
+
);
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function _lazy6(indexed) {
|
|
893
|
+
return (fn) => {
|
|
894
|
+
return (value, index, array) => {
|
|
895
|
+
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
896
|
+
if (!valid) {
|
|
897
|
+
return {
|
|
898
|
+
done: false,
|
|
899
|
+
hasNext: true,
|
|
900
|
+
next: value
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
return {
|
|
904
|
+
done: false,
|
|
905
|
+
hasNext: false
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
((reject2) => {
|
|
911
|
+
function indexed(...args) {
|
|
912
|
+
return purry(_reject(true), args, reject2.lazyIndexed);
|
|
913
|
+
}
|
|
914
|
+
reject2.indexed = indexed;
|
|
915
|
+
reject2.lazy = _lazy6(false);
|
|
916
|
+
reject2.lazyIndexed = toLazyIndexed(_lazy6(true));
|
|
917
|
+
})(reject || (reject = {}));
|
|
918
|
+
function sort(...args) {
|
|
919
|
+
return purry(_sort, args);
|
|
920
|
+
}
|
|
921
|
+
function _sort(items, cmp) {
|
|
922
|
+
const ret = [...items];
|
|
923
|
+
ret.sort(cmp);
|
|
924
|
+
return ret;
|
|
925
|
+
}
|
|
926
|
+
((sort2) => {
|
|
927
|
+
sort2.strict = sort2;
|
|
928
|
+
})(sort || (sort = {}));
|
|
929
|
+
var ALL_DIRECTIONS = ["asc", "desc"];
|
|
930
|
+
var COMPARATOR = {
|
|
931
|
+
asc: (x, y) => x > y,
|
|
932
|
+
desc: (x, y) => x < y
|
|
933
|
+
};
|
|
934
|
+
function sortBy(arrayOrSortRule, ...sortRules) {
|
|
935
|
+
const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
|
|
936
|
+
return purry(_sortBy, args);
|
|
937
|
+
}
|
|
938
|
+
function isSortRule(x) {
|
|
939
|
+
if (typeof x === "function") {
|
|
940
|
+
return true;
|
|
941
|
+
}
|
|
942
|
+
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
943
|
+
if (rest.length > 0) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
return typeof maybeProjection === "function" && ALL_DIRECTIONS.includes(maybeDirection);
|
|
947
|
+
}
|
|
948
|
+
function _sortBy(array, sorts) {
|
|
949
|
+
return [...array].sort(comparer(...sorts));
|
|
950
|
+
}
|
|
951
|
+
function comparer(primaryRule, secondaryRule, ...otherRules) {
|
|
952
|
+
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
953
|
+
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
954
|
+
const comparator = COMPARATOR[direction];
|
|
955
|
+
const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
|
|
956
|
+
return (a, b) => {
|
|
957
|
+
const projectedA = projector(a);
|
|
958
|
+
const projectedB = projector(b);
|
|
959
|
+
if (comparator(projectedA, projectedB)) {
|
|
960
|
+
return 1;
|
|
961
|
+
}
|
|
962
|
+
if (comparator(projectedB, projectedA)) {
|
|
963
|
+
return -1;
|
|
964
|
+
}
|
|
965
|
+
return nextComparer?.(a, b) ?? 0;
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
((sortBy2) => {
|
|
969
|
+
sortBy2.strict = sortBy2;
|
|
970
|
+
})(sortBy || (sortBy = {}));
|
|
971
|
+
function _sumBy(indexed) {
|
|
972
|
+
return (array, fn) => {
|
|
973
|
+
let sum = 0;
|
|
974
|
+
array.forEach((item, i) => {
|
|
975
|
+
const summand = indexed ? fn(item, i, array) : fn(item);
|
|
976
|
+
sum += summand;
|
|
977
|
+
});
|
|
978
|
+
return sum;
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
function sumBy(...args) {
|
|
982
|
+
return purry(_sumBy(false), args);
|
|
983
|
+
}
|
|
984
|
+
((sumBy2) => {
|
|
985
|
+
function indexed(...args) {
|
|
986
|
+
return purry(_sumBy(true), args);
|
|
987
|
+
}
|
|
988
|
+
sumBy2.indexed = indexed;
|
|
989
|
+
})(sumBy || (sumBy = {}));
|
|
990
|
+
function take(...args) {
|
|
991
|
+
return purry(_take, args, take.lazy);
|
|
992
|
+
}
|
|
993
|
+
function _take(array, n) {
|
|
994
|
+
return _reduceLazy(array, take.lazy(n));
|
|
995
|
+
}
|
|
996
|
+
((take2) => {
|
|
997
|
+
function lazy(n) {
|
|
998
|
+
return (value) => {
|
|
999
|
+
if (n === 0) {
|
|
1000
|
+
return {
|
|
1001
|
+
done: true,
|
|
1002
|
+
hasNext: false
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
n--;
|
|
1006
|
+
if (n === 0) {
|
|
1007
|
+
return {
|
|
1008
|
+
done: true,
|
|
1009
|
+
hasNext: true,
|
|
1010
|
+
next: value
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
return {
|
|
1014
|
+
done: false,
|
|
1015
|
+
hasNext: true,
|
|
1016
|
+
next: value
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
take2.lazy = lazy;
|
|
1021
|
+
})(take || (take = {}));
|
|
1022
|
+
function uniq(...args) {
|
|
1023
|
+
return purry(_uniq, args, uniq.lazy);
|
|
138
1024
|
}
|
|
139
1025
|
function _uniq(array) {
|
|
140
1026
|
return _reduceLazy(array, uniq.lazy());
|
|
141
1027
|
}
|
|
142
|
-
(
|
|
1028
|
+
((uniq2) => {
|
|
143
1029
|
function lazy() {
|
|
144
|
-
const
|
|
1030
|
+
const set2 = /* @__PURE__ */ new Set();
|
|
145
1031
|
return (value) => {
|
|
146
|
-
if (
|
|
1032
|
+
if (set2.has(value)) {
|
|
147
1033
|
return {
|
|
148
1034
|
done: false,
|
|
149
1035
|
hasNext: false
|
|
150
1036
|
};
|
|
151
1037
|
}
|
|
152
|
-
|
|
1038
|
+
set2.add(value);
|
|
153
1039
|
return {
|
|
154
1040
|
done: false,
|
|
155
1041
|
hasNext: true,
|
|
@@ -159,59 +1045,81 @@ function _uniq(array) {
|
|
|
159
1045
|
}
|
|
160
1046
|
uniq2.lazy = lazy;
|
|
161
1047
|
})(uniq || (uniq = {}));
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
rules: {
|
|
203
|
-
"eslint-comments/no-aggregating-enable": ERROR,
|
|
204
|
-
"eslint-comments/no-duplicate-disable": ERROR,
|
|
205
|
-
"eslint-comments/no-unlimited-disable": ERROR,
|
|
206
|
-
"eslint-comments/no-unused-enable": ERROR
|
|
1048
|
+
function uniqWith(...args) {
|
|
1049
|
+
return purry(_uniqWith, args, uniqWith.lazy);
|
|
1050
|
+
}
|
|
1051
|
+
function _uniqWith(array, isEquals) {
|
|
1052
|
+
const lazy = uniqWith.lazy(isEquals);
|
|
1053
|
+
return _reduceLazy(array, lazy, true);
|
|
1054
|
+
}
|
|
1055
|
+
function _lazy7(isEquals) {
|
|
1056
|
+
return (value, index, array) => {
|
|
1057
|
+
if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
|
|
1058
|
+
return {
|
|
1059
|
+
done: false,
|
|
1060
|
+
hasNext: true,
|
|
1061
|
+
next: value
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
return {
|
|
1065
|
+
done: false,
|
|
1066
|
+
hasNext: false
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
((uniqWith2) => {
|
|
1071
|
+
uniqWith2.lazy = toLazyIndexed(_lazy7);
|
|
1072
|
+
})(uniqWith || (uniqWith = {}));
|
|
1073
|
+
var isArray2 = Array.isArray;
|
|
1074
|
+
function forEachObj(...args) {
|
|
1075
|
+
return purry(_forEachObj(false), args);
|
|
1076
|
+
}
|
|
1077
|
+
function _forEachObj(indexed) {
|
|
1078
|
+
return (object, fn) => {
|
|
1079
|
+
for (const key in object) {
|
|
1080
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
1081
|
+
const val = object[key];
|
|
1082
|
+
if (indexed) {
|
|
1083
|
+
fn(val, key, object);
|
|
1084
|
+
} else {
|
|
1085
|
+
fn(val);
|
|
1086
|
+
}
|
|
207
1087
|
}
|
|
208
1088
|
}
|
|
209
|
-
|
|
1089
|
+
return object;
|
|
1090
|
+
};
|
|
210
1091
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
1092
|
+
((forEachObj2) => {
|
|
1093
|
+
function indexed(...args) {
|
|
1094
|
+
return purry(_forEachObj(true), args);
|
|
1095
|
+
}
|
|
1096
|
+
forEachObj2.indexed = indexed;
|
|
1097
|
+
})(forEachObj || (forEachObj = {}));
|
|
1098
|
+
function fromPairs(entries) {
|
|
1099
|
+
const out = {};
|
|
1100
|
+
for (const [key, value] of entries) {
|
|
1101
|
+
out[key] = value;
|
|
1102
|
+
}
|
|
1103
|
+
return out;
|
|
1104
|
+
}
|
|
1105
|
+
((fromPairs2) => {
|
|
1106
|
+
fromPairs2.strict = fromPairs2;
|
|
1107
|
+
})(fromPairs || (fromPairs = {}));
|
|
1108
|
+
function keys(source) {
|
|
1109
|
+
return Object.keys(source);
|
|
1110
|
+
}
|
|
1111
|
+
((keys2) => {
|
|
1112
|
+
keys2.strict = keys2;
|
|
1113
|
+
})(keys || (keys = {}));
|
|
1114
|
+
function toPairs(object) {
|
|
1115
|
+
return Object.entries(object);
|
|
1116
|
+
}
|
|
1117
|
+
((toPairs2) => {
|
|
1118
|
+
function strict(object) {
|
|
1119
|
+
return Object.entries(object);
|
|
1120
|
+
}
|
|
1121
|
+
toPairs2.strict = strict;
|
|
1122
|
+
})(toPairs || (toPairs = {}));
|
|
215
1123
|
|
|
216
1124
|
// src/globs.ts
|
|
217
1125
|
var GLOB_JS = "**/*.?([cm])js";
|
|
@@ -586,6 +1494,7 @@ function javascript(options = {}) {
|
|
|
586
1494
|
argsIgnorePattern: "^_",
|
|
587
1495
|
ignoreRestSiblings: true
|
|
588
1496
|
}],
|
|
1497
|
+
...import_eslint_plugin_vinicunca.default.configs.recommended.rules,
|
|
589
1498
|
...overrides
|
|
590
1499
|
}
|
|
591
1500
|
},
|
|
@@ -1296,7 +2205,7 @@ function typescript(options) {
|
|
|
1296
2205
|
componentExts = [],
|
|
1297
2206
|
overrides = {},
|
|
1298
2207
|
parserOptions = {},
|
|
1299
|
-
tsconfigPath
|
|
2208
|
+
tsconfigPath = []
|
|
1300
2209
|
} = options ?? {};
|
|
1301
2210
|
const typeAwareRules = {
|
|
1302
2211
|
"dot-notation": OFF,
|
|
@@ -1309,16 +2218,19 @@ function typescript(options) {
|
|
|
1309
2218
|
"ts/no-implied-eval": ERROR,
|
|
1310
2219
|
"ts/no-misused-promises": ERROR,
|
|
1311
2220
|
"ts/no-throw-literal": ERROR,
|
|
1312
|
-
"ts/no-unnecessary-type-assertion": ERROR,
|
|
1313
|
-
"ts/no-unsafe-argument": ERROR,
|
|
1314
|
-
"ts/no-unsafe-assignment": ERROR,
|
|
1315
|
-
"ts/no-unsafe-call": ERROR,
|
|
1316
|
-
"ts/no-unsafe-member-access": ERROR,
|
|
1317
|
-
"ts/no-unsafe-return": ERROR,
|
|
1318
2221
|
"ts/restrict-plus-operands": ERROR,
|
|
1319
2222
|
"ts/restrict-template-expressions": ERROR,
|
|
1320
2223
|
"ts/unbound-method": ERROR
|
|
1321
2224
|
};
|
|
2225
|
+
let tsConfigOptions = {};
|
|
2226
|
+
let additionalTypeAwareRules = {};
|
|
2227
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2228
|
+
tsConfigOptions = {
|
|
2229
|
+
project: tsconfigPath,
|
|
2230
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
2231
|
+
};
|
|
2232
|
+
additionalTypeAwareRules = typeAwareRules;
|
|
2233
|
+
}
|
|
1322
2234
|
return [
|
|
1323
2235
|
{
|
|
1324
2236
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1339,10 +2251,7 @@ function typescript(options) {
|
|
|
1339
2251
|
parser: parserTs,
|
|
1340
2252
|
parserOptions: {
|
|
1341
2253
|
sourceType: "module",
|
|
1342
|
-
...
|
|
1343
|
-
project: [tsconfigPath],
|
|
1344
|
-
tsconfigRootDir: import_node_process.default.cwd()
|
|
1345
|
-
} : {},
|
|
2254
|
+
...tsConfigOptions,
|
|
1346
2255
|
...parserOptions
|
|
1347
2256
|
}
|
|
1348
2257
|
},
|
|
@@ -1396,7 +2305,7 @@ function typescript(options) {
|
|
|
1396
2305
|
"vinicunca/named-tuple-spacing": ERROR,
|
|
1397
2306
|
"vinicunca/no-cjs-exports": ERROR,
|
|
1398
2307
|
"vinicunca/no-ts-export-equal": ERROR,
|
|
1399
|
-
...
|
|
2308
|
+
...additionalTypeAwareRules,
|
|
1400
2309
|
...overrides
|
|
1401
2310
|
}
|
|
1402
2311
|
},
|
|
@@ -1459,10 +2368,20 @@ function unicorn(options = {}) {
|
|
|
1459
2368
|
}
|
|
1460
2369
|
|
|
1461
2370
|
// src/configs/vue.ts
|
|
2371
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1462
2372
|
function vue(options = {}) {
|
|
1463
2373
|
const {
|
|
2374
|
+
typescript: typescript2 = {},
|
|
1464
2375
|
overrides = {}
|
|
1465
2376
|
} = options;
|
|
2377
|
+
let tsConfigOptions = {};
|
|
2378
|
+
const tsconfigPath = typescript2.tsconfigPath ?? [];
|
|
2379
|
+
if (!isEmpty(tsconfigPath)) {
|
|
2380
|
+
tsConfigOptions = {
|
|
2381
|
+
project: tsconfigPath,
|
|
2382
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
1466
2385
|
return [
|
|
1467
2386
|
{
|
|
1468
2387
|
name: "vinicunca:vue:setup",
|
|
@@ -1480,8 +2399,9 @@ function vue(options = {}) {
|
|
|
1480
2399
|
jsx: true
|
|
1481
2400
|
},
|
|
1482
2401
|
extraFileExtensions: [".vue"],
|
|
1483
|
-
parser:
|
|
1484
|
-
sourceType: "module"
|
|
2402
|
+
parser: typescript2.enabled ? parserTs : void 0,
|
|
2403
|
+
sourceType: "module",
|
|
2404
|
+
...tsConfigOptions
|
|
1485
2405
|
}
|
|
1486
2406
|
},
|
|
1487
2407
|
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
@@ -1634,9 +2554,9 @@ var VuePackages = [
|
|
|
1634
2554
|
];
|
|
1635
2555
|
function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
1636
2556
|
const {
|
|
1637
|
-
isInEditor = !!((
|
|
2557
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
|
|
1638
2558
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg.isPackageExists)(i)),
|
|
1639
|
-
typescript:
|
|
2559
|
+
typescript: tsOptions = {},
|
|
1640
2560
|
stylistic: enableStylistic = true,
|
|
1641
2561
|
test: enableTest = true,
|
|
1642
2562
|
jsonc: enableJsonc = true,
|
|
@@ -1661,9 +2581,13 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
1661
2581
|
if (enableVue) {
|
|
1662
2582
|
componentExts.push("vue");
|
|
1663
2583
|
}
|
|
1664
|
-
|
|
2584
|
+
const {
|
|
2585
|
+
enabled: tsEnabled = (0, import_local_pkg.isPackageExists)("typescript"),
|
|
2586
|
+
...tsParams
|
|
2587
|
+
} = tsOptions;
|
|
2588
|
+
if (tsEnabled) {
|
|
1665
2589
|
configs.push(typescript({
|
|
1666
|
-
|
|
2590
|
+
...tsParams,
|
|
1667
2591
|
componentExts,
|
|
1668
2592
|
overrides: overrides.typescript
|
|
1669
2593
|
}));
|
|
@@ -1680,7 +2604,10 @@ function vinicuncaESLint({ options = {}, userConfigs = [] } = {}) {
|
|
|
1680
2604
|
;
|
|
1681
2605
|
if (enableVue) {
|
|
1682
2606
|
configs.push(vue({
|
|
1683
|
-
typescript:
|
|
2607
|
+
typescript: {
|
|
2608
|
+
enabled: tsEnabled,
|
|
2609
|
+
...tsParams
|
|
2610
|
+
},
|
|
1684
2611
|
overrides: overrides.vue
|
|
1685
2612
|
}));
|
|
1686
2613
|
}
|