@eslint-react/core 2.0.0-next.13 → 2.0.0-next.131

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +146 -36
  2. package/dist/index.js +122 -26
  3. package/package.json +13 -13
package/dist/index.d.ts CHANGED
@@ -2,10 +2,12 @@ import { RuleContext } from '@eslint-react/kit';
2
2
  import { TSESTree } from '@typescript-eslint/types';
3
3
  import { ESLintUtils, TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
4
4
  import * as AST from '@eslint-react/ast';
5
- import { _ } from '@eslint-react/eff';
5
+ import { unit } from '@eslint-react/eff';
6
6
  import * as birecord from 'birecord';
7
7
  import { Scope } from '@typescript-eslint/scope-manager';
8
8
  import * as VAR from '@eslint-react/var';
9
+ import ts from 'typescript';
10
+ export { isFalseLiteralType, isTrueLiteralType } from 'ts-api-utils';
9
11
 
10
12
  /**
11
13
  * Determines whether inside `createElement`'s children.
@@ -80,10 +82,10 @@ interface SemanticEntry {
80
82
  }
81
83
 
82
84
  interface SemanticNode {
83
- id: _ | TSESTree.Identifier | TSESTree.Identifier[];
85
+ id: unit | TSESTree.Identifier | TSESTree.Identifier[];
84
86
  key: string;
85
87
  kind: string;
86
- name: _ | string;
88
+ name: unit | string;
87
89
  node: TSESTree.Node;
88
90
  flag: bigint;
89
91
  hint: bigint;
@@ -100,23 +102,23 @@ declare const ComponentFlag: {
100
102
  };
101
103
 
102
104
  interface FunctionComponent extends SemanticNode {
103
- id: _ | TSESTree.Identifier | TSESTree.Identifier[];
105
+ id: unit | TSESTree.Identifier | TSESTree.Identifier[];
104
106
  kind: "function";
105
107
  node: AST.TSESTreeFunction;
106
108
  flag: ComponentFlag;
107
109
  hint: ComponentDetectionHint;
108
- initPath: _ | AST.FunctionInitPath;
110
+ initPath: unit | AST.FunctionInitPath;
109
111
  hookCalls: TSESTree.CallExpression[];
110
- displayName: _ | TSESTree.Expression;
112
+ displayName: unit | TSESTree.Expression;
111
113
  }
112
114
  interface ClassComponent extends SemanticNode {
113
- id: _ | TSESTree.Identifier;
115
+ id: unit | TSESTree.Identifier;
114
116
  kind: "class";
115
117
  node: AST.TSESTreeClass;
116
118
  flag: ComponentFlag;
117
119
  hint: ComponentDetectionHint;
118
120
  methods: AST.TSESTreeMethodOrProperty[];
119
- displayName: _ | TSESTree.Expression;
121
+ displayName: unit | TSESTree.Expression;
120
122
  }
121
123
  type Component = ClassComponent | FunctionComponent;
122
124
 
@@ -136,7 +138,7 @@ declare namespace useComponentCollector {
136
138
  ctx: {
137
139
  getAllComponents: (node: TSESTree.Program) => Map<string, FunctionComponent>;
138
140
  getCurrentEntries: () => FunctionEntry[];
139
- getCurrentEntry: () => FunctionEntry | _;
141
+ getCurrentEntry: () => FunctionEntry | unit;
140
142
  };
141
143
  listeners: ESLintUtils.RuleListener;
142
144
  };
@@ -178,7 +180,7 @@ declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.Retu
178
180
  declare function isFunctionOfRenderMethod(node: AST.TSESTreeFunction): boolean;
179
181
  declare function isValidComponentDefinition(context: RuleContext, node: AST.TSESTreeFunction, hint: bigint): boolean;
180
182
 
181
- declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | _;
183
+ declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | unit;
182
184
 
183
185
  declare function getComponentFlagFromInitPath(initPath: FunctionComponent["initPath"]): bigint;
184
186
 
@@ -217,7 +219,7 @@ declare function isGetDerivedStateFromError(node: TSESTree.Node): node is AST.TS
217
219
 
218
220
  declare function isComponentName(name: string): boolean;
219
221
  declare function isComponentNameLoose(name: string): boolean;
220
- declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | _): string | undefined;
222
+ declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | unit): string | undefined;
221
223
  declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean;
222
224
 
223
225
  /**
@@ -332,7 +334,7 @@ declare function isComponentWrapperCallLoose(context: RuleContext, node: TSESTre
332
334
  type EffectKind = "useEffect" | "useLayoutEffect" | "useInsertionEffect";
333
335
 
334
336
  interface Hook extends SemanticNode {
335
- id: TSESTree.Identifier | _;
337
+ id: TSESTree.Identifier | unit;
336
338
  node: AST.TSESTreeFunction;
337
339
  name: string;
338
340
  hookCalls: TSESTree.CallExpression[];
@@ -350,17 +352,17 @@ declare function useHookCollector(): useHookCollector.ReturnType;
350
352
 
351
353
  declare function isReactHookId(id: TSESTree.Identifier | TSESTree.MemberExpression): boolean;
352
354
 
353
- declare function isReactHook(node: AST.TSESTreeFunction | _): boolean;
355
+ declare function isReactHook(node: AST.TSESTreeFunction | unit): boolean;
354
356
  /**
355
357
  * Check if the given node is a React Hook call by its name.
356
358
  * @param node The node to check.
357
359
  * @returns `true` if the node is a React Hook call, `false` otherwise.
358
360
  */
359
- declare function isReactHookCall(node: TSESTree.Node | _): boolean;
360
- declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | _): (name: string) => boolean;
361
- declare function isReactHookCallWithNameLoose(node: TSESTree.Node | _): (name: string) => boolean;
362
- declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: _ | string[]): (node: TSESTree.CallExpression) => boolean;
363
- declare function isUseEffectCallLoose(node: TSESTree.Node | _): boolean;
361
+ declare function isReactHookCall(node: TSESTree.Node | unit): boolean;
362
+ declare function isReactHookCallWithName(context: RuleContext, node: TSESTree.Node | unit): (name: string) => boolean;
363
+ declare function isReactHookCallWithNameLoose(node: TSESTree.Node | unit): (name: string) => boolean;
364
+ declare function isReactHookCallWithNameAlias(context: RuleContext, name: string, alias?: unit | string[]): (node: TSESTree.CallExpression) => boolean;
365
+ declare function isUseEffectCallLoose(node: TSESTree.Node | unit): boolean;
364
366
  declare const isUseCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
