@eslint-react/ast 1.30.1-next.1 → 1.30.2-next.0
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/LICENSE +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -49
- package/dist/index.mjs +14 -49
- package/package.json +2 -2
package/LICENSE
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -140,9 +140,9 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
|
|
|
140
140
|
declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @param node The
|
|
145
|
-
* @returns The
|
|
143
|
+
* Recursively get the inner expression until it's not a TSOnlyExpression
|
|
144
|
+
* @param node - The node to get the expression from
|
|
145
|
+
* @returns The inner expression
|
|
146
146
|
*/
|
|
147
147
|
declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
|
|
148
148
|
|
package/dist/index.d.ts
CHANGED
|
@@ -140,9 +140,9 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
|
|
|
140
140
|
declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @param node The
|
|
145
|
-
* @returns The
|
|
143
|
+
* Recursively get the inner expression until it's not a TSOnlyExpression
|
|
144
|
+
* @param node - The node to get the expression from
|
|
145
|
+
* @returns The inner expression
|
|
146
146
|
*/
|
|
147
147
|
declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
|
|
148
148
|
|
package/dist/index.js
CHANGED
|
@@ -19,58 +19,23 @@ function findParentNode(node, test) {
|
|
|
19
19
|
return eff._;
|
|
20
20
|
}
|
|
21
21
|
function getFunctionInitPath(node) {
|
|
22
|
-
const { parent } = node;
|
|
23
22
|
if (node.type === types.AST_NODE_TYPES.FunctionDeclaration) {
|
|
24
23
|
return [node];
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
parent,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
parent.parent.parent,
|
|
36
|
-
|
|
37
|
-
parent,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
if (parent.type === types.AST_NODE_TYPES.CallExpression && parent.parent.type === types.AST_NODE_TYPES.CallExpression && parent.parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator) {
|
|
42
|
-
return [
|
|
43
|
-
parent.parent.parent.parent,
|
|
44
|
-
parent.parent.parent,
|
|
45
|
-
parent.parent,
|
|
46
|
-
parent,
|
|
47
|
-
node
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
if (parent.type === types.AST_NODE_TYPES.Property && parent.parent.type === types.AST_NODE_TYPES.ObjectExpression && parent.parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator) {
|
|
51
|
-
return [
|
|
52
|
-
parent.parent.parent.parent,
|
|
53
|
-
parent.parent.parent,
|
|
54
|
-
parent.parent,
|
|
55
|
-
parent,
|
|
56
|
-
node
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
if (parent.type === types.AST_NODE_TYPES.MethodDefinition && parent.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration) {
|
|
60
|
-
return [
|
|
61
|
-
parent.parent.parent,
|
|
62
|
-
parent.parent,
|
|
63
|
-
parent,
|
|
64
|
-
node
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
if (parent.type === types.AST_NODE_TYPES.PropertyDefinition && parent.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration) {
|
|
68
|
-
return [
|
|
69
|
-
parent.parent.parent,
|
|
70
|
-
parent.parent,
|
|
71
|
-
parent,
|
|
72
|
-
node
|
|
73
|
-
];
|
|
25
|
+
const { parent } = node;
|
|
26
|
+
switch (true) {
|
|
27
|
+
case parent.type === types.AST_NODE_TYPES.VariableDeclarator:
|
|
28
|
+
return [parent.parent, parent, node];
|
|
29
|
+
case (parent.type === types.AST_NODE_TYPES.CallExpression && parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator):
|
|
30
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
31
|
+
case (parent.type === types.AST_NODE_TYPES.CallExpression && parent.parent.type === types.AST_NODE_TYPES.CallExpression && parent.parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator):
|
|
32
|
+
return [parent.parent.parent.parent, parent.parent.parent, parent.parent, parent, node];
|
|
33
|
+
case (parent.type === types.AST_NODE_TYPES.Property && parent.parent.type === types.AST_NODE_TYPES.ObjectExpression && parent.parent.parent.type === types.AST_NODE_TYPES.VariableDeclarator):
|
|
34
|
+
return [parent.parent.parent.parent, parent.parent.parent, parent.parent, parent, node];
|
|
35
|
+
case (parent.type === types.AST_NODE_TYPES.MethodDefinition && parent.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration):
|
|
36
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
37
|
+
case (parent.type === types.AST_NODE_TYPES.PropertyDefinition && parent.parent.parent.type === types.AST_NODE_TYPES.ClassDeclaration):
|
|
38
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
74
39
|
}
|
|
75
40
|
return eff._;
|
|
76
41
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -17,58 +17,23 @@ function findParentNode(node, test) {
|
|
|
17
17
|
return _;
|
|
18
18
|
}
|
|
19
19
|
function getFunctionInitPath(node) {
|
|
20
|
-
const { parent } = node;
|
|
21
20
|
if (node.type === AST_NODE_TYPES.FunctionDeclaration) {
|
|
22
21
|
return [node];
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
parent,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
parent.parent.parent,
|
|
34
|
-
|
|
35
|
-
parent,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
if (parent.type === AST_NODE_TYPES.CallExpression && parent.parent.type === AST_NODE_TYPES.CallExpression && parent.parent.parent.type === AST_NODE_TYPES.VariableDeclarator) {
|
|
40
|
-
return [
|
|
41
|
-
parent.parent.parent.parent,
|
|
42
|
-
parent.parent.parent,
|
|
43
|
-
parent.parent,
|
|
44
|
-
parent,
|
|
45
|
-
node
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
if (parent.type === AST_NODE_TYPES.Property && parent.parent.type === AST_NODE_TYPES.ObjectExpression && parent.parent.parent.type === AST_NODE_TYPES.VariableDeclarator) {
|
|
49
|
-
return [
|
|
50
|
-
parent.parent.parent.parent,
|
|
51
|
-
parent.parent.parent,
|
|
52
|
-
parent.parent,
|
|
53
|
-
parent,
|
|
54
|
-
node
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
if (parent.type === AST_NODE_TYPES.MethodDefinition && parent.parent.parent.type === AST_NODE_TYPES.ClassDeclaration) {
|
|
58
|
-
return [
|
|
59
|
-
parent.parent.parent,
|
|
60
|
-
parent.parent,
|
|
61
|
-
parent,
|
|
62
|
-
node
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
if (parent.type === AST_NODE_TYPES.PropertyDefinition && parent.parent.parent.type === AST_NODE_TYPES.ClassDeclaration) {
|
|
66
|
-
return [
|
|
67
|
-
parent.parent.parent,
|
|
68
|
-
parent.parent,
|
|
69
|
-
parent,
|
|
70
|
-
node
|
|
71
|
-
];
|
|
23
|
+
const { parent } = node;
|
|
24
|
+
switch (true) {
|
|
25
|
+
case parent.type === AST_NODE_TYPES.VariableDeclarator:
|
|
26
|
+
return [parent.parent, parent, node];
|
|
27
|
+
case (parent.type === AST_NODE_TYPES.CallExpression && parent.parent.type === AST_NODE_TYPES.VariableDeclarator):
|
|
28
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
29
|
+
case (parent.type === AST_NODE_TYPES.CallExpression && parent.parent.type === AST_NODE_TYPES.CallExpression && parent.parent.parent.type === AST_NODE_TYPES.VariableDeclarator):
|
|
30
|
+
return [parent.parent.parent.parent, parent.parent.parent, parent.parent, parent, node];
|
|
31
|
+
case (parent.type === AST_NODE_TYPES.Property && parent.parent.type === AST_NODE_TYPES.ObjectExpression && parent.parent.parent.type === AST_NODE_TYPES.VariableDeclarator):
|
|
32
|
+
return [parent.parent.parent.parent, parent.parent.parent, parent.parent, parent, node];
|
|
33
|
+
case (parent.type === AST_NODE_TYPES.MethodDefinition && parent.parent.parent.type === AST_NODE_TYPES.ClassDeclaration):
|
|
34
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
35
|
+
case (parent.type === AST_NODE_TYPES.PropertyDefinition && parent.parent.parent.type === AST_NODE_TYPES.ClassDeclaration):
|
|
36
|
+
return [parent.parent.parent, parent.parent, parent, node];
|
|
72
37
|
}
|
|
73
38
|
return _;
|
|
74
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.2-next.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@typescript-eslint/utils": "^8.26.0",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
42
|
"ts-pattern": "^5.6.2",
|
|
43
|
-
"@eslint-react/eff": "1.30.
|
|
43
|
+
"@eslint-react/eff": "1.30.2-next.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.4.0",
|