@eslint-react/shared 1.5.31-next.3 → 1.6.0-next.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.d.mts +247 -14
- package/dist/index.d.ts +247 -14
- package/dist/index.js +442 -34
- package/dist/index.mjs +441 -34
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -223,9 +223,9 @@ function _stringify(input) {
|
|
|
223
223
|
return type;
|
|
224
224
|
}
|
|
225
225
|
function _addIssue(context, label, dataset, config2, other) {
|
|
226
|
-
const input = dataset.value;
|
|
227
|
-
const expected = context.expects ?? null;
|
|
228
|
-
const received = _stringify(input);
|
|
226
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
227
|
+
const expected = other?.expected ?? context.expects ?? null;
|
|
228
|
+
const received = other?.received ?? _stringify(input);
|
|
229
229
|
const issue = {
|
|
230
230
|
kind: context.kind,
|
|
231
231
|
type: context.type,
|
|
@@ -242,7 +242,7 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
242
242
|
abortPipeEarly: config2.abortPipeEarly
|
|
243
243
|
};
|
|
244
244
|
const isSchema = context.kind === "schema";
|
|
245
|
-
const message = // @ts-expect-error
|
|
245
|
+
const message = other?.message ?? // @ts-expect-error
|
|
246
246
|
context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
|
|
247
247
|
if (message) {
|
|
248
248
|
issue.message = typeof message === "function" ? message(issue) : message;
|
|
@@ -458,6 +458,78 @@ function string(message) {
|
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
|
+
function _subIssues(datasets) {
|
|
462
|
+
let issues;
|
|
463
|
+
if (datasets) {
|
|
464
|
+
for (const dataset of datasets) {
|
|
465
|
+
if (issues) {
|
|
466
|
+
issues.push(...dataset.issues);
|
|
467
|
+
} else {
|
|
468
|
+
issues = dataset.issues;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return issues;
|
|
473
|
+
}
|
|
474
|
+
function union(options, message) {
|
|
475
|
+
return {
|
|
476
|
+
kind: "schema",
|
|
477
|
+
type: "union",
|
|
478
|
+
reference: union,
|
|
479
|
+
expects: [...new Set(options.map((option) => option.expects))].join(" | ") || "never",
|
|
480
|
+
async: false,
|
|
481
|
+
options,
|
|
482
|
+
message,
|
|
483
|
+
_run(dataset, config2) {
|
|
484
|
+
let validDataset;
|
|
485
|
+
let typedDatasets;
|
|
486
|
+
let untypedDatasets;
|
|
487
|
+
for (const schema of this.options) {
|
|
488
|
+
const optionDataset = schema._run(
|
|
489
|
+
{ typed: false, value: dataset.value },
|
|
490
|
+
config2
|
|
491
|
+
);
|
|
492
|
+
if (optionDataset.typed) {
|
|
493
|
+
if (optionDataset.issues) {
|
|
494
|
+
if (typedDatasets) {
|
|
495
|
+
typedDatasets.push(optionDataset);
|
|
496
|
+
} else {
|
|
497
|
+
typedDatasets = [optionDataset];
|
|
498
|
+
}
|
|
499
|
+
} else {
|
|
500
|
+
validDataset = optionDataset;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
} else {
|
|
504
|
+
if (untypedDatasets) {
|
|
505
|
+
untypedDatasets.push(optionDataset);
|
|
506
|
+
} else {
|
|
507
|
+
untypedDatasets = [optionDataset];
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (validDataset) {
|
|
512
|
+
return validDataset;
|
|
513
|
+
}
|
|
514
|
+
if (typedDatasets) {
|
|
515
|
+
if (typedDatasets.length === 1) {
|
|
516
|
+
return typedDatasets[0];
|
|
517
|
+
}
|
|
518
|
+
_addIssue(this, "type", dataset, config2, {
|
|
519
|
+
issues: _subIssues(typedDatasets)
|
|
520
|
+
});
|
|
521
|
+
dataset.typed = true;
|
|
522
|
+
} else if (untypedDatasets?.length === 1) {
|
|
523
|
+
return untypedDatasets[0];
|
|
524
|
+
} else {
|
|
525
|
+
_addIssue(this, "type", dataset, config2, {
|
|
526
|
+
issues: _subIssues(untypedDatasets)
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
return dataset;
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
461
533
|
function parse(schema, input, config2) {
|
|
462
534
|
const dataset = schema._run(
|
|
463
535
|
{ typed: false, value: input },
|
|
@@ -487,32 +559,66 @@ var CustomAttributeSchema = object({
|
|
|
487
559
|
*/
|
|
488
560
|
as: optional(string()),
|
|
489
561
|
/**
|
|
490
|
-
*
|
|
491
|
-
* @example
|
|
492
|
-
* `"/"`
|
|
493
|
-
*/
|
|
494
|
-
defaultValue: optional(string())
|
|
495
|
-
});
|
|
496
|
-
var CustomComponentSchema = object({
|
|
497
|
-
/**
|
|
498
|
-
* The name of the user-defined component.
|
|
562
|
+
* Whether the attribute is controlled or not in the user-defined component.
|
|
499
563
|
* @example
|
|
500
|
-
*
|
|
564
|
+
* `true`
|
|
501
565
|
*/
|
|
502
|
-
|
|
566
|
+
controlled: optional(boolean()),
|
|
503
567
|
/**
|
|
504
|
-
* The
|
|
505
|
-
* @example
|
|
506
|
-
* "a"
|
|
507
|
-
*/
|
|
508
|
-
as: string(),
|
|
509
|
-
/**
|
|
510
|
-
* Pre-defined attributes that are used in the user-defined component.
|
|
568
|
+
* The default value of the attribute in the user-defined component.
|
|
511
569
|
* @example
|
|
512
|
-
* `
|
|
570
|
+
* `"/"`
|
|
513
571
|
*/
|
|
514
|
-
|
|
572
|
+
defaultValue: optional(string())
|
|
515
573
|
});
|
|
574
|
+
var CustomComponentSchema = union([
|
|
575
|
+
object({
|
|
576
|
+
/**
|
|
577
|
+
* The name of the user-defined component.
|
|
578
|
+
* @example
|
|
579
|
+
* "Link"
|
|
580
|
+
*/
|
|
581
|
+
name: string(),
|
|
582
|
+
/**
|
|
583
|
+
* The name of the built-in component that the user-defined component represents.
|
|
584
|
+
* @example
|
|
585
|
+
* "a"
|
|
586
|
+
*/
|
|
587
|
+
as: optional(string()),
|
|
588
|
+
/**
|
|
589
|
+
* Pre-defined attributes that are used in the user-defined component.
|
|
590
|
+
* @example
|
|
591
|
+
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
592
|
+
*/
|
|
593
|
+
attributes: optional(array(CustomAttributeSchema))
|
|
594
|
+
}),
|
|
595
|
+
object({
|
|
596
|
+
/**
|
|
597
|
+
* The name of the user-defined component.
|
|
598
|
+
* @example
|
|
599
|
+
* "Link"
|
|
600
|
+
*/
|
|
601
|
+
name: string(),
|
|
602
|
+
/**
|
|
603
|
+
* The ESQuery selector to select the component precisely.
|
|
604
|
+
* @example
|
|
605
|
+
* `:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
606
|
+
*/
|
|
607
|
+
selector: string(),
|
|
608
|
+
/**
|
|
609
|
+
* The name of the built-in component that the user-defined component represents.
|
|
610
|
+
* @example
|
|
611
|
+
* "a"
|
|
612
|
+
*/
|
|
613
|
+
as: string(),
|
|
614
|
+
/**
|
|
615
|
+
* Pre-defined attributes that are used in the user-defined component.
|
|
616
|
+
* @example
|
|
617
|
+
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
618
|
+
*/
|
|
619
|
+
attributes: optional(array(CustomAttributeSchema))
|
|
620
|
+
})
|
|
621
|
+
]);
|
|
516
622
|
var ESLintReactSettingsSchema = object({
|
|
517
623
|
importSource: optional(string()),
|
|
518
624
|
jsxPragma: optional(string()),
|
|
@@ -541,18 +647,319 @@ var ESLintReactSettingsSchema = object({
|
|
|
541
647
|
useTransition: optional(array(string()))
|
|
542
648
|
}))
|
|
543
649
|
});
|
|
544
|
-
var ESLintSettingsSchema =
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
650
|
+
var ESLintSettingsSchema = optional(
|
|
651
|
+
object({
|
|
652
|
+
"react-x": optional(ESLintReactSettingsSchema, {}),
|
|
653
|
+
/**
|
|
654
|
+
* @internal
|
|
655
|
+
* @deprecated
|
|
656
|
+
*/
|
|
657
|
+
reactOptions: optional(ESLintReactSettingsSchema, {})
|
|
658
|
+
}),
|
|
659
|
+
{}
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
// ../../node_modules/.pnpm/micro-memoize@4.1.2/node_modules/micro-memoize/dist/micro-memoize.esm.js
|
|
663
|
+
var DEFAULT_OPTIONS_KEYS = {
|
|
664
|
+
isEqual: true,
|
|
665
|
+
isMatchingKey: true,
|
|
666
|
+
isPromise: true,
|
|
667
|
+
maxSize: true,
|
|
668
|
+
onCacheAdd: true,
|
|
669
|
+
onCacheChange: true,
|
|
670
|
+
onCacheHit: true,
|
|
671
|
+
transformKey: true
|
|
672
|
+
};
|
|
673
|
+
var slice = Array.prototype.slice;
|
|
674
|
+
function cloneArray(arrayLike) {
|
|
675
|
+
var length = arrayLike.length;
|
|
676
|
+
if (!length) {
|
|
677
|
+
return [];
|
|
678
|
+
}
|
|
679
|
+
if (length === 1) {
|
|
680
|
+
return [arrayLike[0]];
|
|
681
|
+
}
|
|
682
|
+
if (length === 2) {
|
|
683
|
+
return [arrayLike[0], arrayLike[1]];
|
|
684
|
+
}
|
|
685
|
+
if (length === 3) {
|
|
686
|
+
return [arrayLike[0], arrayLike[1], arrayLike[2]];
|
|
687
|
+
}
|
|
688
|
+
return slice.call(arrayLike, 0);
|
|
689
|
+
}
|
|
690
|
+
function getCustomOptions(options) {
|
|
691
|
+
var customOptions = {};
|
|
692
|
+
for (var key in options) {
|
|
693
|
+
if (!DEFAULT_OPTIONS_KEYS[key]) {
|
|
694
|
+
customOptions[key] = options[key];
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return customOptions;
|
|
698
|
+
}
|
|
699
|
+
function isMemoized(fn) {
|
|
700
|
+
return typeof fn === "function" && fn.isMemoized;
|
|
701
|
+
}
|
|
702
|
+
function isSameValueZero(object1, object2) {
|
|
703
|
+
return object1 === object2 || object1 !== object1 && object2 !== object2;
|
|
704
|
+
}
|
|
705
|
+
function mergeOptions(existingOptions, newOptions) {
|
|
706
|
+
var target = {};
|
|
707
|
+
for (var key in existingOptions) {
|
|
708
|
+
target[key] = existingOptions[key];
|
|
709
|
+
}
|
|
710
|
+
for (var key in newOptions) {
|
|
711
|
+
target[key] = newOptions[key];
|
|
712
|
+
}
|
|
713
|
+
return target;
|
|
714
|
+
}
|
|
715
|
+
var Cache = (
|
|
716
|
+
/** @class */
|
|
717
|
+
function() {
|
|
718
|
+
function Cache2(options) {
|
|
719
|
+
this.keys = [];
|
|
720
|
+
this.values = [];
|
|
721
|
+
this.options = options;
|
|
722
|
+
var isMatchingKeyFunction = typeof options.isMatchingKey === "function";
|
|
723
|
+
if (isMatchingKeyFunction) {
|
|
724
|
+
this.getKeyIndex = this._getKeyIndexFromMatchingKey;
|
|
725
|
+
} else if (options.maxSize > 1) {
|
|
726
|
+
this.getKeyIndex = this._getKeyIndexForMany;
|
|
727
|
+
} else {
|
|
728
|
+
this.getKeyIndex = this._getKeyIndexForSingle;
|
|
729
|
+
}
|
|
730
|
+
this.canTransformKey = typeof options.transformKey === "function";
|
|
731
|
+
this.shouldCloneArguments = this.canTransformKey || isMatchingKeyFunction;
|
|
732
|
+
this.shouldUpdateOnAdd = typeof options.onCacheAdd === "function";
|
|
733
|
+
this.shouldUpdateOnChange = typeof options.onCacheChange === "function";
|
|
734
|
+
this.shouldUpdateOnHit = typeof options.onCacheHit === "function";
|
|
735
|
+
}
|
|
736
|
+
Object.defineProperty(Cache2.prototype, "size", {
|
|
737
|
+
/**
|
|
738
|
+
* The number of cached [key,value] results.
|
|
739
|
+
*/
|
|
740
|
+
get: function() {
|
|
741
|
+
return this.keys.length;
|
|
742
|
+
},
|
|
743
|
+
enumerable: false,
|
|
744
|
+
configurable: true
|
|
745
|
+
});
|
|
746
|
+
Object.defineProperty(Cache2.prototype, "snapshot", {
|
|
747
|
+
/**
|
|
748
|
+
* A copy of the cache at a moment in time. This is useful
|
|
749
|
+
* to compare changes over time, since the cache mutates
|
|
750
|
+
* internally for performance reasons.
|
|
751
|
+
*/
|
|
752
|
+
get: function() {
|
|
753
|
+
return {
|
|
754
|
+
keys: cloneArray(this.keys),
|
|
755
|
+
size: this.size,
|
|
756
|
+
values: cloneArray(this.values)
|
|
757
|
+
};
|
|
758
|
+
},
|
|
759
|
+
enumerable: false,
|
|
760
|
+
configurable: true
|
|
761
|
+
});
|
|
762
|
+
Cache2.prototype._getKeyIndexFromMatchingKey = function(keyToMatch) {
|
|
763
|
+
var _a = this.options, isMatchingKey = _a.isMatchingKey, maxSize = _a.maxSize;
|
|
764
|
+
var keys = this.keys;
|
|
765
|
+
var keysLength = keys.length;
|
|
766
|
+
if (!keysLength) {
|
|
767
|
+
return -1;
|
|
768
|
+
}
|
|
769
|
+
if (isMatchingKey(keys[0], keyToMatch)) {
|
|
770
|
+
return 0;
|
|
771
|
+
}
|
|
772
|
+
if (maxSize > 1) {
|
|
773
|
+
for (var index = 1; index < keysLength; index++) {
|
|
774
|
+
if (isMatchingKey(keys[index], keyToMatch)) {
|
|
775
|
+
return index;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return -1;
|
|
780
|
+
};
|
|
781
|
+
Cache2.prototype._getKeyIndexForMany = function(keyToMatch) {
|
|
782
|
+
var isEqual = this.options.isEqual;
|
|
783
|
+
var keys = this.keys;
|
|
784
|
+
var keysLength = keys.length;
|
|
785
|
+
if (!keysLength) {
|
|
786
|
+
return -1;
|
|
787
|
+
}
|
|
788
|
+
if (keysLength === 1) {
|
|
789
|
+
return this._getKeyIndexForSingle(keyToMatch);
|
|
790
|
+
}
|
|
791
|
+
var keyLength = keyToMatch.length;
|
|
792
|
+
var existingKey;
|
|
793
|
+
var argIndex;
|
|
794
|
+
if (keyLength > 1) {
|
|
795
|
+
for (var index = 0; index < keysLength; index++) {
|
|
796
|
+
existingKey = keys[index];
|
|
797
|
+
if (existingKey.length === keyLength) {
|
|
798
|
+
argIndex = 0;
|
|
799
|
+
for (; argIndex < keyLength; argIndex++) {
|
|
800
|
+
if (!isEqual(existingKey[argIndex], keyToMatch[argIndex])) {
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (argIndex === keyLength) {
|
|
805
|
+
return index;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
for (var index = 0; index < keysLength; index++) {
|
|
811
|
+
existingKey = keys[index];
|
|
812
|
+
if (existingKey.length === keyLength && isEqual(existingKey[0], keyToMatch[0])) {
|
|
813
|
+
return index;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return -1;
|
|
818
|
+
};
|
|
819
|
+
Cache2.prototype._getKeyIndexForSingle = function(keyToMatch) {
|
|
820
|
+
var keys = this.keys;
|
|
821
|
+
if (!keys.length) {
|
|
822
|
+
return -1;
|
|
823
|
+
}
|
|
824
|
+
var existingKey = keys[0];
|
|
825
|
+
var length = existingKey.length;
|
|
826
|
+
if (keyToMatch.length !== length) {
|
|
827
|
+
return -1;
|
|
828
|
+
}
|
|
829
|
+
var isEqual = this.options.isEqual;
|
|
830
|
+
if (length > 1) {
|
|
831
|
+
for (var index = 0; index < length; index++) {
|
|
832
|
+
if (!isEqual(existingKey[index], keyToMatch[index])) {
|
|
833
|
+
return -1;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
return 0;
|
|
837
|
+
}
|
|
838
|
+
return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
|
|
839
|
+
};
|
|
840
|
+
Cache2.prototype.orderByLru = function(key, value, startingIndex) {
|
|
841
|
+
var keys = this.keys;
|
|
842
|
+
var values = this.values;
|
|
843
|
+
var currentLength = keys.length;
|
|
844
|
+
var index = startingIndex;
|
|
845
|
+
while (index--) {
|
|
846
|
+
keys[index + 1] = keys[index];
|
|
847
|
+
values[index + 1] = values[index];
|
|
848
|
+
}
|
|
849
|
+
keys[0] = key;
|
|
850
|
+
values[0] = value;
|
|
851
|
+
var maxSize = this.options.maxSize;
|
|
852
|
+
if (currentLength === maxSize && startingIndex === currentLength) {
|
|
853
|
+
keys.pop();
|
|
854
|
+
values.pop();
|
|
855
|
+
} else if (startingIndex >= maxSize) {
|
|
856
|
+
keys.length = values.length = maxSize;
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
Cache2.prototype.updateAsyncCache = function(memoized) {
|
|
860
|
+
var _this = this;
|
|
861
|
+
var _a = this.options, onCacheChange = _a.onCacheChange, onCacheHit = _a.onCacheHit;
|
|
862
|
+
var firstKey = this.keys[0];
|
|
863
|
+
var firstValue = this.values[0];
|
|
864
|
+
this.values[0] = firstValue.then(function(value) {
|
|
865
|
+
if (_this.shouldUpdateOnHit) {
|
|
866
|
+
onCacheHit(_this, _this.options, memoized);
|
|
867
|
+
}
|
|
868
|
+
if (_this.shouldUpdateOnChange) {
|
|
869
|
+
onCacheChange(_this, _this.options, memoized);
|
|
870
|
+
}
|
|
871
|
+
return value;
|
|
872
|
+
}, function(error) {
|
|
873
|
+
var keyIndex = _this.getKeyIndex(firstKey);
|
|
874
|
+
if (keyIndex !== -1) {
|
|
875
|
+
_this.keys.splice(keyIndex, 1);
|
|
876
|
+
_this.values.splice(keyIndex, 1);
|
|
877
|
+
}
|
|
878
|
+
throw error;
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
return Cache2;
|
|
882
|
+
}()
|
|
883
|
+
);
|
|
884
|
+
function createMemoizedFunction(fn, options) {
|
|
885
|
+
if (options === void 0) {
|
|
886
|
+
options = {};
|
|
887
|
+
}
|
|
888
|
+
if (isMemoized(fn)) {
|
|
889
|
+
return createMemoizedFunction(fn.fn, mergeOptions(fn.options, options));
|
|
890
|
+
}
|
|
891
|
+
if (typeof fn !== "function") {
|
|
892
|
+
throw new TypeError("You must pass a function to `memoize`.");
|
|
893
|
+
}
|
|
894
|
+
var _a = options.isEqual, isEqual = _a === void 0 ? isSameValueZero : _a, isMatchingKey = options.isMatchingKey, _b = options.isPromise, isPromise = _b === void 0 ? false : _b, _c = options.maxSize, maxSize = _c === void 0 ? 1 : _c, onCacheAdd = options.onCacheAdd, onCacheChange = options.onCacheChange, onCacheHit = options.onCacheHit, transformKey = options.transformKey;
|
|
895
|
+
var normalizedOptions = mergeOptions({
|
|
896
|
+
isEqual,
|
|
897
|
+
isMatchingKey,
|
|
898
|
+
isPromise,
|
|
899
|
+
maxSize,
|
|
900
|
+
onCacheAdd,
|
|
901
|
+
onCacheChange,
|
|
902
|
+
onCacheHit,
|
|
903
|
+
transformKey
|
|
904
|
+
}, getCustomOptions(options));
|
|
905
|
+
var cache = new Cache(normalizedOptions);
|
|
906
|
+
var keys = cache.keys, values = cache.values, canTransformKey = cache.canTransformKey, shouldCloneArguments = cache.shouldCloneArguments, shouldUpdateOnAdd = cache.shouldUpdateOnAdd, shouldUpdateOnChange = cache.shouldUpdateOnChange, shouldUpdateOnHit = cache.shouldUpdateOnHit;
|
|
907
|
+
var memoized = function() {
|
|
908
|
+
var key = shouldCloneArguments ? cloneArray(arguments) : arguments;
|
|
909
|
+
if (canTransformKey) {
|
|
910
|
+
key = transformKey(key);
|
|
911
|
+
}
|
|
912
|
+
var keyIndex = keys.length ? cache.getKeyIndex(key) : -1;
|
|
913
|
+
if (keyIndex !== -1) {
|
|
914
|
+
if (shouldUpdateOnHit) {
|
|
915
|
+
onCacheHit(cache, normalizedOptions, memoized);
|
|
916
|
+
}
|
|
917
|
+
if (keyIndex) {
|
|
918
|
+
cache.orderByLru(keys[keyIndex], values[keyIndex], keyIndex);
|
|
919
|
+
if (shouldUpdateOnChange) {
|
|
920
|
+
onCacheChange(cache, normalizedOptions, memoized);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
} else {
|
|
924
|
+
var newValue = fn.apply(this, arguments);
|
|
925
|
+
var newKey = shouldCloneArguments ? key : cloneArray(arguments);
|
|
926
|
+
cache.orderByLru(newKey, newValue, keys.length);
|
|
927
|
+
if (isPromise) {
|
|
928
|
+
cache.updateAsyncCache(memoized);
|
|
929
|
+
}
|
|
930
|
+
if (shouldUpdateOnAdd) {
|
|
931
|
+
onCacheAdd(cache, normalizedOptions, memoized);
|
|
932
|
+
}
|
|
933
|
+
if (shouldUpdateOnChange) {
|
|
934
|
+
onCacheChange(cache, normalizedOptions, memoized);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return values[0];
|
|
938
|
+
};
|
|
939
|
+
memoized.cache = cache;
|
|
940
|
+
memoized.fn = fn;
|
|
941
|
+
memoized.isMemoized = true;
|
|
942
|
+
memoized.options = normalizedOptions;
|
|
943
|
+
return memoized;
|
|
944
|
+
}
|
|
551
945
|
|
|
552
946
|
// src/settings.ts
|
|
553
|
-
function
|
|
554
|
-
return parse(ESLintSettingsSchema, data);
|
|
947
|
+
function decodeSettings(data) {
|
|
948
|
+
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
555
949
|
}
|
|
950
|
+
var expandSettings = createMemoizedFunction((settings) => {
|
|
951
|
+
if (Object.keys(settings).length === 0) return {};
|
|
952
|
+
return {
|
|
953
|
+
...settings,
|
|
954
|
+
additionalComponents: settings.additionalComponents?.map((component) => ({
|
|
955
|
+
...component,
|
|
956
|
+
attributes: component.attributes?.map((attr) => ({
|
|
957
|
+
...attr,
|
|
958
|
+
as: attr.as ?? attr.name
|
|
959
|
+
})) ?? []
|
|
960
|
+
})) ?? []
|
|
961
|
+
};
|
|
962
|
+
}, { isDeepEqual: false });
|
|
556
963
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
557
964
|
additionalComponents: [
|
|
558
965
|
{
|
|
@@ -574,4 +981,4 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
574
981
|
version: "detect"
|
|
575
982
|
};
|
|
576
983
|
|
|
577
|
-
export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin,
|
|
984
|
+
export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-next.0",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"@typescript-eslint/utils": "^7.17.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"
|
|
41
|
+
"micro-memoize": "4.1.2",
|
|
42
|
+
"tsup": "8.2.3",
|
|
42
43
|
"type-fest": "4.23.0",
|
|
43
44
|
"valibot": "0.36.0"
|
|
44
45
|
},
|