@eslint-react/core 1.37.1-beta.4 → 1.37.1-beta.5

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 CHANGED
@@ -284,6 +284,7 @@ type ERHookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "
284
284
 
285
285
  declare const RE_HOOK_NAME: RegExp;
286
286
  declare function isReactHookName(name: string): boolean;
287
+ declare function isReactHookNameLoose(name: string): boolean;
287
288
 
288
289
  declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefined;
289
290
  /**
@@ -292,25 +293,29 @@ declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefine
292
293
  * @returns `true` if the node is a React Hook call, `false` otherwise.
293
294
  */
294
295
  declare function isReactHookCall(node: TSESTree.Node | _): boolean;
295
- declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.CallExpression | _): (name: string) => boolean;
296
- declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression | _): (name: string) => boolean;
296
+ declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | _): (name: string) => boolean;
297
+ declare function isReactHookCallWithNameLoose(node: TSESTree.Node | _): (name: string) => boolean;
297
298
  declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: _ | string[]): (node: TSESTree.CallExpression) => boolean;
298
299
  declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
299
- declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
300
- declare const isUseContextCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
301
- declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
302
- declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
303
- declare const isUseEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
304
- declare const isUseIdCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
305
- declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
306
- declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
307
- declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
308
- declare const isUseMemoCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
309
- declare const isUseReducerCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
310
- declare const isUseRefCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
311
- declare const isUseStateCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
312
- declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
313
- declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
300
+ declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
301
+ declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
302
+ declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
303
+ declare const isUseContextCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
304
+ declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
305
+ declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
306
+ declare const isUseEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
307
+ declare const isUseFormStatusCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
308
+ declare const isUseIdCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
309
+ declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
310
+ declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
311
+ declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
312
+ declare const isUseMemoCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
313
+ declare const isUseOptimisticCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
314
+ declare const isUseReducerCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
315
+ declare const isUseRefCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
316
+ declare const isUseStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
317
+ declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
318
+ declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
314
319
 
315
320
  interface ERSemanticEntry {
316
321
  node: TSESTree.Node;
@@ -386,4 +391,4 @@ declare const isCreateRefCall: isCallFromReact.ReturnType;
386
391
  declare const isForwardRefCall: isCallFromReact.ReturnType;
387
392
  declare const isMemoCall: isCallFromReact.ReturnType;
388
393
 
389
- export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
394
+ export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isReactHookNameLoose, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.d.ts CHANGED
@@ -284,6 +284,7 @@ type ERHookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "
284
284
 
285
285
  declare const RE_HOOK_NAME: RegExp;
286
286
  declare function isReactHookName(name: string): boolean;
287
+ declare function isReactHookNameLoose(name: string): boolean;
287
288
 
288
289
  declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefined;
289
290
  /**
@@ -292,25 +293,29 @@ declare function isReactHook(node: AST.TSESTreeFunction | _): boolean | undefine
292
293
  * @returns `true` if the node is a React Hook call, `false` otherwise.
293
294
  */
294
295
  declare function isReactHookCall(node: TSESTree.Node | _): boolean;
295
- declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.CallExpression | _): (name: string) => boolean;
296
- declare function isReactHookCallWithNameLoose(node: TSESTree.CallExpression | _): (name: string) => boolean;
296
+ declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | _): (name: string) => boolean;
297
+ declare function isReactHookCallWithNameLoose(node: TSESTree.Node | _): (name: string) => boolean;
297
298
  declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: _ | string[]): (node: TSESTree.CallExpression) => boolean;
298
299
  declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
299
- declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
300
- declare const isUseContextCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
301
- declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
302
- declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
303
- declare const isUseEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
304
- declare const isUseIdCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
305
- declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
306
- declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
307
- declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
308
- declare const isUseMemoCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
309
- declare const isUseReducerCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
310
- declare const isUseRefCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
311
- declare const isUseStateCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
312
- declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
313
- declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.CallExpression | undefined) => boolean;
300
+ declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
301
+ declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
302
+ declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
303
+ declare const isUseContextCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
304
+ declare const isUseDebugValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
305
+ declare const isUseDeferredValueCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
306
+ declare const isUseEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
307
+ declare const isUseFormStatusCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
308
+ declare const isUseIdCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
309
+ declare const isUseImperativeHandleCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
310
+ declare const isUseInsertionEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
311
+ declare const isUseLayoutEffectCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
312
+ declare const isUseMemoCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
313
+ declare const isUseOptimisticCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
314
+ declare const isUseReducerCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
315
+ declare const isUseRefCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
316
+ declare const isUseStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
317
+ declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
318
+ declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
314
319
 
