@eslint-react/shared 1.9.1 → 1.9.2-beta.4
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/LICENSE +1 -1
- package/dist/index.d.mts +43 -4
- package/dist/index.d.ts +43 -4
- package/dist/index.js +393 -30
- package/dist/index.mjs +393 -30
- package/package.json +6 -4
package/LICENSE
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -2239,18 +2239,57 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
|
2239
2239
|
components: Map<string, string>;
|
|
2240
2240
|
}
|
|
2241
2241
|
/**
|
|
2242
|
-
*
|
|
2242
|
+
* A helper function to define settings for "react-x" with type checking in JavaScript files.
|
|
2243
2243
|
* @param settings The settings.
|
|
2244
|
-
* @returns The
|
|
2244
|
+
* @returns The settings.
|
|
2245
2245
|
*/
|
|
2246
|
-
declare
|
|
2246
|
+
declare const defineSettings: (settings: ESLintReactSettings) => ESLintReactSettings;
|
|
2247
2247
|
/**
|
|
2248
2248
|
* Decodes settings from a data object from `context.settings`.
|
|
2249
2249
|
* @internal
|
|
2250
2250
|
* @param data The data object.
|
|
2251
2251
|
* @returns settings The settings.
|
|
2252
2252
|
*/
|
|
2253
|
-
declare const decodeSettings: Memoized<(data: unknown) =>
|
|
2253
|
+
declare const decodeSettings: Memoized<(data: unknown) => {
|
|
2254
|
+
readonly skipImportCheck: boolean;
|
|
2255
|
+
readonly importSource?: string | undefined;
|
|
2256
|
+
readonly jsxPragma?: string | undefined;
|
|
2257
|
+
readonly jsxPragmaFrag?: string | undefined;
|
|
2258
|
+
readonly polymorphicPropName?: string | undefined;
|
|
2259
|
+
readonly strict?: boolean | undefined;
|
|
2260
|
+
readonly version?: string | undefined;
|
|
2261
|
+
readonly additionalComponents?: {
|
|
2262
|
+
name: string;
|
|
2263
|
+
attributes: {
|
|
2264
|
+
name: string;
|
|
2265
|
+
as?: string | undefined;
|
|
2266
|
+
controlled?: boolean | undefined;
|
|
2267
|
+
defaultValue?: string | undefined;
|
|
2268
|
+
}[];
|
|
2269
|
+
as?: string | undefined;
|
|
2270
|
+
selector?: string | undefined;
|
|
2271
|
+
}[] | undefined;
|
|
2272
|
+
readonly additionalHooks?: {
|
|
2273
|
+
use?: string[] | undefined;
|
|
2274
|
+
useActionState?: string[] | undefined;
|
|
2275
|
+
useCallback?: string[] | undefined;
|
|
2276
|
+
useContext?: string[] | undefined;
|
|
2277
|
+
useDebugValue?: string[] | undefined;
|
|
2278
|
+
useDeferredValue?: string[] | undefined;
|
|
2279
|
+
useEffect?: string[] | undefined;
|
|
2280
|
+
useId?: string[] | undefined;
|
|
2281
|
+
useImperativeHandle?: string[] | undefined;
|
|
2282
|
+
useInsertionEffect?: string[] | undefined;
|
|
2283
|
+
useLayoutEffect?: string[] | undefined;
|
|
2284
|
+
useMemo?: string[] | undefined;
|
|
2285
|
+
useOptimistic?: string[] | undefined;
|
|
2286
|
+
useReducer?: string[] | undefined;
|
|
2287
|
+
useRef?: string[] | undefined;
|
|
2288
|
+
useState?: string[] | undefined;
|
|
2289
|
+
useSyncExternalStore?: string[] | undefined;
|
|
2290
|
+
useTransition?: string[] | undefined;
|
|
2291
|
+
} | undefined;
|
|
2292
|
+
}>;
|
|
2254
2293
|
/**
|
|
2255
2294
|
* Unsafely casts settings from a data object from `context.settings`.
|
|
2256
2295
|
* @internal
|
package/dist/index.d.ts
CHANGED
|
@@ -2239,18 +2239,57 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
|
2239
2239
|
components: Map<string, string>;
|
|
2240
2240
|
}
|
|
2241
2241
|
/**
|
|
2242
|
-
*
|
|
2242
|
+
* A helper function to define settings for "react-x" with type checking in JavaScript files.
|
|
2243
2243
|
* @param settings The settings.
|
|
2244
|
-
* @returns The
|
|
2244
|
+
* @returns The settings.
|
|
2245
2245
|
*/
|
|
2246
|
-
declare
|
|
2246
|
+
declare const defineSettings: (settings: ESLintReactSettings) => ESLintReactSettings;
|
|
2247
2247
|
/**
|
|
2248
2248
|
* Decodes settings from a data object from `context.settings`.
|
|
2249
2249
|
* @internal
|
|
2250
2250
|
* @param data The data object.
|
|
2251
2251
|
* @returns settings The settings.
|
|
2252
2252
|
*/
|
|
2253
|
-
declare const decodeSettings: Memoized<(data: unknown) =>
|
|
2253
|
+
declare const decodeSettings: Memoized<(data: unknown) => {
|
|
2254
|
+
readonly skipImportCheck: boolean;
|
|
2255
|
+
readonly importSource?: string | undefined;
|
|
2256
|
+
readonly jsxPragma?: string | undefined;
|
|
2257
|
+
readonly jsxPragmaFrag?: string | undefined;
|
|
2258
|
+
readonly polymorphicPropName?: string | undefined;
|
|
2259
|
+
readonly strict?: boolean | undefined;
|
|
2260
|
+
readonly version?: string | undefined;
|
|
2261
|
+
readonly additionalComponents?: {
|
|
2262
|
+
name: string;
|
|
2263
|
+
attributes: {
|
|
2264
|
+
name: string;
|
|
2265
|
+
as?: string | undefined;
|
|
2266
|
+
controlled?: boolean | undefined;
|
|
2267
|
+
defaultValue?: string | undefined;
|
|
2268
|
+
}[];
|
|
2269
|
+
as?: string | undefined;
|
|
2270
|
+
selector?: string | undefined;
|
|
2271
|
+
}[] | undefined;
|
|
2272
|
+
readonly additionalHooks?: {
|
|
2273
|
+
use?: string[] | undefined;
|
|
2274
|
+
useActionState?: string[] | undefined;
|
|
2275
|
+
useCallback?: string[] | undefined;
|
|
2276
|
+
useContext?: string[] | undefined;
|
|
2277
|
+
useDebugValue?: string[] | undefined;
|
|
2278
|
+
useDeferredValue?: string[] | undefined;
|
|
2279
|
+
useEffect?: string[] | undefined;
|
|
2280
|
+
useId?: string[] | undefined;
|
|
2281
|
+
useImperativeHandle?: string[] | undefined;
|
|
2282
|
+
useInsertionEffect?: string[] | undefined;
|
|
2283
|
+
useLayoutEffect?: string[] | undefined;
|
|
2284
|
+
useMemo?: string[] | undefined;
|
|
2285
|
+
useOptimistic?: string[] | undefined;
|
|
2286
|
+
useReducer?: string[] | undefined;
|
|
2287
|
+
useRef?: string[] | undefined;
|
|
2288
|
+
useState?: string[] | undefined;
|
|
2289
|
+
useSyncExternalStore?: string[] | undefined;
|
|
2290
|
+
useTransition?: string[] | undefined;
|
|
2291
|
+
} | undefined;
|
|
2292
|
+
}>;
|
|
2254
2293
|
/**
|
|
2255
2294
|
* Unsafely casts settings from a data object from `context.settings`.
|
|
2256
2295
|
* @internal
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var utils = require('@typescript-eslint/utils');
|
|
4
|
+
var tools = require('@eslint-react/tools');
|
|
4
5
|
var pm = require('picomatch');
|
|
5
6
|
|
|
6
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -633,6 +634,370 @@ var ESLintSettingsSchema = optional(
|
|
|
633
634
|
{}
|
|
634
635
|
);
|
|
635
636
|
|
|
637
|
+
// ../../node_modules/.pnpm/fast-equals@5.0.1/node_modules/fast-equals/dist/esm/index.mjs
|
|
638
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
639
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
640
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
641
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
642
|
+
return function isEqual(a, b, state) {
|
|
643
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function createIsCircular(areItemsEqual) {
|
|
647
|
+
return function isCircular(a, b, state) {
|
|
648
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
649
|
+
return areItemsEqual(a, b, state);
|
|
650
|
+
}
|
|
651
|
+
var cache = state.cache;
|
|
652
|
+
var cachedA = cache.get(a);
|
|
653
|
+
var cachedB = cache.get(b);
|
|
654
|
+
if (cachedA && cachedB) {
|
|
655
|
+
return cachedA === b && cachedB === a;
|
|
656
|
+
}
|
|
657
|
+
cache.set(a, b);
|
|
658
|
+
cache.set(b, a);
|
|
659
|
+
var result = areItemsEqual(a, b, state);
|
|
660
|
+
cache.delete(a);
|
|
661
|
+
cache.delete(b);
|
|
662
|
+
return result;
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
function getStrictProperties(object2) {
|
|
666
|
+
return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
|
|
667
|
+
}
|
|
668
|
+
var hasOwn = Object.hasOwn || function(object2, property) {
|
|
669
|
+
return hasOwnProperty.call(object2, property);
|
|
670
|
+
};
|
|
671
|
+
function sameValueZeroEqual(a, b) {
|
|
672
|
+
return a || b ? a === b : a === b || a !== a && b !== b;
|
|
673
|
+
}
|
|
674
|
+
var OWNER = "_owner";
|
|
675
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
676
|
+
var keys = Object.keys;
|
|
677
|
+
function areArraysEqual(a, b, state) {
|
|
678
|
+
var index = a.length;
|
|
679
|
+
if (b.length !== index) {
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
682
|
+
while (index-- > 0) {
|
|
683
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return true;
|
|
688
|
+
}
|
|
689
|
+
function areDatesEqual(a, b) {
|
|
690
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
|
691
|
+
}
|
|
692
|
+
function areMapsEqual(a, b, state) {
|
|
693
|
+
if (a.size !== b.size) {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
var matchedIndices = {};
|
|
697
|
+
var aIterable = a.entries();
|
|
698
|
+
var index = 0;
|
|
699
|
+
var aResult;
|
|
700
|
+
var bResult;
|
|
701
|
+
while (aResult = aIterable.next()) {
|
|
702
|
+
if (aResult.done) {
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
var bIterable = b.entries();
|
|
706
|
+
var hasMatch = false;
|
|
707
|
+
var matchIndex = 0;
|
|
708
|
+
while (bResult = bIterable.next()) {
|
|
709
|
+
if (bResult.done) {
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
var _a = aResult.value, aKey = _a[0], aValue = _a[1];
|
|
713
|
+
var _b = bResult.value, bKey = _b[0], bValue = _b[1];
|
|
714
|
+
if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aKey, bKey, index, matchIndex, a, b, state) && state.equals(aValue, bValue, aKey, bKey, a, b, state))) {
|
|
715
|
+
matchedIndices[matchIndex] = true;
|
|
716
|
+
}
|
|
717
|
+
matchIndex++;
|
|
718
|
+
}
|
|
719
|
+
if (!hasMatch) {
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
index++;
|
|
723
|
+
}
|
|
724
|
+
return true;
|
|
725
|
+
}
|
|
726
|
+
function areObjectsEqual(a, b, state) {
|
|
727
|
+
var properties = keys(a);
|
|
728
|
+
var index = properties.length;
|
|
729
|
+
if (keys(b).length !== index) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
var property;
|
|
733
|
+
while (index-- > 0) {
|
|
734
|
+
property = properties[index];
|
|
735
|
+
if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) {
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
if (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return true;
|
|
743
|
+
}
|
|
744
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
745
|
+
var properties = getStrictProperties(a);
|
|
746
|
+
var index = properties.length;
|
|
747
|
+
if (getStrictProperties(b).length !== index) {
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
var property;
|
|
751
|
+
var descriptorA;
|
|
752
|
+
var descriptorB;
|
|
753
|
+
while (index-- > 0) {
|
|
754
|
+
property = properties[index];
|
|
755
|
+
if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) {
|
|
756
|
+
return false;
|
|
757
|
+
}
|
|
758
|
+
if (!hasOwn(b, property)) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
if (!state.equals(a[property], b[property], property, property, a, b, state)) {
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
765
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
766
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
773
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
|
774
|
+
}
|
|
775
|
+
function areRegExpsEqual(a, b) {
|
|
776
|
+
return a.source === b.source && a.flags === b.flags;
|
|
777
|
+
}
|
|
778
|
+
function areSetsEqual(a, b, state) {
|
|
779
|
+
if (a.size !== b.size) {
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
var matchedIndices = {};
|
|
783
|
+
var aIterable = a.values();
|
|
784
|
+
var aResult;
|
|
785
|
+
var bResult;
|
|
786
|
+
while (aResult = aIterable.next()) {
|
|
787
|
+
if (aResult.done) {
|
|
788
|
+
break;
|
|
789
|
+
}
|
|
790
|
+
var bIterable = b.values();
|
|
791
|
+
var hasMatch = false;
|
|
792
|
+
var matchIndex = 0;
|
|
793
|
+
while (bResult = bIterable.next()) {
|
|
794
|
+
if (bResult.done) {
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state))) {
|
|
798
|
+
matchedIndices[matchIndex] = true;
|
|
799
|
+
}
|
|
800
|
+
matchIndex++;
|
|
801
|
+
}
|
|
802
|
+
if (!hasMatch) {
|
|
803
|
+
return false;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return true;
|
|
807
|
+
}
|
|
808
|
+
function areTypedArraysEqual(a, b) {
|
|
809
|
+
var index = a.length;
|
|
810
|
+
if (b.length !== index) {
|
|
811
|
+
return false;
|
|
812
|
+
}
|
|
813
|
+
while (index-- > 0) {
|
|
814
|
+
if (a[index] !== b[index]) {
|
|
815
|
+
return false;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
|
821
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
|
822
|
+
var DATE_TAG = "[object Date]";
|
|
823
|
+
var MAP_TAG = "[object Map]";
|
|
824
|
+
var NUMBER_TAG = "[object Number]";
|
|
825
|
+
var OBJECT_TAG = "[object Object]";
|
|
826
|
+
var REG_EXP_TAG = "[object RegExp]";
|
|
827
|
+
var SET_TAG = "[object Set]";
|
|
828
|
+
var STRING_TAG = "[object String]";
|
|
829
|
+
var isArray = Array.isArray;
|
|
830
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
|
831
|
+
var assign = Object.assign;
|
|
832
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
833
|
+
function createEqualityComparator(_a) {
|
|
834
|
+
var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areMapsEqual2 = _a.areMapsEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual;
|
|
835
|
+
return function comparator(a, b, state) {
|
|
836
|
+
if (a === b) {
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
839
|
+
if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
|
|
840
|
+
return a !== a && b !== b;
|
|
841
|
+
}
|
|
842
|
+
var constructor = a.constructor;
|
|
843
|
+
if (constructor !== b.constructor) {
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
846
|
+
if (constructor === Object) {
|
|
847
|
+
return areObjectsEqual2(a, b, state);
|
|
848
|
+
}
|
|
849
|
+
if (isArray(a)) {
|
|
850
|
+
return areArraysEqual2(a, b, state);
|
|
851
|
+
}
|
|
852
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
|
853
|
+
return areTypedArraysEqual2(a, b, state);
|
|
854
|
+
}
|
|
855
|
+
if (constructor === Date) {
|
|
856
|
+
return areDatesEqual2(a, b, state);
|
|
857
|
+
}
|
|
858
|
+
if (constructor === RegExp) {
|
|
859
|
+
return areRegExpsEqual2(a, b, state);
|
|
860
|
+
}
|
|
861
|
+
if (constructor === Map) {
|
|
862
|
+
return areMapsEqual2(a, b, state);
|
|
863
|
+
}
|
|
864
|
+
if (constructor === Set) {
|
|
865
|
+
return areSetsEqual2(a, b, state);
|
|
866
|
+
}
|
|
867
|
+
var tag = getTag(a);
|
|
868
|
+
if (tag === DATE_TAG) {
|
|
869
|
+
return areDatesEqual2(a, b, state);
|
|
870
|
+
}
|
|
871
|
+
if (tag === REG_EXP_TAG) {
|
|
872
|
+
return areRegExpsEqual2(a, b, state);
|
|
873
|
+
}
|
|
874
|
+
if (tag === MAP_TAG) {
|
|
875
|
+
return areMapsEqual2(a, b, state);
|
|
876
|
+
}
|
|
877
|
+
if (tag === SET_TAG) {
|
|
878
|
+
return areSetsEqual2(a, b, state);
|
|
879
|
+
}
|
|
880
|
+
if (tag === OBJECT_TAG) {
|
|
881
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
|
882
|
+
}
|
|
883
|
+
if (tag === ARGUMENTS_TAG) {
|
|
884
|
+
return areObjectsEqual2(a, b, state);
|
|
885
|
+
}
|
|
886
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
|
887
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
|
888
|
+
}
|
|
889
|
+
return false;
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function createEqualityComparatorConfig(_a) {
|
|
893
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
|
894
|
+
var config = {
|
|
895
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
896
|
+
areDatesEqual,
|
|
897
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
898
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
899
|
+
arePrimitiveWrappersEqual,
|
|
900
|
+
areRegExpsEqual,
|
|
901
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
902
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual
|
|
903
|
+
};
|
|
904
|
+
if (createCustomConfig) {
|
|
905
|
+
config = assign({}, config, createCustomConfig(config));
|
|
906
|
+
}
|
|
907
|
+
if (circular) {
|
|
908
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
|
909
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
|
910
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
|
911
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
|
912
|
+
config = assign({}, config, {
|
|
913
|
+
areArraysEqual: areArraysEqual$1,
|
|
914
|
+
areMapsEqual: areMapsEqual$1,
|
|
915
|
+
areObjectsEqual: areObjectsEqual$1,
|
|
916
|
+
areSetsEqual: areSetsEqual$1
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
return config;
|
|
920
|
+
}
|
|
921
|
+
function createInternalEqualityComparator(compare) {
|
|
922
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
923
|
+
return compare(a, b, state);
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function createIsEqual(_a) {
|
|
927
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
928
|
+
if (createState) {
|
|
929
|
+
return function isEqual(a, b) {
|
|
930
|
+
var _a2 = createState(), _b = _a2.cache, cache = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
|
931
|
+
return comparator(a, b, {
|
|
932
|
+
cache,
|
|
933
|
+
equals,
|
|
934
|
+
meta,
|
|
935
|
+
strict
|
|
936
|
+
});
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
if (circular) {
|
|
940
|
+
return function isEqual(a, b) {
|
|
941
|
+
return comparator(a, b, {
|
|
942
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
|
943
|
+
equals,
|
|
944
|
+
meta: void 0,
|
|
945
|
+
strict
|
|
946
|
+
});
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
var state = {
|
|
950
|
+
cache: void 0,
|
|
951
|
+
equals,
|
|
952
|
+
meta: void 0,
|
|
953
|
+
strict
|
|
954
|
+
};
|
|
955
|
+
return function isEqual(a, b) {
|
|
956
|
+
return comparator(a, b, state);
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
createCustomEqual();
|
|
960
|
+
createCustomEqual({ strict: true });
|
|
961
|
+
createCustomEqual({ circular: true });
|
|
962
|
+
createCustomEqual({
|
|
963
|
+
circular: true,
|
|
964
|
+
strict: true
|
|
965
|
+
});
|
|
966
|
+
var shallowEqual = createCustomEqual({
|
|
967
|
+
createInternalComparator: function() {
|
|
968
|
+
return sameValueZeroEqual;
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
createCustomEqual({
|
|
972
|
+
strict: true,
|
|
973
|
+
createInternalComparator: function() {
|
|
974
|
+
return sameValueZeroEqual;
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
createCustomEqual({
|
|
978
|
+
circular: true,
|
|
979
|
+
createInternalComparator: function() {
|
|
980
|
+
return sameValueZeroEqual;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
createCustomEqual({
|
|
984
|
+
circular: true,
|
|
985
|
+
createInternalComparator: function() {
|
|
986
|
+
return sameValueZeroEqual;
|
|
987
|
+
},
|
|
988
|
+
strict: true
|
|
989
|
+
});
|
|
990
|
+
function createCustomEqual(options) {
|
|
991
|
+
if (options === void 0) {
|
|
992
|
+
options = {};
|
|
993
|
+
}
|
|
994
|
+
var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
|
|
995
|
+
var config = createEqualityComparatorConfig(options);
|
|
996
|
+
var comparator = createEqualityComparator(config);
|
|
997
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
998
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
999
|
+
}
|
|
1000
|
+
|
|
636
1001
|
// ../../node_modules/.pnpm/micro-memoize@4.1.2/node_modules/micro-memoize/dist/micro-memoize.esm.js
|
|
637
1002
|
var DEFAULT_OPTIONS_KEYS = {
|
|
638
1003
|
isEqual: true,
|
|
@@ -735,17 +1100,17 @@ var Cache = (
|
|
|
735
1100
|
});
|
|
736
1101
|
Cache2.prototype._getKeyIndexFromMatchingKey = function(keyToMatch) {
|
|
737
1102
|
var _a = this.options, isMatchingKey = _a.isMatchingKey, maxSize = _a.maxSize;
|
|
738
|
-
var
|
|
739
|
-
var keysLength =
|
|
1103
|
+
var keys2 = this.keys;
|
|
1104
|
+
var keysLength = keys2.length;
|
|
740
1105
|
if (!keysLength) {
|
|
741
1106
|
return -1;
|
|
742
1107
|
}
|
|
743
|
-
if (isMatchingKey(
|
|
1108
|
+
if (isMatchingKey(keys2[0], keyToMatch)) {
|
|
744
1109
|
return 0;
|
|
745
1110
|
}
|
|
746
1111
|
if (maxSize > 1) {
|
|
747
1112
|
for (var index = 1; index < keysLength; index++) {
|
|
748
|
-
if (isMatchingKey(
|
|
1113
|
+
if (isMatchingKey(keys2[index], keyToMatch)) {
|
|
749
1114
|
return index;
|
|
750
1115
|
}
|
|
751
1116
|
}
|
|
@@ -754,8 +1119,8 @@ var Cache = (
|
|
|
754
1119
|
};
|
|
755
1120
|
Cache2.prototype._getKeyIndexForMany = function(keyToMatch) {
|
|
756
1121
|
var isEqual = this.options.isEqual;
|
|
757
|
-
var
|
|
758
|
-
var keysLength =
|
|
1122
|
+
var keys2 = this.keys;
|
|
1123
|
+
var keysLength = keys2.length;
|
|
759
1124
|
if (!keysLength) {
|
|
760
1125
|
return -1;
|
|
761
1126
|
}
|
|
@@ -767,7 +1132,7 @@ var Cache = (
|
|
|
767
1132
|
var argIndex;
|
|
768
1133
|
if (keyLength > 1) {
|
|
769
1134
|
for (var index = 0; index < keysLength; index++) {
|
|
770
|
-
existingKey =
|
|
1135
|
+
existingKey = keys2[index];
|
|
771
1136
|
if (existingKey.length === keyLength) {
|
|
772
1137
|
argIndex = 0;
|
|
773
1138
|
for (; argIndex < keyLength; argIndex++) {
|
|
@@ -782,7 +1147,7 @@ var Cache = (
|
|
|
782
1147
|
}
|
|
783
1148
|
} else {
|
|
784
1149
|
for (var index = 0; index < keysLength; index++) {
|
|
785
|
-
existingKey =
|
|
1150
|
+
existingKey = keys2[index];
|
|
786
1151
|
if (existingKey.length === keyLength && isEqual(existingKey[0], keyToMatch[0])) {
|
|
787
1152
|
return index;
|
|
788
1153
|
}
|
|
@@ -791,11 +1156,11 @@ var Cache = (
|
|
|
791
1156
|
return -1;
|
|
792
1157
|
};
|
|
793
1158
|
Cache2.prototype._getKeyIndexForSingle = function(keyToMatch) {
|
|
794
|
-
var
|
|
795
|
-
if (!
|
|
1159
|
+
var keys2 = this.keys;
|
|
1160
|
+
if (!keys2.length) {
|
|
796
1161
|
return -1;
|
|
797
1162
|
}
|
|
798
|
-
var existingKey =
|
|
1163
|
+
var existingKey = keys2[0];
|
|
799
1164
|
var length = existingKey.length;
|
|
800
1165
|
if (keyToMatch.length !== length) {
|
|
801
1166
|
return -1;
|
|
@@ -812,22 +1177,22 @@ var Cache = (
|
|
|
812
1177
|
return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
|
|
813
1178
|
};
|
|
814
1179
|
Cache2.prototype.orderByLru = function(key, value, startingIndex) {
|
|
815
|
-
var
|
|
1180
|
+
var keys2 = this.keys;
|
|
816
1181
|
var values = this.values;
|
|
817
|
-
var currentLength =
|
|
1182
|
+
var currentLength = keys2.length;
|
|
818
1183
|
var index = startingIndex;
|
|
819
1184
|
while (index--) {
|
|
820
|
-
|
|
1185
|
+
keys2[index + 1] = keys2[index];
|
|
821
1186
|
values[index + 1] = values[index];
|
|
822
1187
|
}
|
|
823
|
-
|
|
1188
|
+
keys2[0] = key;
|
|
824
1189
|
values[0] = value;
|
|
825
1190
|
var maxSize = this.options.maxSize;
|
|
826
1191
|
if (currentLength === maxSize && startingIndex === currentLength) {
|
|
827
|
-
|
|
1192
|
+
keys2.pop();
|
|
828
1193
|
values.pop();
|
|
829
1194
|
} else if (startingIndex >= maxSize) {
|
|
830
|
-
|
|
1195
|
+
keys2.length = values.length = maxSize;
|
|
831
1196
|
}
|
|
832
1197
|
};
|
|
833
1198
|
Cache2.prototype.updateAsyncCache = function(memoized) {
|
|
@@ -877,19 +1242,19 @@ function createMemoizedFunction(fn, options) {
|
|
|
877
1242
|
transformKey
|
|
878
1243
|
}, getCustomOptions(options));
|
|
879
1244
|
var cache = new Cache(normalizedOptions);
|
|
880
|
-
var
|
|
1245
|
+
var keys2 = cache.keys, values = cache.values, canTransformKey = cache.canTransformKey, shouldCloneArguments = cache.shouldCloneArguments, shouldUpdateOnAdd = cache.shouldUpdateOnAdd, shouldUpdateOnChange = cache.shouldUpdateOnChange, shouldUpdateOnHit = cache.shouldUpdateOnHit;
|
|
881
1246
|
var memoized = function() {
|
|
882
1247
|
var key = shouldCloneArguments ? cloneArray(arguments) : arguments;
|
|
883
1248
|
if (canTransformKey) {
|
|
884
1249
|
key = transformKey(key);
|
|
885
1250
|
}
|
|
886
|
-
var keyIndex =
|
|
1251
|
+
var keyIndex = keys2.length ? cache.getKeyIndex(key) : -1;
|
|
887
1252
|
if (keyIndex !== -1) {
|
|
888
1253
|
if (shouldUpdateOnHit) {
|
|
889
1254
|
onCacheHit(cache, normalizedOptions, memoized);
|
|
890
1255
|
}
|
|
891
1256
|
if (keyIndex) {
|
|
892
|
-
cache.orderByLru(
|
|
1257
|
+
cache.orderByLru(keys2[keyIndex], values[keyIndex], keyIndex);
|
|
893
1258
|
if (shouldUpdateOnChange) {
|
|
894
1259
|
onCacheChange(cache, normalizedOptions, memoized);
|
|
895
1260
|
}
|
|
@@ -897,7 +1262,7 @@ function createMemoizedFunction(fn, options) {
|
|
|
897
1262
|
} else {
|
|
898
1263
|
var newValue = fn.apply(this, arguments);
|
|
899
1264
|
var newKey = shouldCloneArguments ? key : cloneArray(arguments);
|
|
900
|
-
cache.orderByLru(newKey, newValue,
|
|
1265
|
+
cache.orderByLru(newKey, newValue, keys2.length);
|
|
901
1266
|
if (isPromise) {
|
|
902
1267
|
cache.updateAsyncCache(memoized);
|
|
903
1268
|
}
|
|
@@ -927,22 +1292,20 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
927
1292
|
skipImportCheck: true,
|
|
928
1293
|
version: "detect"
|
|
929
1294
|
};
|
|
930
|
-
|
|
931
|
-
return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
|
|
932
|
-
}
|
|
1295
|
+
var defineSettings = tools.F.identity;
|
|
933
1296
|
var decodeSettings = createMemoizedFunction((data) => {
|
|
934
|
-
return {
|
|
1297
|
+
return tools.Data.struct({
|
|
935
1298
|
...INITIAL_ESLINT_REACT_SETTINGS,
|
|
936
1299
|
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
937
|
-
};
|
|
1300
|
+
});
|
|
938
1301
|
}, { isEqual: (a, b) => a === b });
|
|
939
1302
|
function unsafeCastSettings(data) {
|
|
940
|
-
return data?.["react-x"] ?? {};
|
|
1303
|
+
return tools.Data.struct(data?.["react-x"] ?? {});
|
|
941
1304
|
}
|
|
942
1305
|
var expandSettings = createMemoizedFunction(
|
|
943
1306
|
(settings) => {
|
|
944
1307
|
const additionalComponents = settings.additionalComponents ?? [];
|
|
945
|
-
return {
|
|
1308
|
+
return tools.Data.struct({
|
|
946
1309
|
...settings,
|
|
947
1310
|
additionalComponents: additionalComponents.map((component) => ({
|
|
948
1311
|
...component,
|
|
@@ -958,9 +1321,9 @@ var expandSettings = createMemoizedFunction(
|
|
|
958
1321
|
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
959
1322
|
return acc.set(name, as);
|
|
960
1323
|
}, /* @__PURE__ */ new Map())
|
|
961
|
-
};
|
|
1324
|
+
});
|
|
962
1325
|
},
|
|
963
|
-
{
|
|
1326
|
+
{ isEqual: shallowEqual }
|
|
964
1327
|
);
|
|
965
1328
|
|
|
966
1329
|
exports.CustomAttributeSchema = CustomAttributeSchema;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { F, Data } from '@eslint-react/tools';
|
|
2
3
|
import pm from 'picomatch';
|
|
3
4
|
|
|
4
5
|
// src/constants.ts
|
|
@@ -627,6 +628,370 @@ var ESLintSettingsSchema = optional(
|
|
|
627
628
|
{}
|
|
628
629
|
);
|
|
629
630
|
|
|
631
|
+
// ../../node_modules/.pnpm/fast-equals@5.0.1/node_modules/fast-equals/dist/esm/index.mjs
|
|
632
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
633
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
634
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
635
|
+
function combineComparators(comparatorA, comparatorB) {
|
|
636
|
+
return function isEqual(a, b, state) {
|
|
637
|
+
return comparatorA(a, b, state) && comparatorB(a, b, state);
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function createIsCircular(areItemsEqual) {
|
|
641
|
+
return function isCircular(a, b, state) {
|
|
642
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") {
|
|
643
|
+
return areItemsEqual(a, b, state);
|
|
644
|
+
}
|
|
645
|
+
var cache = state.cache;
|
|
646
|
+
var cachedA = cache.get(a);
|
|
647
|
+
var cachedB = cache.get(b);
|
|
648
|
+
if (cachedA && cachedB) {
|
|
649
|
+
return cachedA === b && cachedB === a;
|
|
650
|
+
}
|
|
651
|
+
cache.set(a, b);
|
|
652
|
+
cache.set(b, a);
|
|
653
|
+
var result = areItemsEqual(a, b, state);
|
|
654
|
+
cache.delete(a);
|
|
655
|
+
cache.delete(b);
|
|
656
|
+
return result;
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
function getStrictProperties(object2) {
|
|
660
|
+
return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
|
|
661
|
+
}
|
|
662
|
+
var hasOwn = Object.hasOwn || function(object2, property) {
|
|
663
|
+
return hasOwnProperty.call(object2, property);
|
|
664
|
+
};
|
|
665
|
+
function sameValueZeroEqual(a, b) {
|
|
666
|
+
return a || b ? a === b : a === b || a !== a && b !== b;
|
|
667
|
+
}
|
|
668
|
+
var OWNER = "_owner";
|
|
669
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
670
|
+
var keys = Object.keys;
|
|
671
|
+
function areArraysEqual(a, b, state) {
|
|
672
|
+
var index = a.length;
|
|
673
|
+
if (b.length !== index) {
|
|
674
|
+
return false;
|
|
675
|
+
}
|
|
676
|
+
while (index-- > 0) {
|
|
677
|
+
if (!state.equals(a[index], b[index], index, index, a, b, state)) {
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
function areDatesEqual(a, b) {
|
|
684
|
+
return sameValueZeroEqual(a.getTime(), b.getTime());
|
|
685
|
+
}
|
|
686
|
+
function areMapsEqual(a, b, state) {
|
|
687
|
+
if (a.size !== b.size) {
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
var matchedIndices = {};
|
|
691
|
+
var aIterable = a.entries();
|
|
692
|
+
var index = 0;
|
|
693
|
+
var aResult;
|
|
694
|
+
var bResult;
|
|
695
|
+
while (aResult = aIterable.next()) {
|
|
696
|
+
if (aResult.done) {
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
var bIterable = b.entries();
|
|
700
|
+
var hasMatch = false;
|
|
701
|
+
var matchIndex = 0;
|
|
702
|
+
while (bResult = bIterable.next()) {
|
|
703
|
+
if (bResult.done) {
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
var _a = aResult.value, aKey = _a[0], aValue = _a[1];
|
|
707
|
+
var _b = bResult.value, bKey = _b[0], bValue = _b[1];
|
|
708
|
+
if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aKey, bKey, index, matchIndex, a, b, state) && state.equals(aValue, bValue, aKey, bKey, a, b, state))) {
|
|
709
|
+
matchedIndices[matchIndex] = true;
|
|
710
|
+
}
|
|
711
|
+
matchIndex++;
|
|
712
|
+
}
|
|
713
|
+
if (!hasMatch) {
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
index++;
|
|
717
|
+
}
|
|
718
|
+
return true;
|
|
719
|
+
}
|
|
720
|
+
function areObjectsEqual(a, b, state) {
|
|
721
|
+
var properties = keys(a);
|
|
722
|
+
var index = properties.length;
|
|
723
|
+
if (keys(b).length !== index) {
|
|
724
|
+
return false;
|
|
725
|
+
}
|
|
726
|
+
var property;
|
|
727
|
+
while (index-- > 0) {
|
|
728
|
+
property = properties[index];
|
|
729
|
+
if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
if (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
function areObjectsEqualStrict(a, b, state) {
|
|
739
|
+
var properties = getStrictProperties(a);
|
|
740
|
+
var index = properties.length;
|
|
741
|
+
if (getStrictProperties(b).length !== index) {
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
var property;
|
|
745
|
+
var descriptorA;
|
|
746
|
+
var descriptorB;
|
|
747
|
+
while (index-- > 0) {
|
|
748
|
+
property = properties[index];
|
|
749
|
+
if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
if (!hasOwn(b, property)) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
if (!state.equals(a[property], b[property], property, property, a, b, state)) {
|
|
756
|
+
return false;
|
|
757
|
+
}
|
|
758
|
+
descriptorA = getOwnPropertyDescriptor(a, property);
|
|
759
|
+
descriptorB = getOwnPropertyDescriptor(b, property);
|
|
760
|
+
if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return true;
|
|
765
|
+
}
|
|
766
|
+
function arePrimitiveWrappersEqual(a, b) {
|
|
767
|
+
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
|
768
|
+
}
|
|
769
|
+
function areRegExpsEqual(a, b) {
|
|
770
|
+
return a.source === b.source && a.flags === b.flags;
|
|
771
|
+
}
|
|
772
|
+
function areSetsEqual(a, b, state) {
|
|
773
|
+
if (a.size !== b.size) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
var matchedIndices = {};
|
|
777
|
+
var aIterable = a.values();
|
|
778
|
+
var aResult;
|
|
779
|
+
var bResult;
|
|
780
|
+
while (aResult = aIterable.next()) {
|
|
781
|
+
if (aResult.done) {
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
var bIterable = b.values();
|
|
785
|
+
var hasMatch = false;
|
|
786
|
+
var matchIndex = 0;
|
|
787
|
+
while (bResult = bIterable.next()) {
|
|
788
|
+
if (bResult.done) {
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state))) {
|
|
792
|
+
matchedIndices[matchIndex] = true;
|
|
793
|
+
}
|
|
794
|
+
matchIndex++;
|
|
795
|
+
}
|
|
796
|
+
if (!hasMatch) {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
return true;
|
|
801
|
+
}
|
|
802
|
+
function areTypedArraysEqual(a, b) {
|
|
803
|
+
var index = a.length;
|
|
804
|
+
if (b.length !== index) {
|
|
805
|
+
return false;
|
|
806
|
+
}
|
|
807
|
+
while (index-- > 0) {
|
|
808
|
+
if (a[index] !== b[index]) {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
return true;
|
|
813
|
+
}
|
|
814
|
+
var ARGUMENTS_TAG = "[object Arguments]";
|
|
815
|
+
var BOOLEAN_TAG = "[object Boolean]";
|
|
816
|
+
var DATE_TAG = "[object Date]";
|
|
817
|
+
var MAP_TAG = "[object Map]";
|
|
818
|
+
var NUMBER_TAG = "[object Number]";
|
|
819
|
+
var OBJECT_TAG = "[object Object]";
|
|
820
|
+
var REG_EXP_TAG = "[object RegExp]";
|
|
821
|
+
var SET_TAG = "[object Set]";
|
|
822
|
+
var STRING_TAG = "[object String]";
|
|
823
|
+
var isArray = Array.isArray;
|
|
824
|
+
var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
|
|
825
|
+
var assign = Object.assign;
|
|
826
|
+
var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
827
|
+
function createEqualityComparator(_a) {
|
|
828
|
+
var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areMapsEqual2 = _a.areMapsEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual;
|
|
829
|
+
return function comparator(a, b, state) {
|
|
830
|
+
if (a === b) {
|
|
831
|
+
return true;
|
|
832
|
+
}
|
|
833
|
+
if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
|
|
834
|
+
return a !== a && b !== b;
|
|
835
|
+
}
|
|
836
|
+
var constructor = a.constructor;
|
|
837
|
+
if (constructor !== b.constructor) {
|
|
838
|
+
return false;
|
|
839
|
+
}
|
|
840
|
+
if (constructor === Object) {
|
|
841
|
+
return areObjectsEqual2(a, b, state);
|
|
842
|
+
}
|
|
843
|
+
if (isArray(a)) {
|
|
844
|
+
return areArraysEqual2(a, b, state);
|
|
845
|
+
}
|
|
846
|
+
if (isTypedArray != null && isTypedArray(a)) {
|
|
847
|
+
return areTypedArraysEqual2(a, b, state);
|
|
848
|
+
}
|
|
849
|
+
if (constructor === Date) {
|
|
850
|
+
return areDatesEqual2(a, b, state);
|
|
851
|
+
}
|
|
852
|
+
if (constructor === RegExp) {
|
|
853
|
+
return areRegExpsEqual2(a, b, state);
|
|
854
|
+
}
|
|
855
|
+
if (constructor === Map) {
|
|
856
|
+
return areMapsEqual2(a, b, state);
|
|
857
|
+
}
|
|
858
|
+
if (constructor === Set) {
|
|
859
|
+
return areSetsEqual2(a, b, state);
|
|
860
|
+
}
|
|
861
|
+
var tag = getTag(a);
|
|
862
|
+
if (tag === DATE_TAG) {
|
|
863
|
+
return areDatesEqual2(a, b, state);
|
|
864
|
+
}
|
|
865
|
+
if (tag === REG_EXP_TAG) {
|
|
866
|
+
return areRegExpsEqual2(a, b, state);
|
|
867
|
+
}
|
|
868
|
+
if (tag === MAP_TAG) {
|
|
869
|
+
return areMapsEqual2(a, b, state);
|
|
870
|
+
}
|
|
871
|
+
if (tag === SET_TAG) {
|
|
872
|
+
return areSetsEqual2(a, b, state);
|
|
873
|
+
}
|
|
874
|
+
if (tag === OBJECT_TAG) {
|
|
875
|
+
return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
|
|
876
|
+
}
|
|
877
|
+
if (tag === ARGUMENTS_TAG) {
|
|
878
|
+
return areObjectsEqual2(a, b, state);
|
|
879
|
+
}
|
|
880
|
+
if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
|
|
881
|
+
return arePrimitiveWrappersEqual2(a, b, state);
|
|
882
|
+
}
|
|
883
|
+
return false;
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function createEqualityComparatorConfig(_a) {
|
|
887
|
+
var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
|
|
888
|
+
var config = {
|
|
889
|
+
areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
|
|
890
|
+
areDatesEqual,
|
|
891
|
+
areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
|
|
892
|
+
areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
|
|
893
|
+
arePrimitiveWrappersEqual,
|
|
894
|
+
areRegExpsEqual,
|
|
895
|
+
areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
|
|
896
|
+
areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual
|
|
897
|
+
};
|
|
898
|
+
if (createCustomConfig) {
|
|
899
|
+
config = assign({}, config, createCustomConfig(config));
|
|
900
|
+
}
|
|
901
|
+
if (circular) {
|
|
902
|
+
var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
|
|
903
|
+
var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
|
|
904
|
+
var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
|
|
905
|
+
var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
|
|
906
|
+
config = assign({}, config, {
|
|
907
|
+
areArraysEqual: areArraysEqual$1,
|
|
908
|
+
areMapsEqual: areMapsEqual$1,
|
|
909
|
+
areObjectsEqual: areObjectsEqual$1,
|
|
910
|
+
areSetsEqual: areSetsEqual$1
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
return config;
|
|
914
|
+
}
|
|
915
|
+
function createInternalEqualityComparator(compare) {
|
|
916
|
+
return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
|
|
917
|
+
return compare(a, b, state);
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
function createIsEqual(_a) {
|
|
921
|
+
var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
|
|
922
|
+
if (createState) {
|
|
923
|
+
return function isEqual(a, b) {
|
|
924
|
+
var _a2 = createState(), _b = _a2.cache, cache = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
|
|
925
|
+
return comparator(a, b, {
|
|
926
|
+
cache,
|
|
927
|
+
equals,
|
|
928
|
+
meta,
|
|
929
|
+
strict
|
|
930
|
+
});
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
if (circular) {
|
|
934
|
+
return function isEqual(a, b) {
|
|
935
|
+
return comparator(a, b, {
|
|
936
|
+
cache: /* @__PURE__ */ new WeakMap(),
|
|
937
|
+
equals,
|
|
938
|
+
meta: void 0,
|
|
939
|
+
strict
|
|
940
|
+
});
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
var state = {
|
|
944
|
+
cache: void 0,
|
|
945
|
+
equals,
|
|
946
|
+
meta: void 0,
|
|
947
|
+
strict
|
|
948
|
+
};
|
|
949
|
+
return function isEqual(a, b) {
|
|
950
|
+
return comparator(a, b, state);
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
createCustomEqual();
|
|
954
|
+
createCustomEqual({ strict: true });
|
|
955
|
+
createCustomEqual({ circular: true });
|
|
956
|
+
createCustomEqual({
|
|
957
|
+
circular: true,
|
|
958
|
+
strict: true
|
|
959
|
+
});
|
|
960
|
+
var shallowEqual = createCustomEqual({
|
|
961
|
+
createInternalComparator: function() {
|
|
962
|
+
return sameValueZeroEqual;
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
createCustomEqual({
|
|
966
|
+
strict: true,
|
|
967
|
+
createInternalComparator: function() {
|
|
968
|
+
return sameValueZeroEqual;
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
createCustomEqual({
|
|
972
|
+
circular: true,
|
|
973
|
+
createInternalComparator: function() {
|
|
974
|
+
return sameValueZeroEqual;
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
createCustomEqual({
|
|
978
|
+
circular: true,
|
|
979
|
+
createInternalComparator: function() {
|
|
980
|
+
return sameValueZeroEqual;
|
|
981
|
+
},
|
|
982
|
+
strict: true
|
|
983
|
+
});
|
|
984
|
+
function createCustomEqual(options) {
|
|
985
|
+
if (options === void 0) {
|
|
986
|
+
options = {};
|
|
987
|
+
}
|
|
988
|
+
var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
|
|
989
|
+
var config = createEqualityComparatorConfig(options);
|
|
990
|
+
var comparator = createEqualityComparator(config);
|
|
991
|
+
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
992
|
+
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
993
|
+
}
|
|
994
|
+
|
|
630
995
|
// ../../node_modules/.pnpm/micro-memoize@4.1.2/node_modules/micro-memoize/dist/micro-memoize.esm.js
|
|
631
996
|
var DEFAULT_OPTIONS_KEYS = {
|
|
632
997
|
isEqual: true,
|
|
@@ -729,17 +1094,17 @@ var Cache = (
|
|
|
729
1094
|
});
|
|
730
1095
|
Cache2.prototype._getKeyIndexFromMatchingKey = function(keyToMatch) {
|
|
731
1096
|
var _a = this.options, isMatchingKey = _a.isMatchingKey, maxSize = _a.maxSize;
|
|
732
|
-
var
|
|
733
|
-
var keysLength =
|
|
1097
|
+
var keys2 = this.keys;
|
|
1098
|
+
var keysLength = keys2.length;
|
|
734
1099
|
if (!keysLength) {
|
|
735
1100
|
return -1;
|
|
736
1101
|
}
|
|
737
|
-
if (isMatchingKey(
|
|
1102
|
+
if (isMatchingKey(keys2[0], keyToMatch)) {
|
|
738
1103
|
return 0;
|
|
739
1104
|
}
|
|
740
1105
|
if (maxSize > 1) {
|
|
741
1106
|
for (var index = 1; index < keysLength; index++) {
|
|
742
|
-
if (isMatchingKey(
|
|
1107
|
+
if (isMatchingKey(keys2[index], keyToMatch)) {
|
|
743
1108
|
return index;
|
|
744
1109
|
}
|
|
745
1110
|
}
|
|
@@ -748,8 +1113,8 @@ var Cache = (
|
|
|
748
1113
|
};
|
|
749
1114
|
Cache2.prototype._getKeyIndexForMany = function(keyToMatch) {
|
|
750
1115
|
var isEqual = this.options.isEqual;
|
|
751
|
-
var
|
|
752
|
-
var keysLength =
|
|
1116
|
+
var keys2 = this.keys;
|
|
1117
|
+
var keysLength = keys2.length;
|
|
753
1118
|
if (!keysLength) {
|
|
754
1119
|
return -1;
|
|
755
1120
|
}
|
|
@@ -761,7 +1126,7 @@ var Cache = (
|
|
|
761
1126
|
var argIndex;
|
|
762
1127
|
if (keyLength > 1) {
|
|
763
1128
|
for (var index = 0; index < keysLength; index++) {
|
|
764
|
-
existingKey =
|
|
1129
|
+
existingKey = keys2[index];
|
|
765
1130
|
if (existingKey.length === keyLength) {
|
|
766
1131
|
argIndex = 0;
|
|
767
1132
|
for (; argIndex < keyLength; argIndex++) {
|
|
@@ -776,7 +1141,7 @@ var Cache = (
|
|
|
776
1141
|
}
|
|
777
1142
|
} else {
|
|
778
1143
|
for (var index = 0; index < keysLength; index++) {
|
|
779
|
-
existingKey =
|
|
1144
|
+
existingKey = keys2[index];
|
|
780
1145
|
if (existingKey.length === keyLength && isEqual(existingKey[0], keyToMatch[0])) {
|
|
781
1146
|
return index;
|
|
782
1147
|
}
|
|
@@ -785,11 +1150,11 @@ var Cache = (
|
|
|
785
1150
|
return -1;
|
|
786
1151
|
};
|
|
787
1152
|
Cache2.prototype._getKeyIndexForSingle = function(keyToMatch) {
|
|
788
|
-
var
|
|
789
|
-
if (!
|
|
1153
|
+
var keys2 = this.keys;
|
|
1154
|
+
if (!keys2.length) {
|
|
790
1155
|
return -1;
|
|
791
1156
|
}
|
|
792
|
-
var existingKey =
|
|
1157
|
+
var existingKey = keys2[0];
|
|
793
1158
|
var length = existingKey.length;
|
|
794
1159
|
if (keyToMatch.length !== length) {
|
|
795
1160
|
return -1;
|
|
@@ -806,22 +1171,22 @@ var Cache = (
|
|
|
806
1171
|
return isEqual(existingKey[0], keyToMatch[0]) ? 0 : -1;
|
|
807
1172
|
};
|
|
808
1173
|
Cache2.prototype.orderByLru = function(key, value, startingIndex) {
|
|
809
|
-
var
|
|
1174
|
+
var keys2 = this.keys;
|
|
810
1175
|
var values = this.values;
|
|
811
|
-
var currentLength =
|
|
1176
|
+
var currentLength = keys2.length;
|
|
812
1177
|
var index = startingIndex;
|
|
813
1178
|
while (index--) {
|
|
814
|
-
|
|
1179
|
+
keys2[index + 1] = keys2[index];
|
|
815
1180
|
values[index + 1] = values[index];
|
|
816
1181
|
}
|
|
817
|
-
|
|
1182
|
+
keys2[0] = key;
|
|
818
1183
|
values[0] = value;
|
|
819
1184
|
var maxSize = this.options.maxSize;
|
|
820
1185
|
if (currentLength === maxSize && startingIndex === currentLength) {
|
|
821
|
-
|
|
1186
|
+
keys2.pop();
|
|
822
1187
|
values.pop();
|
|
823
1188
|
} else if (startingIndex >= maxSize) {
|
|
824
|
-
|
|
1189
|
+
keys2.length = values.length = maxSize;
|
|
825
1190
|
}
|
|
826
1191
|
};
|
|
827
1192
|
Cache2.prototype.updateAsyncCache = function(memoized) {
|
|
@@ -871,19 +1236,19 @@ function createMemoizedFunction(fn, options) {
|
|
|
871
1236
|
transformKey
|
|
872
1237
|
}, getCustomOptions(options));
|
|
873
1238
|
var cache = new Cache(normalizedOptions);
|
|
874
|
-
var
|
|
1239
|
+
var keys2 = cache.keys, values = cache.values, canTransformKey = cache.canTransformKey, shouldCloneArguments = cache.shouldCloneArguments, shouldUpdateOnAdd = cache.shouldUpdateOnAdd, shouldUpdateOnChange = cache.shouldUpdateOnChange, shouldUpdateOnHit = cache.shouldUpdateOnHit;
|
|
875
1240
|
var memoized = function() {
|
|
876
1241
|
var key = shouldCloneArguments ? cloneArray(arguments) : arguments;
|
|
877
1242
|
if (canTransformKey) {
|
|
878
1243
|
key = transformKey(key);
|
|
879
1244
|
}
|
|
880
|
-
var keyIndex =
|
|
1245
|
+
var keyIndex = keys2.length ? cache.getKeyIndex(key) : -1;
|
|
881
1246
|
if (keyIndex !== -1) {
|
|
882
1247
|
if (shouldUpdateOnHit) {
|
|
883
1248
|
onCacheHit(cache, normalizedOptions, memoized);
|
|
884
1249
|
}
|
|
885
1250
|
if (keyIndex) {
|
|
886
|
-
cache.orderByLru(
|
|
1251
|
+
cache.orderByLru(keys2[keyIndex], values[keyIndex], keyIndex);
|
|
887
1252
|
if (shouldUpdateOnChange) {
|
|
888
1253
|
onCacheChange(cache, normalizedOptions, memoized);
|
|
889
1254
|
}
|
|
@@ -891,7 +1256,7 @@ function createMemoizedFunction(fn, options) {
|
|
|
891
1256
|
} else {
|
|
892
1257
|
var newValue = fn.apply(this, arguments);
|
|
893
1258
|
var newKey = shouldCloneArguments ? key : cloneArray(arguments);
|
|
894
|
-
cache.orderByLru(newKey, newValue,
|
|
1259
|
+
cache.orderByLru(newKey, newValue, keys2.length);
|
|
895
1260
|
if (isPromise) {
|
|
896
1261
|
cache.updateAsyncCache(memoized);
|
|
897
1262
|
}
|
|
@@ -921,22 +1286,20 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
921
1286
|
skipImportCheck: true,
|
|
922
1287
|
version: "detect"
|
|
923
1288
|
};
|
|
924
|
-
|
|
925
|
-
return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
|
|
926
|
-
}
|
|
1289
|
+
var defineSettings = F.identity;
|
|
927
1290
|
var decodeSettings = createMemoizedFunction((data) => {
|
|
928
|
-
return {
|
|
1291
|
+
return Data.struct({
|
|
929
1292
|
...INITIAL_ESLINT_REACT_SETTINGS,
|
|
930
1293
|
...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
|
|
931
|
-
};
|
|
1294
|
+
});
|
|
932
1295
|
}, { isEqual: (a, b) => a === b });
|
|
933
1296
|
function unsafeCastSettings(data) {
|
|
934
|
-
return data?.["react-x"] ?? {};
|
|
1297
|
+
return Data.struct(data?.["react-x"] ?? {});
|
|
935
1298
|
}
|
|
936
1299
|
var expandSettings = createMemoizedFunction(
|
|
937
1300
|
(settings) => {
|
|
938
1301
|
const additionalComponents = settings.additionalComponents ?? [];
|
|
939
|
-
return {
|
|
1302
|
+
return Data.struct({
|
|
940
1303
|
...settings,
|
|
941
1304
|
additionalComponents: additionalComponents.map((component) => ({
|
|
942
1305
|
...component,
|
|
@@ -952,9 +1315,9 @@ var expandSettings = createMemoizedFunction(
|
|
|
952
1315
|
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
953
1316
|
return acc.set(name, as);
|
|
954
1317
|
}, /* @__PURE__ */ new Map())
|
|
955
|
-
};
|
|
1318
|
+
});
|
|
956
1319
|
},
|
|
957
|
-
{
|
|
1320
|
+
{ isEqual: shallowEqual }
|
|
958
1321
|
);
|
|
959
1322
|
|
|
960
1323
|
export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, INITIAL_ESLINT_REACT_SETTINGS, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, expandSettings, unsafeCastSettings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2-beta.4",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@typescript-eslint/utils": "^8.0.1",
|
|
39
|
-
"picomatch": "^4.0.2"
|
|
39
|
+
"picomatch": "^4.0.2",
|
|
40
|
+
"@eslint-react/tools": "1.9.2-beta.4"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@types/picomatch": "^3.0.
|
|
43
|
+
"@types/picomatch": "^3.0.1",
|
|
44
|
+
"fast-equals": "^5.0.1",
|
|
43
45
|
"micro-memoize": "^4.1.2",
|
|
44
46
|
"tsup": "^8.2.4",
|
|
45
|
-
"type-fest": "^4.
|
|
47
|
+
"type-fest": "^4.24.0",
|
|
46
48
|
"valibot": "^0.37.0"
|
|
47
49
|
},
|
|
48
50
|
"scripts": {
|