@eslint-react/core 2.8.2-next.1 → 2.8.2-next.3

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.ts CHANGED
@@ -127,25 +127,48 @@ declare const ComponentDetectionHint: {
127
127
  declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
128
128
  //#endregion
129
129
  //#region src/semantic/semantic-node.d.ts
130
+ /**
131
+ * Represents a semantic node in the AST
132
+ * This is the base interface for all semantic nodes in the React semantic analysis
133
+ */
130
134
  interface SemanticNode {
135
+ /** The identifier of the node */
131
136
  id: unit | TSESTree.Node;
137
+ /** The unique key of the node */
132
138
  key: string;
139
+ /** The kind of the node */
133
140
  kind: string;
141
+ /** The name of the node */
134
142
  name: unit | string;
143
+ /** The AST node */
135
144
  node: TSESTree.Node;
145
+ /** The flag of the node */
136
146
  flag: bigint;
147
+ /** The hint of the node */
137
148
  hint: bigint;
138
149
  }
139
150
  //#endregion
140
151
  //#region src/semantic/semantic-func.d.ts
152
+ /**
153
+ * Represents a semantic function node in the AST
154
+ * This interface extends SemanticNode and provides additional properties for function analysis
155
+ */
141
156
  interface SemanticFunc extends SemanticNode {
157
+ /** The identifier of the function */
142
158
  id: ast.FunctionID | unit;
159
+ /** The AST node of the function */
143
160
  node: ast.TSESTreeFunction;
161
+ /** The name of the function */
144
162
  name: string | unit;
163
+ /** The return type annotation of the function */
145
164
  type: TSESTree.TSTypeAnnotation | unit;
165
+ /** The body of the function */
146
166
  body: TSESTree.BlockStatement | TSESTree.Expression;
167
+ /** The directives of the function (e.g., "use strict", "use client", "use server", etc.) */
147
168
  directives: TSESTree.StringLiteral[];
169
+ /** The parameters of the function */
148
170
  parameters: TSESTree.Parameter[];
171
+ /** The type parameters of the function */
149
172
  typeParameters: TSESTree.TSTypeParameterDeclaration | unit;
150
173
  }
151
174
  //#endregion
@@ -538,7 +561,7 @@ type FindEnclosingComponentOrHookFilter = (n: TSESTree.Node, name: string | null
538
561
  * @param test Optional test function to customize component or hook identification
539
562
  * @returns The enclosing component or hook node, or `null` if none is ASAST.
540
563
  */
541
- declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | undefined;
564
+ declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | undefined;
542
565
  //#endregion
543
566
  //#region src/hierarchy/is-inside-component-or-hook.d.ts
544
567
  /**
@@ -561,14 +584,20 @@ declare function isUseEffectSetupCallback(node: TSESTree.Node | unit): boolean;
561
584
  declare function isUseEffectCleanupCallback(node: TSESTree.Node | unit): boolean;
562
585
  //#endregion
563
586
  //#region src/hook/hook-semantic-node.d.ts
587
+ /**
588
+ * Represents a semantic hook node in the AST
589
+ * This interface extends SemanticNode and provides additional properties for React hook analysis
590
+ */
564
591
  interface HookSemanticNode extends SemanticNode {
592
+ /** The identifier of the hook */
565
593
  id: ast.FunctionID | unit;
594
+ /** The AST node of the hook */
566
595
  node: ast.TSESTreeFunction;
596
+ /** The name of the hook */
567
597
  name: string;
598
+ /** The other hooks called by the hook */
568
599
  hookCalls: TSESTree.CallExpression[];
569
- /**
570
- * The directives used in the function (e.g., "use strict", "use client", etc.)
571
- */
600
+ /** The directives used in the function (e.g., "use strict", "use client", etc.) */
572
601
  directives: TSESTree.StringLiteral[];
573
602
  }
574
603
  //#endregion
@@ -595,6 +624,11 @@ declare namespace useHookCollector {
595
624
  declare function useHookCollector(context: RuleContext): useHookCollector.ReturnType;
596
625
  //#endregion
597
626
  //#region src/hook/hook-id.d.ts
627
+ /**
628
+ * Checks if the given node is a hook identifier
629
+ * @param id The AST node to check
630
+ * @returns `true` if the node is a hook identifier or member expression with hook name, `false` otherwise
631
+ */
598
632
  declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
599
633
  //#endregion
600
634
  //#region src/hook/hook-is.d.ts
@@ -725,7 +759,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: ast.T
725
759
  readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
726
760
  } | {
727
761
  readonly kind: "expression";
728
- readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
762
+ readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
729
763
  readonly toStatic: () => unknown;
730
764
  } | {
731
765
  readonly kind: "element";
@@ -733,7 +767,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: ast.T
733
767
  readonly toStatic: () => undefined;
734
768
  } | {
735
769
  readonly kind: "spreadChild";
736
- readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
770
+ readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
737
771
  readonly toStatic: () => undefined;
738
772
  } | {
739
773
  readonly kind: "spreadProps";
package/dist/index.js CHANGED
@@ -245,6 +245,11 @@ function isUseEffectCleanupCallback(node) {
245
245
 
246
246
  //#endregion
247
247
  //#region src/hook/hook-id.ts
248
+ /**
249
+ * Checks if the given node is a hook identifier
250
+ * @param id The AST node to check
251
+ * @returns `true` if the node is a hook identifier or member expression with hook name, `false` otherwise
252
+ */
248
253
  function isHookId(id) {
249
254
  switch (id.type) {
250
255
  case AST_NODE_TYPES.Identifier: return isHookName(id.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.8.2-next.1",
3
+ "version": "2.8.2-next.3",
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": {
@@ -34,10 +34,10 @@
34
34
  "@typescript-eslint/types": "^8.54.0",
35
35
  "@typescript-eslint/utils": "^8.54.0",
36
36
  "ts-pattern": "^5.9.0",
37
- "@eslint-react/ast": "2.8.2-next.1",
38
- "@eslint-react/eff": "2.8.2-next.1",
39
- "@eslint-react/shared": "2.8.2-next.1",
40
- "@eslint-react/var": "2.8.2-next.1"
37
+ "@eslint-react/ast": "2.8.2-next.3",
38
+ "@eslint-react/eff": "2.8.2-next.3",
39
+ "@eslint-react/shared": "2.8.2-next.3",
40
+ "@eslint-react/var": "2.8.2-next.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsdown": "^0.20.1",