@eslint-react/core 1.28.1-next.0 → 1.28.1-next.2

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var AST8 = require('@eslint-react/ast');
3
+ var AST5 = require('@eslint-react/ast');
4
4
  var eff = require('@eslint-react/eff');
5
5
  var JSX3 = require('@eslint-react/jsx');
6
6
  var shared = require('@eslint-react/shared');
@@ -29,13 +29,28 @@ function _interopNamespace(e) {
29
29
  return Object.freeze(n);
30
30
  }
31
31
 
32
- var AST8__namespace = /*#__PURE__*/_interopNamespace(AST8);
32
+ var AST5__namespace = /*#__PURE__*/_interopNamespace(AST5);
33
33
  var JSX3__namespace = /*#__PURE__*/_interopNamespace(JSX3);
34
34
  var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
35
35
  var birecord__default = /*#__PURE__*/_interopDefault(birecord);
36
36
 
37
37
  // src/component/component-collector.ts
38
38
 
39
+ // src/constants.ts
40
+ var DISPLAY_NAME_ASSIGNMENT_SELECTOR = [
41
+ "AssignmentExpression",
42
+ "[type]",
43
+ "[operator='=']",
44
+ "[left.type='MemberExpression']",
45
+ "[left.property.name='displayName']"
46
+ ].join("");
47
+
48
+ // src/hook/hook-name.ts
49
+ var RE_HOOK_NAME = /^use[A-Z\d]/u;
50
+ function isReactHookName(name) {
51
+ return name === "use" || RE_HOOK_NAME.test(name);
52
+ }
53
+
39
54
  // ../../node_modules/.pnpm/valibot@1.0.0-rc.2_typescript@5.8.1-rc/node_modules/valibot/dist/index.js
40
55
  var store;
41
56
  // @__NO_SIDE_EFFECTS__
@@ -526,7 +541,7 @@ function isInitializedFromReact(name, importSource, initialScope) {
526
541
  }
527
542
  const args = getRequireExpressionArguments(init);
528
543
  const arg0 = args?.[0];
529
- if (arg0 == null || !AST8__namespace.isKindOfLiteral(arg0, "string")) {
544
+ if (arg0 == null || !AST5__namespace.isKindOfLiteral(arg0, "string")) {
530
545
  return false;
531
546
  }
532
547
  return arg0.value === importSource || arg0.value.startsWith(`${importSource}/`);
@@ -557,93 +572,74 @@ function isFromReactStrict(node, name, importSource, initialScope) {
557
572
  }
558
573
  }
559
574
  function isFromReact(name) {
560
- return (context, node) => {
575
+ return eff.dual(2, (context, node) => {
576
+ if (node == null) return false;
561
577
  const { importSource = defaultImportSource, skipImportCheck = true } = shared.unsafeDecodeSettings(context.settings);
562
578
  if (skipImportCheck) return isFromReactLoose(node, name);
563
579
  return isFromReactStrict(node, name, importSource, context.sourceCode.getScope(node));
564
- };
580
+ });
565
581
  }
566
- function isFromReactMember(memberName, name) {
567
- return (context, node) => {
582
+ function isFromReactObject(objectName, propertyName) {
583
+ return eff.dual(2, (context, node) => {
584
+ if (node?.type !== types.AST_NODE_TYPES.MemberExpression) return false;
568
585
  const { importSource = defaultImportSource, skipImportCheck = true } = shared.unsafeDecodeSettings(context.settings);
569
586
  const { object: object2, property } = node;
570
- if (skipImportCheck) return isFromReactLoose(object2, memberName) && isFromReactLoose(property, name);
587
+ if (skipImportCheck) return isFromReactLoose(object2, objectName) && isFromReactLoose(property, propertyName);
571
588
  return isFromReactStrict(
572
589
  object2,
573
- memberName,
590
+ objectName,
574
591
  importSource,
575
592
  context.sourceCode.getScope(object2)
576
- ) && isFromReactStrict(property, name, importSource, context.sourceCode.getScope(property));
577
- };
593
+ ) && isFromReactLoose(property, propertyName);
594
+ });
578
595
  }