365
367
  declare const isUseActionStateCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
366
368
  declare const isUseCallbackCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
@@ -381,8 +383,7 @@ declare const isUseStateCall: (context: RuleContext, node: TSESTree.Node | undef
381
383
  declare const isUseSyncExternalStoreCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
382
384
  declare const isUseTransitionCall: (context: RuleContext, node: TSESTree.Node | undefined) => boolean;
383
385
 
384
- type HookKind = "custom" | "useActionState" | "useCallback" | "useContext" | "useDebugValue" | "useDeferredValue" | "useEffect" | "useId" | "useImperativeHandle" | "useInsertionEffect" | "useLayoutEffect" | "useMemo" | "useOptimistic" | "useReducer" | "useRef" | "useState" | "useSyncExternalStore" | "useTransition";
385
-
386
+ declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
386
387
  /**
387
388
  * Catch all identifiers that begin with "use" followed by an uppercase Latin
388
389
  * character to exclude identifiers like "user".
@@ -399,7 +400,7 @@ declare function isReactHookName(name: string): boolean;
399
400
  * @param initialScope The initial scope to use for variable resolution
400
401
  * @returns The JSX attribute node or undefined
401
402
  */
402
- declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | _;
403
+ declare function getAttribute(context: RuleContext, name: string, attributes: (TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute)[], initialScope?: Scope): TSESTree$1.JSXAttribute | TSESTree$1.JSXSpreadAttribute | unit;
403
404
 
404
405
  /**
405
406
  * Get the stringified name of a JSX attribute
@@ -442,7 +443,7 @@ declare const DEFAULT_JSX_DETECTION_HINT: bigint;
442
443
  * @param node The AST node to check
443
444
  * @returns `true` if the node is a `JSXText` or a `Literal` node
444
445
  */
445
- declare function isJsxText(node: TSESTree$1.Node | null | _): node is TSESTree$1.JSXText | TSESTree$1.Literal;
446
+ declare function isJsxText(node: TSESTree$1.Node | null | unit): node is TSESTree$1.JSXText | TSESTree$1.Literal;
446
447
  /**
447
448
  * Heuristic decision to determine if a node is a JSX-like node.
448
449
  * @param code The sourceCode object
@@ -453,7 +454,10 @@ declare function isJsxText(node: TSESTree$1.Node | null | _): node is TSESTree$1
453
454
  */
454
455
  declare function isJsxLike(code: {
455
456
  getScope: (node: TSESTree$1.Node) => Scope;
456
- }, node: TSESTree$1.Node | _ | null, hint?: JSXDetectionHint): boolean;
457
+ }, node: TSESTree$1.Node | unit | null, hint?: JSXDetectionHint): boolean;
458
+
459
+ declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
460
+ declare function isFragmentElement(context: RuleContext, node: TSESTree.Node): node is TSESTree.JSXElement;
457
461
 