315
320
  interface ERSemanticEntry {
316
321
  node: TSESTree.Node;
@@ -386,4 +391,4 @@ declare const isCreateRefCall: isCallFromReact.ReturnType;
386
391
  declare const isForwardRefCall: isCallFromReact.ReturnType;
387
392
  declare const isMemoCall: isCallFromReact.ReturnType;
388
393
 
389
- export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
394
+ export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isReactHookNameLoose, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.js CHANGED
@@ -50,6 +50,9 @@ var RE_HOOK_NAME = /^use[A-Z\d]/u;
50
50
  function isReactHookName(name) {
51
51
  return name === "use" || RE_HOOK_NAME.test(name);
52
52
  }
53
+ function isReactHookNameLoose(name) {
54
+ return name.startsWith("use");
55
+ }
53
56
 
54
57
  // ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.2/node_modules/valibot/dist/index.js
55
58
  var store;
@@ -677,7 +680,7 @@ function isReactHookCall(node) {
677
680
  return false;
678
681
  }
679
682
  function isReactHookCallWithName(context, node) {
680
- if (node == null) return eff.constFalse;
683
+ if (node == null || node.type !== types.AST_NODE_TYPES.CallExpression) return eff.constFalse;
681
684
  const {
682
685
  importSource = DEFAULT_ESLINT_REACT_SETTINGS.importSource,
683
686
  skipImportCheck = true
@@ -695,7 +698,7 @@ function isReactHookCallWithName(context, node) {
695
698
  };
696
699
  }
697
700
  function isReactHookCallWithNameLoose(node) {
698
- if (node == null) return eff.constFalse;
701
+ if (node == null || node.type !== types.AST_NODE_TYPES.CallExpression) return eff.constFalse;
699
702
  return (name) => {
700
703
  switch (node.callee.type) {
701
704
  case types.AST_NODE_TYPES.Identifier:
@@ -738,16 +741,20 @@ function isUseEffectCallLoose(node) {
738
741
  return false;
739
742
  }
740
743
  }
744
+ var isUseCall = eff.flip(isReactHookCallWithName)("use");
745
+ var isUseActionStateCall = eff.flip(isReactHookCallWithName)("useActionState");
741
746
  var isUseCallbackCall = eff.flip(isReactHookCallWithName)("useCallback");
742
747
  var isUseContextCall = eff.flip(isReactHookCallWithName)("useContext");
743
748
  var isUseDebugValueCall = eff.flip(isReactHookCallWithName)("useDebugValue");
744
749
  var isUseDeferredValueCall = eff.flip(isReactHookCallWithName)("useDeferredValue");
745
750
  var isUseEffectCall = eff.flip(isReactHookCallWithName)("useEffect");
751
+ var isUseFormStatusCall = eff.flip(isReactHookCallWithName)("useFormStatus");
746
752
  var isUseIdCall = eff.flip(isReactHookCallWithName)("useId");
747
753
  var isUseImperativeHandleCall = eff.flip(isReactHookCallWithName)("useImperativeHandle");
748
754
  var isUseInsertionEffectCall = eff.flip(isReactHookCallWithName)("useInsertionEffect");
749
755
  var isUseLayoutEffectCall = eff.flip(isReactHookCallWithName)("useLayoutEffect");
750
756
  var isUseMemoCall = eff.flip(isReactHookCallWithName)("useMemo");
757
+ var isUseOptimisticCall = eff.flip(isReactHookCallWithName)("useOptimistic");
751
758
  var isUseReducerCall = eff.flip(isReactHookCallWithName)("useReducer");
752
759
  var isUseRefCall = eff.flip(isReactHookCallWithName)("useRef");
753
760
  var isUseStateCall = eff.flip(isReactHookCallWithName)("useState");
@@ -1275,21 +1282,26 @@ exports.isReactHookCallWithName = isReactHookCallWithName;
1275
1282
  exports.isReactHookCallWithNameAlias = isReactHookCallWithNameAlias;
1276
1283
  exports.isReactHookCallWithNameLoose = isReactHookCallWithNameLoose;
1277
1284
  exports.isReactHookName = isReactHookName;
1285
+ exports.isReactHookNameLoose = isReactHookNameLoose;
1278
1286
  exports.isRenderFunctionLoose = isRenderFunctionLoose;
1279
1287
  exports.isRenderMethodLike = isRenderMethodLike;
1280
1288
  exports.isRenderPropLoose = isRenderPropLoose;
1281
1289
  exports.isThisSetState = isThisSetState;
1290
+ exports.isUseActionStateCall = isUseActionStateCall;
1291
+ exports.isUseCall = isUseCall;
1282
1292
  exports.isUseCallbackCall = isUseCallbackCall;
1283
1293
  exports.isUseContextCall = isUseContextCall;
1284
1294
  exports.isUseDebugValueCall = isUseDebugValueCall;
1285
1295
  exports.isUseDeferredValueCall = isUseDeferredValueCall;
1286
1296
  exports.isUseEffectCall = isUseEffectCall;
1287
1297
  exports.isUseEffectCallLoose = isUseEffectCallLoose;
1298
+ exports.isUseFormStatusCall = isUseFormStatusCall;
1288
1299
  exports.isUseIdCall = isUseIdCall;
1289
1300
  exports.isUseImperativeHandleCall = isUseImperativeHandleCall;
1290
1301
  exports.isUseInsertionEffectCall = isUseInsertionEffectCall;
1291
1302
  exports.isUseLayoutEffectCall = isUseLayoutEffectCall;
1292
1303
  exports.isUseMemoCall = isUseMemoCall;
1304
+ exports.isUseOptimisticCall = isUseOptimisticCall;
1293
1305
  exports.isUseReducerCall = isUseReducerCall;
1294
1306
  exports.isUseRefCall = isUseRefCall;
1295
1307
  exports.isUseStateCall = isUseStateCall;
package/dist/index.mjs CHANGED
@@ -23,6 +23,9 @@ var RE_HOOK_NAME = /^use[A-Z\d]/u;
23
23
  function isReactHookName(name) {
24
24
  return name === "use" || RE_HOOK_NAME.test(name);
25
25
  }
26
+ function isReactHookNameLoose(name) {
27
+ return name.startsWith("use");
28
+ }
26
29
 
27
30
  // ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.2/node_modules/valibot/dist/index.js
28
31
  var store;
@@ -650,7 +653,7 @@ function isReactHookCall(node) {
650
653
  return false;
651
654
  }
652
655
  function isReactHookCallWithName(context, node) {
653
- if (node == null) return constFalse;
656
+ if (node == null || node.type !== AST_NODE_TYPES.CallExpression) return constFalse;
654
657
  const {
655
658
  importSource = DEFAULT_ESLINT_REACT_SETTINGS.importSource,
656
659
  skipImportCheck = true
@@ -668,7 +671,7 @@ function isReactHookCallWithName(context, node) {
668
671
  };
669
672
  }
670
673
  function isReactHookCallWithNameLoose(node) {
671
- if (node == null) return constFalse;
674
+ if (node == null || node.type !== AST_NODE_TYPES.CallExpression) return constFalse;
672
675
  return (name) => {
673
676
  switch (node.callee.type) {
674
677
  case AST_NODE_TYPES.Identifier:
@@ -711,16 +714,20 @@ function isUseEffectCallLoose(node) {
711
714
  return false;
712
715
  }
713
716
  }
717
+ var isUseCall = flip(isReactHookCallWithName)("use");
718
+ var isUseActionStateCall = flip(isReactHookCallWithName)("useActionState");
714
719
  var isUseCallbackCall = flip(isReactHookCallWithName)("useCallback");
715
720
  var isUseContextCall = flip(isReactHookCallWithName)("useContext");
716
721
  var isUseDebugValueCall = flip(isReactHookCallWithName)("useDebugValue");
717
722
  var isUseDeferredValueCall = flip(isReactHookCallWithName)("useDeferredValue");
718
723
  var isUseEffectCall = flip(isReactHookCallWithName)("useEffect");
724
+ var isUseFormStatusCall = flip(isReactHookCallWithName)("useFormStatus");
719
725
  var isUseIdCall = flip(isReactHookCallWithName)("useId");
720
726
  var isUseImperativeHandleCall = flip(isReactHookCallWithName)("useImperativeHandle");
721
727
  var isUseInsertionEffectCall = flip(isReactHookCallWithName)("useInsertionEffect");
722
728
  var isUseLayoutEffectCall = flip(isReactHookCallWithName)("useLayoutEffect");
723
729
  var isUseMemoCall = flip(isReactHookCallWithName)("useMemo");
730
+ var isUseOptimisticCall = flip(isReactHookCallWithName)("useOptimistic");
724
731
  var isUseReducerCall = flip(isReactHookCallWithName)("useReducer");
725
732
  var isUseRefCall = flip(isReactHookCallWithName)("useRef");
726
733
  var isUseStateCall = flip(isReactHookCallWithName)("useState");
@@ -1178,4 +1185,4 @@ function isFunctionOfUseEffectCleanup(node) {
1178
1185
  return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
1179
1186
  }
1180
1187
 
1181
- export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, ERComponentFlag, ERComponentHint, ERPhaseRelevance, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
1188
+ export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, ERComponentFlag, ERComponentHint, ERPhaseRelevance, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isReactHookNameLoose, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.37.1-beta.4",
3
+ "version": "1.37.1-beta.5",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -41,11 +41,11 @@
41
41
  "@typescript-eslint/utils": "^8.27.0",
42
42
  "birecord": "^0.1.1",
43
43
  "ts-pattern": "^5.6.2",
44
- "@eslint-react/ast": "1.37.1-beta.4",
45
- "@eslint-react/shared": "1.37.1-beta.4",
46
- "@eslint-react/eff": "1.37.1-beta.4",
47
- "@eslint-react/jsx": "1.37.1-beta.4",
48
- "@eslint-react/var": "1.37.1-beta.4"
44
+ "@eslint-react/eff": "1.37.1-beta.5",
45
+ "@eslint-react/ast": "1.37.1-beta.5",
46
+ "@eslint-react/jsx": "1.37.1-beta.5",
47
+ "@eslint-react/shared": "1.37.1-beta.5",
48
+ "@eslint-react/var": "1.37.1-beta.5"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "^8.4.0",