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