458
462
  /**
459
463
  * Get the stringified type of a JSX element
@@ -473,12 +477,7 @@ declare function hasEveryAttribute(context: RuleContext, names: string[], attrib
473
477
  * @param test The test to apply to the parent attribute
474
478
  * @returns The parent attribute node or undefined
475
479
  */
476
- declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | _;
477
-
478
- declare function isHostElement(context: RuleContext, node: TSESTree.Node): boolean;
479
- declare function isKeyedElement(context: RuleContext, node: TSESTree.Node, initialScope?: Scope): boolean;
480
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | _, allowJSXFragment?: false): node is TSESTree.JSXElement;
481
- declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | null | _, allowJSXFragment?: true): node is TSESTree.JSXElement | TSESTree.JSXFragment;
480
+ declare function findParentAttribute(node: TSESTree.Node, test?: (node: TSESTree.JSXAttribute) => boolean): TSESTree.JSXAttribute | unit;
482
481
 
483
482
  /**
484
483
  * Get the stringified representation of a JSX node
@@ -487,15 +486,126 @@ declare function isFragmentElement(context: RuleContext, node: TSESTree.Node | n
487
486
  */
488
487
  declare function stringifyJsx(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
489
488
 
489
+ /** @internal */
490
+ declare const isAnyType: (type: ts.Type) => boolean;
491
+ /** @internal */
492
+ declare const isBigIntType: (type: ts.Type) => boolean;
493
+ /** @internal */
494
+ declare const isBooleanType: (type: ts.Type) => boolean;
495
+ /** @internal */
496
+ declare const isEnumType: (type: ts.Type) => boolean;
497
+ /** @internal */
498
+ declare const isFalsyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
499
+ freshType: ts.FreshableType;
500
+ regularType: ts.FreshableType;
501
+ flags: ts.TypeFlags;
502
+ symbol: ts.Symbol;
503
+ pattern?: ts.DestructuringPattern;
504
+ aliasSymbol?: ts.Symbol;
505
+ aliasTypeArguments?: readonly ts.Type[];
506
+ getFlags: () => ts.TypeFlags;
507
+ getSymbol: () => ts.Symbol | undefined;
508
+ getProperties: () => ts.Symbol[];
509
+ getProperty: (propertyName: string) => ts.Symbol | undefined;
510
+ getApparentProperties: () => ts.Symbol[];
511
+ getCallSignatures: () => readonly ts.Signature[];
512
+ getConstructSignatures: () => readonly ts.Signature[];
513
+ getStringIndexType: () => ts.Type | undefined;
514
+ getNumberIndexType: () => ts.Type | undefined;
515
+ getBaseTypes: () => ts.BaseType[] | undefined;
516
+ getNonNullableType: () => ts.Type;
517
+ getConstraint: () => ts.Type | undefined;
518
+ getDefault: () => ts.Type | undefined;
519
+ isUnion: () => this is ts.UnionType;
520
+ isIntersection: () => this is ts.IntersectionType;
521
+ isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
522
+ isLiteral: () => this is ts.LiteralType;
523
+ isStringLiteral: () => this is ts.StringLiteralType;
524
+ isNumberLiteral: () => this is ts.NumberLiteralType;
525
+ isTypeParameter: () => this is ts.TypeParameter;
526
+ isClassOrInterface: () => this is ts.InterfaceType;
527
+ isClass: () => this is ts.InterfaceType;
528
+ isIndexType: () => this is ts.IndexType;
529
+ value: {
530
+ negative: boolean;
531
+ base10Value: "0";
532
+ };
533
+ };
534
+ /** @internal */
535
+ declare const isFalsyNumberType: (type: ts.Type) => boolean;
536
+ /** @internal */
537
+ declare const isFalsyStringType: (type: ts.Type) => boolean;
538
+ /** @internal */
539
+ declare const isNeverType: (type: ts.Type) => boolean;
540
+ /** @internal */
541
+ declare const isNullishType: (type: ts.Type) => boolean;
542
+ /** @internal */
543
+ declare const isNumberType: (type: ts.Type) => boolean;
544
+ /** @internal */
545
+ declare const isObjectType: (type: ts.Type) => boolean;
546
+ /** @internal */
547
+ declare const isStringType: (type: ts.Type) => boolean;
548
+ /** @internal */
549
+ declare const isTruthyBigIntType: (type: ts.Type) => type is ts.LiteralType & {
550
+ freshType: ts.FreshableType;
551
+ regularType: ts.FreshableType;
552
+ flags: ts.TypeFlags;
553
+ symbol: ts.Symbol;
554
+ pattern?: ts.DestructuringPattern;
555
+ aliasSymbol?: ts.Symbol;
556
+ aliasTypeArguments?: readonly ts.Type[];
557
+ getFlags: () => ts.TypeFlags;
558
+ getSymbol: () => ts.Symbol | undefined;
559
+ getProperties: () => ts.Symbol[];
560
+ getProperty: (propertyName: string) => ts.Symbol | undefined;
561
+ getApparentProperties: () => ts.Symbol[];
562
+ getCallSignatures: () => readonly ts.Signature[];
563
+ getConstructSignatures: () => readonly ts.Signature[];
564
+ getStringIndexType: () => ts.Type | undefined;
565
+ getNumberIndexType: () => ts.Type | undefined;
566
+ getBaseTypes: () => ts.BaseType[] | undefined;
567
+ getNonNullableType: () => ts.Type;
568
+ getConstraint: () => ts.Type | undefined;
569
+ getDefault: () => ts.Type | undefined;
570
+ isUnion: () => this is ts.UnionType;
571
+ isIntersection: () => this is ts.IntersectionType;
572
+ isUnionOrIntersection: () => this is ts.UnionOrIntersectionType;
573
+ isLiteral: () => this is ts.LiteralType;
574
+ isStringLiteral: () => this is ts.StringLiteralType;
575
+ isNumberLiteral: () => this is ts.NumberLiteralType;
576
+ isTypeParameter: () => this is ts.TypeParameter;
577
+ isClassOrInterface: () => this is ts.InterfaceType;
578
+ isClass: () => this is ts.InterfaceType;
579
+ isIndexType: () => this is ts.IndexType;
580
+ value: ts.PseudoBigInt;
581
+ };
582
+ /** @internal */
583
+ declare const isTruthyNumberType: (type: ts.Type) => boolean;
584
+ /** @internal */
585
+ declare const isTruthyStringType: (type: ts.Type) => boolean;
586
+ /** @internal */
587
+ declare const isUnknownType: (type: ts.Type) => boolean;
588
+
589
+ type TypeVariant = "any" | "bigint" | "boolean" | "enum" | "never" | "nullish" | "number" | "object" | "string" | "unknown" | "falsy bigint" | "falsy boolean" | "falsy number" | "falsy string" | "truthy bigint" | "truthy boolean" | "truthy number" | "truthy string";
590
+ /**
591
+ * Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements
592
+ * Get the variants of an array of types.
593
+ * @param types The types to get the variants of
594
+ * @returns The variants of the types
595
+ * @internal
596
+ */
597
+ declare function getTypeVariants(types: ts.Type[]): Set<TypeVariant>;
598
+
490
599
  /** @internal */
