@eslint-react/core 5.2.0-next.0 → 5.2.1-beta.1
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 +45 -46
- package/dist/index.js +3 -4
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as ast from "@eslint-react/ast";
|
|
2
2
|
import { TSESTree } from "@typescript-eslint/types";
|
|
3
|
-
import { SemanticNode as SemanticNode$1 } from "@eslint-react/core";
|
|
4
3
|
import { RuleContext } from "@eslint-react/eslint";
|
|
5
4
|
import { RegExpLike } from "@eslint-react/shared";
|
|
6
5
|
import { ESLintUtils, TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
|
|
@@ -113,11 +112,55 @@ declare const isUseStateCall: isAPICall.ReturnType;
|
|
|
113
112
|
declare const isUseSyncExternalStoreCall: isAPICall.ReturnType;
|
|
114
113
|
declare const isUseTransitionCall: isAPICall.ReturnType;
|
|
115
114
|
//#endregion
|
|
115
|
+
//#region src/semantic.d.ts
|
|
116
|
+
/**
|
|
117
|
+
* Represents a semantic node in the AST
|
|
118
|
+
* This is the base interface for all semantic nodes in the React semantic analysis
|
|
119
|
+
*/
|
|
120
|
+
interface SemanticNode {
|
|
121
|
+
/** The identifier of the node */
|
|
122
|
+
id: null | TSESTree.Node;
|
|
123
|
+
/** The unique key of the node */
|
|
124
|
+
key: string;
|
|
125
|
+
/** The kind of the node */
|
|
126
|
+
kind: string;
|
|
127
|
+
/** The name of the node */
|
|
128
|
+
name: null | string;
|
|
129
|
+
/** The flag of the node */
|
|
130
|
+
flag: bigint;
|
|
131
|
+
/** The hint of the node */
|
|
132
|
+
hint: bigint;
|
|
133
|
+
/** The AST node */
|
|
134
|
+
node: TSESTree.Node;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Represents a semantic function node in the AST
|
|
138
|
+
* This interface extends SemanticNode and provides additional properties for function analysis
|
|
139
|
+
*/
|
|
140
|
+
interface SemanticFunc extends SemanticNode {
|
|
141
|
+
/** The identifier of the function */
|
|
142
|
+
id: ast.FunctionID;
|
|
143
|
+
/** The AST node of the function */
|
|
144
|
+
node: ast.TSESTreeFunction;
|
|
145
|
+
/** The name of the function */
|
|
146
|
+
name: string | null;
|
|
147
|
+
/** The return type annotation of the function */
|
|
148
|
+
type: TSESTree.TSTypeAnnotation | null;
|
|
149
|
+
/** The body of the function */
|
|
150
|
+
body: TSESTree.BlockStatement | TSESTree.Expression;
|
|
151
|
+
/** The directives of the function (ex: "use strict", "use client", "use server", etc.) */
|
|
152
|
+
directives: ast.TSESTreeDirective[];
|
|
153
|
+
/** The parameters of the function */
|
|
154
|
+
parameters: TSESTree.Parameter[];
|
|
155
|
+
/** The type parameters of the function */
|
|
156
|
+
typeParameters: TSESTree.TSTypeParameterDeclaration | null;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
116
159
|
//#region src/class-component.d.ts
|
|
117
160
|
/**
|
|
118
161
|
* @deprecated Class components are legacy. This type exists only to support legacy rules.
|
|
119
162
|
*/
|
|
120
|
-
interface ClassComponentSemanticNode extends SemanticNode
|
|
163
|
+
interface ClassComponentSemanticNode extends SemanticNode {
|
|
121
164
|
id: null | TSESTree.BindingName;
|
|
122
165
|
kind: "class-component";
|
|
123
166
|
displayName: null | TSESTree.Expression;
|
|
@@ -214,50 +257,6 @@ declare namespace getClassComponentCollector {
|
|
|
214
257
|
*/
|
|
215
258
|
declare function getClassComponentCollector(context: RuleContext): getClassComponentCollector.ReturnType;
|
|
216
259
|
//#endregion
|
|
217
|
-
//#region src/semantic.d.ts
|
|
218
|
-
/**
|
|
219
|
-
* Represents a semantic node in the AST
|
|
220
|
-
* This is the base interface for all semantic nodes in the React semantic analysis
|
|
221
|
-
*/
|
|
222
|
-
interface SemanticNode {
|
|
223
|
-
/** The identifier of the node */
|
|
224
|
-
id: null | TSESTree.Node;
|
|
225
|
-
/** The unique key of the node */
|
|
226
|
-
key: string;
|
|
227
|
-
/** The kind of the node */
|
|
228
|
-
kind: string;
|
|
229
|
-
/** The name of the node */
|
|
230
|
-
name: null | string;
|
|
231
|
-
/** The flag of the node */
|
|
232
|
-
flag: bigint;
|
|
233
|
-
/** The hint of the node */
|
|
234
|
-
hint: bigint;
|
|
235
|
-
/** The AST node */
|
|
236
|
-
node: TSESTree.Node;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Represents a semantic function node in the AST
|
|
240
|
-
* This interface extends SemanticNode and provides additional properties for function analysis
|
|
241
|
-
*/
|
|
242
|
-
interface SemanticFunc extends SemanticNode {
|
|
243
|
-
/** The identifier of the function */
|
|
244
|
-
id: ast.FunctionID;
|
|
245
|
-
/** The AST node of the function */
|
|
246
|
-
node: ast.TSESTreeFunction;
|
|
247
|
-
/** The name of the function */
|
|
248
|
-
name: string | null;
|
|
249
|
-
/** The return type annotation of the function */
|
|
250
|
-
type: TSESTree.TSTypeAnnotation | null;
|
|
251
|
-
/** The body of the function */
|
|
252
|
-
body: TSESTree.BlockStatement | TSESTree.Expression;
|
|
253
|
-
/** The directives of the function (ex: "use strict", "use client", "use server", etc.) */
|
|
254
|
-
directives: ast.TSESTreeDirective[];
|
|
255
|
-
/** The parameters of the function */
|
|
256
|
-
parameters: TSESTree.Parameter[];
|
|
257
|
-
/** The type parameters of the function */
|
|
258
|
-
typeParameters: TSESTree.TSTypeParameterDeclaration | null;
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
260
|
//#region src/function.d.ts
|
|
262
261
|
/**
|
|
263
262
|
* Represents the kind of a React function
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as ast from "@eslint-react/ast";
|
|
2
2
|
import { resolveImportSource } from "@eslint-react/var";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
4
|
-
import { isAPIFromReact as isAPIFromReact$1 } from "@eslint-react/core";
|
|
5
4
|
import "@eslint-react/eslint";
|
|
6
5
|
import { ulid } from "ulid";
|
|
7
6
|
import { JsxDetectionHint, isJsxLike } from "@eslint-react/jsx";
|
|
@@ -10,7 +9,7 @@ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/utils";
|
|
|
10
9
|
import { P, isMatching, match } from "ts-pattern";
|
|
11
10
|
import ts from "typescript";
|
|
12
11
|
|
|
13
|
-
//#region
|
|
12
|
+
//#region ../../.pkgs/eff/dist/index.js
|
|
14
13
|
/**
|
|
15
14
|
* Creates a function that can be used in a data-last (aka `pipe`able) or
|
|
16
15
|
* data-first style.
|
|
@@ -264,11 +263,11 @@ function isClassComponent(node, context) {
|
|
|
264
263
|
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
265
264
|
if (!re.test(node.superClass.name)) return false;
|
|
266
265
|
if (context == null) return true;
|
|
267
|
-
return isAPIFromReact
|
|
266
|
+
return isAPIFromReact(node.superClass.name, context.sourceCode.getScope(node), "react");
|
|
268
267
|
case node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier:
|
|
269
268
|
if (!re.test(node.superClass.property.name)) return false;
|
|
270
269
|
if (context == null) return true;
|
|
271
|
-
if (node.superClass.object.type === AST_NODE_TYPES.Identifier) return isAPIFromReact
|
|
270
|
+
if (node.superClass.object.type === AST_NODE_TYPES.Identifier) return isAPIFromReact(node.superClass.object.name, context.sourceCode.getScope(node), "react");
|
|
272
271
|
return true;
|
|
273
272
|
}
|
|
274
273
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1-beta.1",
|
|
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": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/Rel1cx/eslint-react.git",
|
|
12
|
-
"directory": "packages
|
|
12
|
+
"directory": "packages/core"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Rel1cx",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.58.1",
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
37
|
"ulid": "^3.0.2",
|
|
38
|
-
"@eslint-react/ast": "5.2.
|
|
39
|
-
"@eslint-react/jsx": "5.2.
|
|
40
|
-
"@eslint-react/shared": "5.2.
|
|
41
|
-
"@eslint-react/
|
|
42
|
-
"@eslint-react/
|
|
38
|
+
"@eslint-react/ast": "5.2.1-beta.1",
|
|
39
|
+
"@eslint-react/jsx": "5.2.1-beta.1",
|
|
40
|
+
"@eslint-react/shared": "5.2.1-beta.1",
|
|
41
|
+
"@eslint-react/var": "5.2.1-beta.1",
|
|
42
|
+
"@eslint-react/eslint": "5.2.1-beta.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@typescript-eslint/typescript-estree": "^8.58.1",
|
|
46
46
|
"tsdown": "^0.21.7",
|
|
47
|
-
"@local/
|
|
48
|
-
"@local/
|
|
47
|
+
"@local/configs": "0.0.0",
|
|
48
|
+
"@local/eff": "3.0.0-beta.72"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"eslint": "^10.2.0",
|