@eslint-react/core 2.8.2-beta.0 → 2.8.2-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
@@ -174,7 +197,7 @@ interface FunctionComponentSemanticNode extends SemanticNode {
174
197
  /**
175
198
  * The kind of component
176
199
  */
177
- kind: "function";
200
+ kind: "function-component";
178
201
  /**
179
202
  * The AST node of the function
180
203
  */
@@ -227,7 +250,7 @@ interface ClassComponentSemanticNode extends SemanticNode {
227
250
  /**
228
251
  * The kind of component
229
252
  */
230
- kind: "class";
253
+ kind: "class-component";
231
254
  /**
232
255
  * The AST node of the class
233
256
  */
@@ -350,12 +373,6 @@ declare function isClassComponent(node: TSESTree.Node): node is ast.TSESTreeClas
350
373
  */
351
374
  declare function isPureComponent(node: TSESTree.Node): boolean;
352
375
  //#endregion
353
- //#region src/component/component-kind.d.ts
354
- /**
355
- * Represents the kind of a React component
356
- */
357
- type ComponentKind = "classComponent" | "functionComponent";
358
- //#endregion
359
376
  //#region src/component/component-method-callback.d.ts
360
377
  /**
361
378
  * Check if the given node is a componentDidMount callback
@@ -506,6 +523,12 @@ declare function isComponentWrapperCallback(context: RuleContext, node: TSESTree
506
523
  */
507
524
  declare function isComponentWrapperCallbackLoose(context: RuleContext, node: TSESTree.Node): boolean;
508
525
  //#endregion
526
+ //#region src/function/function-kind.d.ts
527
+ /**
528
+ * Represents the kind of a React function
529
+ */
530
+ type ComponentKind = "client-function" | "server-function";
531
+ //#endregion
509
532
  //#region src/function/function-semantic-node.d.ts
510
533
  /**
511
534
  * Represents a React Client Function
@@ -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
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);
@@ -954,7 +959,7 @@ function useComponentCollector(context, options = {}) {
954
959
  const entry = {
955
960
  id: getFunctionComponentId(context, node),
956
961
  key,
957
- kind: "function",
962
+ kind: "function-component",
958
963
  name,
959
964
  node,
960
965
  directives,
@@ -1050,7 +1055,7 @@ function useComponentCollectorLegacy(context) {
1050
1055
  components.set(key, {
1051
1056
  id,
1052
1057
  key,
1053
- kind: "class",
1058
+ kind: "class-component",
1054
1059
  name,
1055
1060
  node,
1056
1061
  displayName: unit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.8.2-beta.0",
3
+ "version": "2.8.2-beta.4",
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-beta.0",
38
- "@eslint-react/shared": "2.8.2-beta.0",
39
- "@eslint-react/var": "2.8.2-beta.0",
40
- "@eslint-react/eff": "2.8.2-beta.0"
37
+ "@eslint-react/ast": "2.8.2-beta.4",
38
+ "@eslint-react/shared": "2.8.2-beta.4",
39
+ "@eslint-react/eff": "2.8.2-beta.4",
40
+ "@eslint-react/var": "2.8.2-beta.4"
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsdown": "^0.20.1",