@eslint-react/core 2.8.2-beta.1 → 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 +37 -3
- package/dist/index.js +5 -0
- package/package.json +5 -5
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
|
|
@@ -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);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.8.2-beta.
|
|
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.
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/var": "2.8.2-beta.
|
|
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",
|