491
600
  declare function getInstanceId(node: TSESTree.Node, prev?: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.BinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpression | TSESTree.UpdateExpression | TSESTree.YieldExpression | undefined;
492
601
 
493
602
  /**
494
- * Check if an identifier is initialized from react
603
+ * Check if an identifier name is initialized from react
495
604
  * @param name The top-level identifier's name
496
605
  * @param importSource The import source to check against
497
606
  * @param initialScope Initial scope to search for the identifier
498
- * @returns Whether the identifier is initialized from react
607
+ * @returns Whether the identifier name is initialized from react
608
+ * @internal
499
609
  */
500
610
  declare function isInitializedFromReact(name: string, importSource: string, initialScope: Scope): boolean;
501
611
 
@@ -504,15 +614,15 @@ declare function isInstanceIdEqual(context: RuleContext, a: TSESTree.Node, b: TS
504
614
 
505
615
  declare namespace isReactAPI {
506
616
  type ReturnType = {
507
- (context: RuleContext, node: _ | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
508
- (context: RuleContext): (node: _ | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
617
+ (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
618
+ (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.MemberExpression | TSESTree.Identifier;
509
619
  };
510
620
  }
511
621
  declare function isReactAPI(api: string): isReactAPI.ReturnType;
512
622
  declare namespace isReactAPICall {
513
623
  type ReturnType = {
514
- (context: RuleContext, node: _ | null | TSESTree.Node): node is TSESTree.CallExpression;
515
- (context: RuleContext): (node: _ | null | TSESTree.Node) => node is TSESTree.CallExpression;
624
+ (context: RuleContext, node: unit | null | TSESTree.Node): node is TSESTree.CallExpression;
625
+ (context: RuleContext): (node: unit | null | TSESTree.Node) => node is TSESTree.CallExpression;
516
626
  };
517
627
  }
518
628
  declare function isReactAPICall(api: string): isReactAPICall.ReturnType;
@@ -543,4 +653,4 @@ declare const isForwardRefCall: isReactAPICall.ReturnType;
543
653
  declare const isMemoCall: isReactAPICall.ReturnType;
544
654
  declare const isLazyCall: isReactAPICall.ReturnType;
545
655
 
546
- export { type ClassComponent, type Component, ComponentDetectionHint, type ComponentEffectPhaseKind, ComponentFlag, type ComponentKind, type ComponentLifecyclePhaseKind, type ComponentPhaseKind, ComponentPhaseRelevance, type ComponentStateKind, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, type EffectKind, type FunctionComponent, type Hook, type HookKind, JSXDetectionHint, type SemanticEntry, type SemanticNode, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
656
+ export { type ClassComponent, type Component, ComponentDetectionHint, type ComponentEffectPhaseKind, ComponentFlag, type ComponentKind, type ComponentLifecyclePhaseKind, type ComponentPhaseKind, ComponentPhaseRelevance, type ComponentStateKind, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, type EffectKind, type FunctionComponent, type Hook, JSXDetectionHint, REACT_BUILTIN_HOOK_NAMES, type SemanticEntry, type SemanticNode, type TypeVariant, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, getTypeVariants, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isEnumType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isStringType, isThisSetState, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
2
2
  import * as AST14 from '@eslint-react/ast';
3
- import { flip, dual, constFalse, identity, constTrue, _ } from '@eslint-react/eff';
3
+ import { flip, dual, constFalse, identity, constTrue, unit } from '@eslint-react/eff';
4
4
  import { RegExp, Selector } from '@eslint-react/kit';
5
5
  import { coerceSettings, DEFAULT_ESLINT_REACT_SETTINGS, getId } from '@eslint-react/shared';
6
6
  import * as VAR3 from '@eslint-react/var';
7
7
  import { isMatching, P, match } from 'ts-pattern';
8
8
  import birecord from 'birecord';
9
+ import { isTypeFlagSet, isFalseLiteralType, isTrueLiteralType } from 'ts-api-utils';
10
+ export { isFalseLiteralType, isTrueLiteralType } from 'ts-api-utils';
11
+ import ts from 'typescript';
9
12
 
10
13
  // src/component/component-children.ts
11
14
  function isReactAPI(api) {
@@ -70,7 +73,7 @@ function getInstanceId(node, prev) {
70
73
  case (node.type === AST_NODE_TYPES.PropertyDefinition && node.value === prev):
71
74
  return node.key;
72
75
  case (node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program || node.parent === node):
73
- return _;
76
+ return unit;
74
77
  default:
75
78
  return getInstanceId(node.parent, node);
76
79
  }
@@ -108,6 +111,27 @@ function isInstanceIdEqual(context, a, b) {
108
111
  }
109
112
 
110
113
  // src/hook/hook-name.ts
114
+ var REACT_BUILTIN_HOOK_NAMES = [
115
+ "use",
116
+ "useActionState",
117
+ "useCallback",
118
+ "useContext",
119
+ "useDebugValue",
120
+ "useDeferredValue",
121
+ "useEffect",
122
+ "useFormStatus",
123
+ "useId",
124
+ "useImperativeHandle",
125
+ "useInsertionEffect",
126
+ "useLayoutEffect",
127
+ "useMemo",
128
+ "useOptimistic",
129
+ "useReducer",
130
+ "useRef",
131
+ "useState",
132
+ "useSyncExternalStore",
133
+ "useTransition"
134
+ ];
111
135
  function isReactHookName(name) {
112
136
  return name === "use" || /^use[A-Z0-9]/.test(name);
113
137
  }
@@ -411,6 +435,9 @@ function isJsxLike(code, node, hint = DEFAULT_JSX_DETECTION_HINT) {
411
435
  return !(hint & JSXDetectionHint.SkipStringLiteral);
412
436
  }
413
437
  case AST_NODE_TYPES.ArrayExpression: {
438
+ if (node.elements.length === 0) {
439
+ return !(hint & JSXDetectionHint.SkipEmptyArray);
440
+ }
414
441
  if (hint & JSXDetectionHint.StrictArray) {
415
442
  return node.elements.every((n) => isJsxLike(code, n, hint));
416
443
  }
@@ -480,6 +507,15 @@ function getElementType(context, node) {
480
507
  return stringifyJsx(node.openingElement.name);
481
508
  }
482
509
 
510
+ // src/jsx/jsx-element-is.ts
511
+ function isHostElement(context, node) {
512
+ return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
513
+ }
514
+ function isFragmentElement(context, node) {
515
+ if (node.type !== AST_NODE_TYPES.JSXElement) return false;
516
+ return getElementType(context, node).split(".").at(-1) === "Fragment";
517
+ }
518
+
483
519
  // src/jsx/jsx-has.ts
484
520
  function hasAttribute(context, name, attributes, initialScope) {
485
521
  return getAttribute(context, name, attributes, initialScope) != null;
@@ -496,18 +532,6 @@ function findParentAttribute(node, test = constTrue) {
496
532
  };
497
533
  return AST14.findParentNode(node, guard);
498
534
  }
499
- function isHostElement(context, node) {
500
- return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
501
- }
502
- function isKeyedElement(context, node, initialScope) {
503
- return node.type === AST_NODE_TYPES.JSXElement && hasAttribute(context, "key", node.openingElement.attributes, initialScope);
504
- }
505
- function isFragmentElement(context, node, allowJSXFragment = false) {
506
- if (node == null) return false;
507
- if (node.type !== AST_NODE_TYPES.JSXElement && node.type !== AST_NODE_TYPES.JSXFragment) return false;
508
- if (node.type === AST_NODE_TYPES.JSXFragment) return allowJSXFragment;
509
- return getElementType(context, node).split(".").at(-1) === "Fragment";
510
- }
511
535
 
512
536
  // src/component/component-detection-hint.ts
513
537
  var ComponentDetectionHint = {
@@ -643,7 +667,7 @@ function getFunctionComponentId(context, node) {
643
667
  if (parent.type === AST_NODE_TYPES.CallExpression && isComponentWrapperCallLoose(context, parent) && parent.parent.type === AST_NODE_TYPES.CallExpression && isComponentWrapperCallLoose(context, parent.parent) && parent.parent.parent.type === AST_NODE_TYPES.VariableDeclarator && parent.parent.parent.id.type === AST_NODE_TYPES.Identifier) {
644
668
  return parent.parent.parent.id;
645
669
  }
646
- return _;
670
+ return unit;
647
671
  }
648
672
 
649
673
  // src/component/component-flag.ts
@@ -674,7 +698,7 @@ function isComponentNameLoose(name) {
674
698
  return RegExp.COMPONENT_NAME_LOOSE.test(name);
675
699
  }
676
700
  function getComponentNameFromId(id) {
677
- if (id == null) return _;
701
+ if (id == null) return unit;
678
702
  return Array.isArray(id) ? id.map((n) => n.name).join(".") : id.name;
679
703
  }
680
704
  function hasNoneOrLooseComponentName(context, fn) {
@@ -702,11 +726,15 @@ function useComponentCollector(context, options = {}) {
702
726
  const entry = functionEntries.at(-1);
703
727
  if (entry == null) return;
704
728
  if (!entry.isComponent) return functionEntries.pop();
705
- const shouldDrop = AST14.getNestedReturnStatements(entry.node.body).slice().reverse().some((r) => {
706
- return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !isJsxLike(context.sourceCode, r.argument, hint);
707
- });
708
- if (shouldDrop) {
709
- components.delete(entry.key);
729
+ const rets = AST14.getNestedReturnStatements(entry.node.body);
730
+ for (let i = rets.length - 1; i >= 0; i--) {
731
+ const ret = rets[i];
732
+ if (ret == null) continue;
733
+ const shouldDrop = context.sourceCode.getScope(ret).block === entry.node && ret.argument != null && !isJsxLike(context.sourceCode, ret.argument, hint);
734
+ if (shouldDrop) {
735
+ components.delete(entry.key);
736
+ break;
737
+ }
710
738
  }
711
739
  return functionEntries.pop();
712
740
  };
@@ -739,7 +767,7 @@ function useComponentCollector(context, options = {}) {
739
767
  kind: "function",
740
768
  name,
741
769
  node: entry.node,
742
- displayName: _,
770
+ displayName: unit,
743
771
  flag: getComponentFlagFromInitPath(initPath),
744
772
  hint,
745
773
  hookCalls: entry.hookCalls,
@@ -750,7 +778,7 @@ function useComponentCollector(context, options = {}) {
750
778
  [Selector.DISPLAY_NAME_ASSIGNMENT_EXPRESSION](node) {
751
779
  const { left, right } = node;
752
780
  if (left.type !== AST_NODE_TYPES.MemberExpression) return;
753
- const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : _;
781
+ const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : unit;
754
782
  const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);
755
783
  if (component == null) return;
756
784
  component.displayName = right;
@@ -779,7 +807,7 @@ function useComponentCollector(context, options = {}) {
779
807
  kind: "function",
780
808
  name,
781
809
  node: entry.node,
782
- displayName: _,
810
+ displayName: unit,
783
811
  flag: getComponentFlagFromInitPath(initPath),
784
812
  hint,
785
813
  hookCalls: entry.hookCalls,
@@ -813,7 +841,7 @@ function useComponentCollectorLegacy() {
813
841
  name: id?.name,
814
842
  node,
815
843
  // TODO: Get displayName of class component
816
- displayName: _,
844
+ displayName: unit,
817
845
  flag,
818
846
  hint: 0n,
819
847
  // TODO: Get methods of class component
@@ -933,5 +961,73 @@ function isAssignmentToThisState(node) {
933
961
  const { left } = node;
934
962
  return left.type === AST_NODE_TYPES.MemberExpression && AST14.isThisExpression(left.object) && AST14.getPropertyName(left.property) === "state";
935
963
  }
964
+ var isAnyType = (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any);
965
+ var isBigIntType = (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike);
966
+ var isBooleanType = (type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike);
967
+ var isEnumType = (type) => isTypeFlagSet(type, ts.TypeFlags.EnumLike);
968
+ var isFalsyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: "0" } }, type);
969
+ var isFalsyNumberType = (type) => type.isNumberLiteral() && type.value === 0;
970
+ var isFalsyStringType = (type) => type.isStringLiteral() && type.value === "";
971
+ var isNeverType = (type) => isTypeFlagSet(type, ts.TypeFlags.Never);
972
+ var isNullishType = (type) => isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike);
973
+ var isNumberType = (type) => isTypeFlagSet(type, ts.TypeFlags.NumberLike);
974
+ var isObjectType = (type) => !isTypeFlagSet(
975
+ type,
976
+ ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never
977
+ );
978
+ var isStringType = (type) => isTypeFlagSet(type, ts.TypeFlags.StringLike);
979
+ var isTruthyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: P.not("0") } }, type);
980
+ var isTruthyNumberType = (type) => type.isNumberLiteral() && type.value !== 0;
981
+ var isTruthyStringType = (type) => type.isStringLiteral() && type.value !== "";
982
+ var isUnknownType = (type) => isTypeFlagSet(type, ts.TypeFlags.Unknown);
983
+ function getTypeVariants(types) {
984
+ const variants = /* @__PURE__ */ new Set();
985
+ if (types.some(isUnknownType)) {
986
+ variants.add("unknown");
987
+ return variants;
988
+ }
989
+ if (types.some(isNullishType)) {
990
+ variants.add("nullish");
991
+ }
992
+ const booleans = types.filter(isBooleanType);
993
+ const boolean0 = booleans[0];
994
+ if (booleans.length === 1 && boolean0 != null) {
995
+ if (isFalseLiteralType(boolean0)) {
996
+ variants.add("falsy boolean");
997
+ } else if (isTrueLiteralType(boolean0)) {
998
+ variants.add("truthy boolean");
999
+ }
1000
+ } else if (booleans.length === 2) {
1001
+ variants.add("boolean");
1002
+ }
1003
+ const strings = types.filter(isStringType);
1004
+ if (strings.length > 0) {
1005
+ const evaluated = match(strings).when((types2) => types2.every(isTruthyStringType), () => "truthy string").when((types2) => types2.every(isFalsyStringType), () => "falsy string").otherwise(() => "string");
1006
+ variants.add(evaluated);
1007
+ }
1008
+ const bigints = types.filter(isBigIntType);
1009
+ if (bigints.length > 0) {
1010
+ const evaluated = match(bigints).when((types2) => types2.every(isTruthyBigIntType), () => "truthy bigint").when((types2) => types2.every(isFalsyBigIntType), () => "falsy bigint").otherwise(() => "bigint");
1011
+ variants.add(evaluated);
1012
+ }
1013
+ const numbers = types.filter(isNumberType);
1014
+ if (numbers.length > 0) {
1015
+ const evaluated = match(numbers).when((types2) => types2.every(isTruthyNumberType), () => "truthy number").when((types2) => types2.every(isFalsyNumberType), () => "falsy number").otherwise(() => "number");
1016
+ variants.add(evaluated);
1017
+ }
1018
+ if (types.some(isEnumType)) {
1019
+ variants.add("enum");
1020
+ }
1021
+ if (types.some(isObjectType)) {
1022
+ variants.add("object");
1023
+ }
1024
+ if (types.some(isAnyType)) {
1025
+ variants.add("any");
1026
+ }
1027
+ if (types.some(isNeverType)) {
1028
+ variants.add("never");
1029
+ }
1030
+ return variants;
1031
+ }
936
1032
 
937
- export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
1033
+ export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, REACT_BUILTIN_HOOK_NAMES, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, getTypeVariants, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAnyType, isAssignmentToThisState, isBigIntType, isBooleanType, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isEnumType, isFalsyBigIntType, isFalsyNumberType, isFalsyStringType, isForwardRef, isForwardRefCall, isFragmentElement, isFunctionOfRender, isFunctionOfRenderMethod, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isNeverType, isNullishType, isNumberType, isObjectType, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookId, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isStringType, isThisSetState, isTruthyBigIntType, isTruthyNumberType, isTruthyStringType, isUnknownType, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.131",
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": {
@@ -27,24 +27,24 @@
27
27
  "./package.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@typescript-eslint/scope-manager": "^8.31.1",
31
- "@typescript-eslint/type-utils": "^8.31.1",
32
- "@typescript-eslint/types": "^8.31.1",
33
- "@typescript-eslint/utils": "^8.31.1",
30
+ "@typescript-eslint/scope-manager": "^8.39.1",
31
+ "@typescript-eslint/type-utils": "^8.39.1",
32
+ "@typescript-eslint/types": "^8.39.1",
33
+ "@typescript-eslint/utils": "^8.39.1",
34
34
  "birecord": "^0.1.1",
35
- "ts-pattern": "^5.7.0",
36
- "@eslint-react/ast": "2.0.0-next.13",
37
- "@eslint-react/shared": "2.0.0-next.13",
38
- "@eslint-react/var": "2.0.0-next.13",
39
- "@eslint-react/eff": "2.0.0-next.13",
40
- "@eslint-react/kit": "2.0.0-next.13"
35
+ "ts-api-utils": "^2.1.0",
36
+ "ts-pattern": "^5.8.0",
37
+ "@eslint-react/ast": "2.0.0-next.131",
38
+ "@eslint-react/eff": "2.0.0-next.131",
39
+ "@eslint-react/shared": "2.0.0-next.131",
40
+ "@eslint-react/var": "2.0.0-next.131",
41
+ "@eslint-react/kit": "2.0.0-next.131"
41
42
  },
42
43
  "devDependencies": {
43
- "tsup": "^8.4.0",
44
+ "tsup": "^8.5.0",
44
45
  "@local/configs": "0.0.0"
45
46
  },
46
47
  "engines": {
47
- "bun": ">=1.0.15",
48
48
  "node": ">=20.19.0"
49
49
  },
50
50
  "scripts": {