579
-
580
- // src/utils/is-call-from-react.ts
581
596
  function isCallFromReact(name) {
582
597
  return eff.dual(2, (context, node) => {
583
598
  if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
584
- if (!AST8__namespace.isOneOf([types.AST_NODE_TYPES.Identifier, types.AST_NODE_TYPES.MemberExpression])(node.callee)) return false;
585
599
  return isFromReact(name)(context, node.callee);
586
600
  });
587
601
  }
588
- function isCallFromReactMember(pragmaMemberName, name) {
602
+ function isCallFromReactObject(objectName, propertyName) {
589
603
  return eff.dual(2, (context, node) => {
590
604
  if (node.type !== types.AST_NODE_TYPES.CallExpression) return false;
591
- if (!AST8__namespace.is(types.AST_NODE_TYPES.MemberExpression)(node.callee)) return false;
592
- return isFromReactMember(pragmaMemberName, name)(context, node.callee);
605
+ return isFromReactObject(objectName, propertyName)(context, node.callee);
593
606
  });
594
607
  }
595
- var DISPLAY_NAME_ASSIGNMENT_SELECTOR = [
596
- "AssignmentExpression",
597
- "[type]",
598
- "[operator='=']",
599
- "[left.type='MemberExpression']",
600
- "[left.property.name='displayName']"
601
- ].join("");
602
- function isDisplayNameAssignment(node) {
603
- if (node == null) return false;
604
- return node.type === types.AST_NODE_TYPES.AssignmentExpression && node.operator === "=" && node.left.type === types.AST_NODE_TYPES.MemberExpression && node.left.property.type === types.AST_NODE_TYPES.Identifier && node.left.property.name === "displayName";
605
- }
606
608
 
607
609
  // src/utils/is-react-api.ts
608
- function isReactAPIWithName(name, member) {
609
- return member != null ? isFromReactMember(name, member) : isFromReact(name);
610
- }
611
- function isReactAPICallWithName(name, member) {
612
- return member != null ? isCallFromReactMember(name, member) : isCallFromReact(name);
613
- }
614
- var isChildrenCount = isReactAPIWithName("Children", "count");
615
- var isChildrenForEach = isReactAPIWithName("Children", "forEach");
616
- var isChildrenMap = isReactAPIWithName("Children", "map");
617
- var isChildrenOnly = isReactAPIWithName("Children", "only");
618
- var isChildrenToArray = isReactAPIWithName("Children", "toArray");
619
- var isCloneElement = isReactAPIWithName("cloneElement");
620
- var isCreateContext = isReactAPIWithName("createContext");
621
- var isCreateElement = isReactAPIWithName("createElement");
622
- var isCreateRef = isReactAPIWithName("createRef");
623
- var isForwardRef = isReactAPIWithName("forwardRef");
624
- var isMemo = isReactAPIWithName("memo");
625
- var isChildrenCountCall = isReactAPICallWithName("Children", "count");
626
- var isChildrenForEachCall = isReactAPICallWithName("Children", "forEach");
627
- var isChildrenMapCall = isReactAPICallWithName("Children", "map");
628
- var isChildrenOnlyCall = isReactAPICallWithName("Children", "only");
629
- var isChildrenToArrayCall = isReactAPICallWithName("Children", "toArray");
630
- var isCloneElementCall = isReactAPICallWithName("cloneElement");
631
- var isCreateContextCall = isReactAPICallWithName("createContext");
632
- var isCreateElementCall = isReactAPICallWithName("createElement");
633
- var isCreateRefCall = isReactAPICallWithName("createRef");
634
- var isForwardRefCall = isReactAPICallWithName("forwardRef");
635
- var isMemoCall = isReactAPICallWithName("memo");
636
-
637
- // src/hook/hook-name.ts
638
- var RE_HOOK_NAME = /^use[A-Z\d]/u;
639
- function isReactHookName(name) {
640
- return name === "use" || RE_HOOK_NAME.test(name);
641
- }
610
+ function isReactAPI(arg0, arg1) {
611
+ return arg1 == null ? isFromReact(arg0) : isFromReactObject(arg0, arg1);
612
+ }
613
+ function isReactAPICall(arg0, arg1) {
614
+ return arg1 == null ? isCallFromReact(arg0) : isCallFromReactObject(arg0, arg1);
615
+ }
616
+ var isChildrenCount = isReactAPI("Children", "count");
617
+ var isChildrenForEach = isReactAPI("Children", "forEach");
618
+ var isChildrenMap = isReactAPI("Children", "map");
619
+ var isChildrenOnly = isReactAPI("Children", "only");
620
+ var isChildrenToArray = isReactAPI("Children", "toArray");
621
+ var isCloneElement = isReactAPI("cloneElement");
622
+ var isCreateContext = isReactAPI("createContext");
623
+ var isCreateElement = isReactAPI("createElement");
624
+ var isCreateRef = isReactAPI("createRef");
625
+ var isForwardRef = isReactAPI("forwardRef");
626
+ var isMemo = isReactAPI("memo");
627
+ var isChildrenCountCall = isReactAPICall("Children", "count");
628
+ var isChildrenForEachCall = isReactAPICall("Children", "forEach");
629
+ var isChildrenMapCall = isReactAPICall("Children", "map");
630
+ var isChildrenOnlyCall = isReactAPICall("Children", "only");
631
+ var isChildrenToArrayCall = isReactAPICall("Children", "toArray");
632
+ var isCloneElementCall = isReactAPICall("cloneElement");
633
+ var isCreateContextCall = isReactAPICall("createContext");
634
+ var isCreateElementCall = isReactAPICall("createElement");
635
+ var isCreateRefCall = isReactAPICall("createRef");
636
+ var isForwardRefCall = isReactAPICall("forwardRef");
637
+ var isMemoCall = isReactAPICall("memo");
642
638
 
643
639
  // src/hook/is.ts
644
640
  function isReactHook(node) {
645
641
  if (node == null) return eff._;
646
- const id = AST8__namespace.getFunctionIdentifier(node);
642
+ const id = AST5__namespace.getFunctionIdentifier(node);
647
643
  return id?.name != null && isReactHookName(id.name);
648
644
  }
649
645
  function isReactHookCall(node) {
@@ -737,15 +733,12 @@ var isUseStateCall = eff.flip(isReactHookCallWithName)("useState");
737
733
  var isUseSyncExternalStoreCall = eff.flip(isReactHookCallWithName)("useSyncExternalStore");
738
734
  var isUseTransitionCall = eff.flip(isReactHookCallWithName)("useTransition");
739
735
 
740
- // src/hook/hierarchy.ts
741
- function isInsideReactHook(node) {
742
- return isReactHook(AST8__namespace.findParentNode(node, AST8__namespace.isFunction));
743
- }
736
+ // src/hook/hook-collector.ts
744
737
  function useHookCollector() {
745
738
  const hooks = /* @__PURE__ */ new Map();
746
739
  const functionEntries = [];
747
740
  const onFunctionEnter = (node) => {
748
- const id = AST8__namespace.getFunctionIdentifier(node);
741
+ const id = AST5__namespace.getFunctionIdentifier(node);
749
742
  const key = shared.getId();
750
743
  const name = id?.name;
751
744
  if (name != null && isReactHookName(name)) {
@@ -841,7 +834,7 @@ function isComponentWrapperCall(context, node) {
841
834
  return isMemoCall(context, node) || isForwardRefCall(context, node) || isReactHookCallWithNameLoose(node)("useCallback");
842
835
  }
843
836
  function getFunctionComponentIdentifier(context, node) {
844
- const functionId = AST8__namespace.getFunctionIdentifier(node);
837
+ const functionId = AST5__namespace.getFunctionIdentifier(node);
845
838
  if (functionId != null) {
846
839
  return functionId;
847
840
  }
@@ -868,19 +861,6 @@ function hasNoneOrValidComponentName(context, node) {
868
861
  const name = Array.isArray(id) ? id.at(-1)?.name : id.name;
869
862
  return name != null && isComponentName(name);
870
863
  }
871
- function isInsideCreateElementProps(context, node) {
872
- const call = AST8__namespace.findParentNode(node, isCreateElementCall(context));
873
- if (call == null) return false;
874
- const prop = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ObjectExpression));
875
- if (prop == null) return false;
876
- return prop === call.arguments[1];
877
- }
878
- function isChildrenOfCreateElement(context, node) {
879
- const parent = node.parent;
880
- if (parent == null || parent.type !== types.AST_NODE_TYPES.CallExpression) return false;
881
- if (!isCreateElementCall(context, parent)) return false;
882
- return parent.arguments.slice(2).some((arg) => arg === node);
883
- }
884
864
  function isClassComponent(node) {
885
865
  if ("superClass" in node && node.superClass != null) {
886
866
  const re = /^(?:Pure)?Component$/u;
@@ -908,28 +888,28 @@ function isPureComponent(node) {
908
888
 
909
889
  // src/component/component-lifecycle.ts
910
890
  function isComponentDidMount(node) {
911
- return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
891
+ return AST5__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
912
892
  }
913
893
  function isComponentWillUnmount(node) {
914
- return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUnmount";
894
+ return AST5__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUnmount";
915
895
  }
916
896
  function isComponentDidCatch(node) {
917
- return AST8__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
897
+ return AST5__namespace.isMethodOrProperty(node) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
918
898
  }
919
899
  function isGetDerivedStateFromError(node) {
920
- return AST8__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
900
+ return AST5__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
921
901
  }
922
902
  function isGetDerivedStateFromProps(node) {
923
- return AST8__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromProps";
903
+ return AST5__namespace.isMethodOrProperty(node) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromProps";
924
904
  }
925
905
  function isFunctionOfComponentDidMount(node) {
926
- return AST8__namespace.isFunction(node) && isComponentDidMount(node.parent) && node.parent.value === node;
906
+ return AST5__namespace.isFunction(node) && isComponentDidMount(node.parent) && node.parent.value === node;
927
907
  }
928
908
  function isFunctionOfComponentWillUnmount(node) {
929
- return AST8__namespace.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
909
+ return AST5__namespace.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
930
910
  }
931
911
  function isRenderMethodLike(node) {
932
- return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "render" && node.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration;
912
+ return AST5__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "render" && node.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration;
933
913
  }
934
914
  function isFunctionOfRenderMethod(node) {
935
915
  if (!isRenderMethodLike(node.parent)) {
@@ -938,7 +918,7 @@ function isFunctionOfRenderMethod(node) {
938
918
  return isClassComponent(node.parent.parent.parent);
939
919
  }
940
920
  function isInsideRenderMethod(node) {
941
- return AST8__namespace.findParentNode(node, (node2) => isRenderMethodLike(node2) && isClassComponent(node2.parent.parent)) != null;
921
+ return AST5__namespace.findParentNode(node, (node2) => isRenderMethodLike(node2) && isClassComponent(node2.parent.parent)) != null;
942
922
  }
943
923
 
944
924
  // src/component/hierarchy.ts
@@ -946,7 +926,7 @@ function hasValidHierarchy(context, node, hint) {
946
926
  if (isChildrenOfCreateElement(context, node) || isFunctionOfRenderMethod(node)) {
947
927
  return false;
948
928
  }
949
- if (hint & ERComponentHint.SkipMapCallback && AST8__namespace.isMapCallLoose(node.parent)) {
929
+ if (hint & ERComponentHint.SkipMapCallback && AST5__namespace.isMapCallLoose(node.parent)) {
950
930
  return false;
951
931
  }
952
932
  if (hint & ERComponentHint.SkipObjectMethod && isFunctionOfObjectMethod(node.parent)) {
@@ -958,9 +938,9 @@ function hasValidHierarchy(context, node, hint) {
958
938
  if (hint & ERComponentHint.SkipClassProperty && isFunctionOfClassProperty(node.parent)) {
959
939
  return false;
960
940
  }
961
- const boundaryNode = AST8__namespace.findParentNode(
941
+ const boundaryNode = AST5__namespace.findParentNode(
962
942
  node,
963
- AST8__namespace.isOneOf([
943
+ AST5__namespace.isOneOf([
964
944
  types.AST_NODE_TYPES.JSXExpressionContainer,
965
945
  types.AST_NODE_TYPES.ArrowFunctionExpression,
966
946
  types.AST_NODE_TYPES.FunctionExpression,
@@ -970,6 +950,12 @@ function hasValidHierarchy(context, node, hint) {
970
950
  );
971
951
  return boundaryNode == null || boundaryNode.type !== types.AST_NODE_TYPES.JSXExpressionContainer;
972
952
  }
953
+ function isChildrenOfCreateElement(context, node) {
954
+ const parent = node.parent;
955
+ if (parent == null || parent.type !== types.AST_NODE_TYPES.CallExpression) return false;
956
+ if (!isCreateElementCall(context, parent)) return false;
957
+ return parent.arguments.slice(2).some((arg) => arg === node);
958
+ }
973
959
  function isFunctionOfClassMethod(node) {
974
960
  return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.MethodDefinition;
975
961
  }
@@ -981,8 +967,12 @@ function isFunctionOfObjectMethod(node) {
981
967
  }
982
968
 
983
969
  // src/component/component-collector.ts
984
- function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options = {}) {
985
- const { collectDisplayName = false, collectHookCalls = false } = options;
970
+ function useComponentCollector(context, options = {}) {
971
+ const {
972
+ collectDisplayName = false,
973
+ collectHookCalls = false,
974
+ hint = DEFAULT_COMPONENT_HINT
975
+ } = options;
986
976
  const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
987
977
  const components = /* @__PURE__ */ new Map();
988
978
  const functionEntries = [];
@@ -995,7 +985,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
995
985
  const entry = functionEntries.at(-1);
996
986
  if (entry == null) return;
997
987
  if (!entry.isComponent) return functionEntries.pop();
998
- const shouldDrop = AST8__namespace.getNestedReturnStatements(entry.node.body).slice().reverse().some((r) => {
988
+ const shouldDrop = AST5__namespace.getNestedReturnStatements(entry.node.body).slice().reverse().some((r) => {
999
989
  return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !JSX3__namespace.isJSXValue(r.argument, jsxCtx, hint);
1000
990
  });
1001
991
  if (shouldDrop) {
@@ -1022,7 +1012,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
1022
1012
  const { body } = entry.node;
1023
1013
  const isComponent = hasNoneOrValidComponentName(context, entry.node) && JSX3__namespace.isJSXValue(body, jsxCtx, hint) && hasValidHierarchy(context, entry.node, hint);
1024
1014
  if (!isComponent) return;
1025
- const initPath = AST8__namespace.getFunctionInitPath(entry.node);
1015
+ const initPath = AST5__namespace.getFunctionInitPath(entry.node);
1026
1016
  const id = getFunctionComponentIdentifier(context, entry.node);
1027
1017
  const name = getComponentNameFromIdentifier(id);
1028
1018
  const key = shared.getId();
@@ -1063,7 +1053,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
1063
1053
  const isComponent = hasNoneOrValidComponentName(context, entry.node) && JSX3__namespace.isJSXValue(node.argument, jsxCtx, hint) && hasValidHierarchy(context, entry.node, hint);
1064
1054
  if (!isComponent) return;
1065
1055
  entry.isComponent = true;
1066
- const initPath = AST8__namespace.getFunctionInitPath(entry.node);
1056
+ const initPath = AST5__namespace.getFunctionInitPath(entry.node);
1067
1057
  const id = getFunctionComponentIdentifier(context, entry.node);
1068
1058
  const name = getComponentNameFromIdentifier(id);
1069
1059
  components.set(entry.key, {
@@ -1084,10 +1074,10 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
1084
1074
  }
1085
1075
  function getComponentFlag(initPath) {
1086
1076
  let flag = ERComponentFlag.None;
1087
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
1077
+ if (initPath != null && AST5__namespace.hasCallInFunctionInitPath("memo", initPath)) {
1088
1078
  flag |= ERComponentFlag.Memo;
1089
1079
  }
1090
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
1080
+ if (initPath != null && AST5__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
1091
1081
  flag |= ERComponentFlag.ForwardRef;
1092
1082
  }
1093
1083
  return flag;
@@ -1104,7 +1094,7 @@ function useComponentCollectorLegacy() {
1104
1094
  if (!isClassComponent(node)) {
1105
1095
  return;
1106
1096
  }
1107
- const id = AST8__namespace.getClassIdentifier(node);
1097
+ const id = AST5__namespace.getClassIdentifier(node);
1108
1098
  const key = shared.getId();
1109
1099
  const flag = isPureComponent(node) ? ERComponentFlag.PureComponent : ERComponentFlag.None;
1110
1100
  components.set(
@@ -1137,7 +1127,7 @@ var ERPhaseRelevance = birecord__default.default({
1137
1127
  var isInversePhase = eff.dual(2, (a, b) => ERPhaseRelevance.get(a) === b);
1138
1128
  function isRenderFunctionLoose(context, node) {
1139
1129
  const { body, parent } = node;
1140
- if (AST8__namespace.getFunctionIdentifier(node)?.name.startsWith("render")) {
1130
+ if (AST5__namespace.getFunctionIdentifier(node)?.name.startsWith("render")) {
1141
1131
  return parent.type === types.AST_NODE_TYPES.JSXExpressionContainer && parent.parent.type === types.AST_NODE_TYPES.JSXAttribute && parent.parent.name.type === types.AST_NODE_TYPES.JSXIdentifier && parent.parent.name.name.startsWith("render");
1142
1132
  }
1143
1133
  return JSX3__namespace.isJSXValue(
@@ -1152,7 +1142,7 @@ function isRenderPropLoose(context, node) {
1152
1142
  if (node.name.type !== types.AST_NODE_TYPES.JSXIdentifier) {
1153
1143
  return false;
1154
1144
  }
1155
- return node.name.name.startsWith("render") && node.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && AST8__namespace.isFunction(node.value.expression) && isRenderFunctionLoose(context, node.value.expression);
1145
+ return node.name.name.startsWith("render") && node.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && AST5__namespace.isFunction(node.value.expression) && isRenderFunctionLoose(context, node.value.expression);
1156
1146
  }
1157
1147
  function isDirectValueOfRenderPropertyLoose(node) {
1158
1148
  const matching = (node2) => {
@@ -1164,7 +1154,7 @@ function isDeclaredInRenderPropLoose(node) {
1164
1154
  if (isDirectValueOfRenderPropertyLoose(node)) {
1165
1155
  return true;
1166
1156
  }
1167
- const parent = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer))?.parent;
1157
+ const parent = AST5__namespace.findParentNode(node, AST5__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer))?.parent;
1168
1158
  if (parent?.type !== types.AST_NODE_TYPES.JSXAttribute) {
1169
1159
  return false;
1170
1160
  }
@@ -1172,17 +1162,18 @@ function isDeclaredInRenderPropLoose(node) {
1172
1162
  }
1173
1163
  function isThisSetState(node) {
1174
1164
  const { callee } = node;
1175
- return callee.type === types.AST_NODE_TYPES.MemberExpression && AST8__namespace.isThisExpression(callee.object) && callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === "setState";
1165
+ return callee.type === types.AST_NODE_TYPES.MemberExpression && AST5__namespace.isThisExpression(callee.object) && callee.property.type === types.AST_NODE_TYPES.Identifier && callee.property.name === "setState";
1176
1166
  }
1177
1167
  function isFunctionOfUseEffectSetup(node) {
1178
1168
  if (node == null) return eff._;
1179
1169
  return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
1180
1170
  }
1181
1171
  function isFunctionOfUseEffectCleanup(node) {
1182
- const nearReturn = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
1183
- const nearFunction = AST8__namespace.findParentNode(node, AST8__namespace.isFunction);
1184
- const nearFunctionOfReturn = AST8__namespace.findParentNode(nearReturn, AST8__namespace.isFunction);
1185
- return nearFunction === nearFunctionOfReturn && isFunctionOfUseEffectSetup(nearFunction);
1172
+ if (node == null) return eff._;
1173
+ const returnStatement = AST5__namespace.findParentNode(node, AST5__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
1174
+ const enclosingFunction = AST5__namespace.findParentNode(node, AST5__namespace.isFunction);
1175
+ const functionOfReturnStatement = AST5__namespace.findParentNode(returnStatement, AST5__namespace.isFunction);
1176
+ return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
1186
1177
  }
1187
1178
 
1188
1179
  exports.DEFAULT_COMPONENT_HINT = DEFAULT_COMPONENT_HINT;
@@ -1197,14 +1188,13 @@ exports.getFunctionComponentIdentifier = getFunctionComponentIdentifier;
1197
1188
  exports.hasNoneOrValidComponentName = hasNoneOrValidComponentName;
1198
1189
  exports.hasValidHierarchy = hasValidHierarchy;
1199
1190
  exports.isCallFromReact = isCallFromReact;
1200
- exports.isCallFromReactMember = isCallFromReactMember;
1191
+ exports.isCallFromReactObject = isCallFromReactObject;
1201
1192
  exports.isChildrenCount = isChildrenCount;
1202
1193
  exports.isChildrenCountCall = isChildrenCountCall;
1203
1194
  exports.isChildrenForEach = isChildrenForEach;
1204
1195
  exports.isChildrenForEachCall = isChildrenForEachCall;
1205
1196
  exports.isChildrenMap = isChildrenMap;
1206
1197
  exports.isChildrenMapCall = isChildrenMapCall;
1207
- exports.isChildrenOfCreateElement = isChildrenOfCreateElement;
1208
1198
  exports.isChildrenOnly = isChildrenOnly;
1209
1199
  exports.isChildrenOnlyCall = isChildrenOnlyCall;
1210
1200
  exports.isChildrenToArray = isChildrenToArray;
@@ -1224,12 +1214,11 @@ exports.isCreateRef = isCreateRef;
1224
1214
  exports.isCreateRefCall = isCreateRefCall;
1225
1215
  exports.isDeclaredInRenderPropLoose = isDeclaredInRenderPropLoose;
1226
1216
  exports.isDirectValueOfRenderPropertyLoose = isDirectValueOfRenderPropertyLoose;
1227
- exports.isDisplayNameAssignment = isDisplayNameAssignment;
1228
1217
  exports.isForwardRef = isForwardRef;
1229
1218
  exports.isForwardRefCall = isForwardRefCall;
1230
1219
  exports.isFromReact = isFromReact;
1231
1220
  exports.isFromReactLoose = isFromReactLoose;
1232
- exports.isFromReactMember = isFromReactMember;
1221
+ exports.isFromReactObject = isFromReactObject;
1233
1222
  exports.isFromReactStrict = isFromReactStrict;
1234
1223
  exports.isFunctionOfComponentDidMount = isFunctionOfComponentDidMount;
1235
1224
  exports.isFunctionOfComponentWillUnmount = isFunctionOfComponentWillUnmount;
@@ -1239,15 +1228,13 @@ exports.isFunctionOfUseEffectSetup = isFunctionOfUseEffectSetup;
1239
1228
  exports.isGetDerivedStateFromError = isGetDerivedStateFromError;
1240
1229
  exports.isGetDerivedStateFromProps = isGetDerivedStateFromProps;
1241
1230
  exports.isInitializedFromReact = isInitializedFromReact;
1242
- exports.isInsideCreateElementProps = isInsideCreateElementProps;
1243
- exports.isInsideReactHook = isInsideReactHook;
1244
1231
  exports.isInsideRenderMethod = isInsideRenderMethod;
1245
1232
  exports.isInversePhase = isInversePhase;
1246
1233
  exports.isMemo = isMemo;
1247
1234
  exports.isMemoCall = isMemoCall;
1248
1235
  exports.isPureComponent = isPureComponent;
1249
- exports.isReactAPICallWithName = isReactAPICallWithName;
1250
- exports.isReactAPIWithName = isReactAPIWithName;
1236
+ exports.isReactAPI = isReactAPI;
1237
+ exports.isReactAPICall = isReactAPICall;
1251
1238
  exports.isReactHook = isReactHook;
1252
1239
  exports.isReactHookCall = isReactHookCall;
1253
1240
  exports.isReactHookCallWithName = isReactHookCallWithName;