@eslint-react/ast 2.0.0-next.12 → 2.0.0-next.120
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 +11 -18
- package/dist/index.js +14 -84
- package/package.json +7 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
2
2
|
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { unit } from '@eslint-react/eff';
|
|
4
4
|
|
|
5
5
|
declare function isArrayFromCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
|
|
6
6
|
declare function isArrayMapCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
|
|
@@ -20,7 +20,7 @@ type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TS
|
|
|
20
20
|
type TSESTreeTypeExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
|
|
21
21
|
type TSESTreeTypeAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
22
22
|
|
|
23
|
-
declare function getClassId(node: TSESTreeClass): TSESTree.Identifier |
|
|
23
|
+
declare function getClassId(node: TSESTreeClass): TSESTree.Identifier | unit;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Recursively get the inner expression until it's not a TypeExpression
|
|
@@ -37,7 +37,7 @@ declare function isThisExpression(node: TSESTree.Expression): boolean;
|
|
|
37
37
|
* where JS gives anonymous function expressions names. We roughly detect the
|
|
38
38
|
* same AST nodes with some exceptions to better fit our use case.
|
|
39
39
|
*/
|
|
40
|
-
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier |
|
|
40
|
+
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier | unit;
|
|
41
41
|
|
|
42
42
|
type FunctionInitPath =
|
|
43
43
|
/**
|
|
@@ -137,7 +137,7 @@ readonly [TSESTree.FunctionDeclaration]
|
|
|
137
137
|
TSESTree.PropertyDefinition,
|
|
138
138
|
TSESTreeFunction
|
|
139
139
|
];
|
|
140
|
-
declare function getFunctionInitPath(node: TSESTreeFunction):
|
|
140
|
+
declare function getFunctionInitPath(node: TSESTreeFunction): unit | FunctionInitPath;
|
|
141
141
|
declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionInitPath): boolean;
|
|
142
142
|
|
|
143
143
|
declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
@@ -149,14 +149,14 @@ declare function isImmediatelyInvokedFunction(node: TSESTreeFunction): boolean;
|
|
|
149
149
|
* @param test The test function
|
|
150
150
|
* @returns The parent node that satisfies the test function or `_` if not found
|
|
151
151
|
*/
|
|
152
|
-
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node |
|
|
152
|
+
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | unit, test: (n: TSESTree.Node) => n is A): A | unit;
|
|
153
153
|
/**
|
|
154
154
|
* Find the parent node that satisfies the test function or `_` if not found
|
|
155
155
|
* @param node The AST node
|
|
156
156
|
* @param test The test function
|
|
157
157
|
* @returns The parent node that satisfies the test function
|
|
158
158
|
*/
|
|
159
|
-
declare function findParentNode(node: TSESTree.Node |
|
|
159
|
+
declare function findParentNode(node: TSESTree.Node | unit, test: (node: TSESTree.Node) => boolean): TSESTree.Node | unit;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Get all nested identifiers in a expression like node
|
|
@@ -243,19 +243,12 @@ declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TS
|
|
|
243
243
|
declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignatureComputedName | TSESTree.TSMethodSignatureNonComputedName;
|
|
244
244
|
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
245
245
|
declare const isMethodOrProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
246
|
-
declare const isLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
|
|
247
|
-
declare const isControlFlow: (data: TSESTree.Node | null | undefined) => data is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.SwitchStatement | TSESTree.WhileStatement;
|
|
248
|
-
declare const isConditional: (data: TSESTree.Node | null | undefined) => data is TSESTree.ConditionalExpression | TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.LogicalExpression | TSESTree.SwitchStatement | TSESTree.WhileStatement;
|
|
249
|
-
declare const isArrayTupleType: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSArrayType | TSESTree.TSTupleType;
|
|
250
246
|
declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignatureComputedName | TSESTree.TSPropertySignatureNonComputedName;
|
|
251
247
|
declare const isJSXElement: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement;
|
|
252
248
|
declare const isJSXFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
|
|
253
249
|
declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName;
|
|
254
250
|
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXAttribute | TSESTree.JSXClosingElement | TSESTree.JSXClosingFragment | TSESTree.JSXElement | TSESTree.JSXEmptyExpression | TSESTree.JSXExpressionContainer | TSESTree.JSXFragment | TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment | TSESTree.JSXSpreadAttribute | TSESTree.JSXSpreadChild | TSESTree.JSXText;
|
|
255
|
-
declare const
|
|
256
|
-
declare const isTypeDeclaration: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeAliasDeclaration;
|
|
257
|
-
declare const isLeftHandSideExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.CallExpression | TSESTree.ClassExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression;
|
|
258
|
-
declare const isLeftHandSideExpressionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.CallExpression | TSESTree.ClassExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSTypeAssertion;
|
|
251
|
+
declare const isLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
|
|
259
252
|
declare const isTypeExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
260
253
|
declare const isTypeAssertionExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
261
254
|
|
|
@@ -264,7 +257,7 @@ declare const isTypeAssertionExpression: (node: TSESTree.Node | null | undefined
|
|
|
264
257
|
* @param node The AST node
|
|
265
258
|
* @returns True if the node is a member expression that accesses `process.env.NODE_ENV`, false otherwise
|
|
266
259
|
*/
|
|
267
|
-
declare function isProcessEnvNodeEnv(node: TSESTree.Node | null |
|
|
260
|
+
declare function isProcessEnvNodeEnv(node: TSESTree.Node | null | unit): node is TSESTree.MemberExpression;
|
|
268
261
|
/**
|
|
269
262
|
* Check if the given node is a binary expression that compares `process.env.NODE_ENV` with a string literal
|
|
270
263
|
* @param node The AST node
|
|
@@ -272,10 +265,10 @@ declare function isProcessEnvNodeEnv(node: TSESTree.Node | null | _): node is TS
|
|
|
272
265
|
* @param value The string literal value to compare against
|
|
273
266
|
* @returns True if the node is a binary expression that compares `process.env.NODE_ENV` with the specified value, false otherwise
|
|
274
267
|
*/
|
|
275
|
-
declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null |
|
|
268
|
+
declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null | unit, operator: "===" | "!==", value: "development" | "production"): node is TSESTree.BinaryExpression;
|
|
276
269
|
|
|
277
|
-
declare function getPropertyName(node: TSESTree.Node): string |
|
|
270
|
+
declare function getPropertyName(node: TSESTree.Node): string | unit;
|
|
278
271
|
|
|
279
272
|
declare function isThenCall(node: TSESTree.CallExpression): boolean;
|
|
280
273
|
|
|
281
|
-
export { type FunctionInitPath, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall,
|
|
274
|
+
export { type FunctionInitPath, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isClass, isEmptyFunction, isFunction, isFunctionType, isImmediatelyInvokedFunction, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThenCall, isThisExpression, isTypeAssertionExpression, isTypeExpression, toDelimiterFormat, toStringFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
2
|
-
import {
|
|
2
|
+
import { dual, unit } from '@eslint-react/eff';
|
|
3
3
|
import { ASTUtils } from '@typescript-eslint/utils';
|
|
4
4
|
import { simpleTraverse } from '@typescript-eslint/typescript-estree';
|
|
5
5
|
import { toLowerCase, delimiterCase, replace } from 'string-ts';
|
|
@@ -43,7 +43,7 @@ function getClassId(node) {
|
|
|
43
43
|
if (node.parent.type === AST_NODE_TYPES.VariableDeclarator && node.parent.id.type === AST_NODE_TYPES.Identifier) {
|
|
44
44
|
return node.parent.id;
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return unit;
|
|
47
47
|
}
|
|
48
48
|
var is = ASTUtils.isNodeOfType;
|
|
49
49
|
var isOneOf = ASTUtils.isNodeOfTypes;
|
|
@@ -68,28 +68,6 @@ var isMethodOrProperty = isOneOf([
|
|
|
68
68
|
AST_NODE_TYPES.PropertyDefinition,
|
|
69
69
|
AST_NODE_TYPES.MethodDefinition
|
|
70
70
|
]);
|
|
71
|
-
var isLoop = isOneOf([
|
|
72
|
-
AST_NODE_TYPES.DoWhileStatement,
|
|
73
|
-
AST_NODE_TYPES.ForInStatement,
|
|
74
|
-
AST_NODE_TYPES.ForOfStatement,
|
|
75
|
-
AST_NODE_TYPES.ForStatement,
|
|
76
|
-
AST_NODE_TYPES.WhileStatement
|
|
77
|
-
]);
|
|
78
|
-
var isControlFlow = or(
|
|
79
|
-
isLoop,
|
|
80
|
-
isOneOf([
|
|
81
|
-
AST_NODE_TYPES.IfStatement,
|
|
82
|
-
AST_NODE_TYPES.SwitchStatement
|
|
83
|
-
])
|
|
84
|
-
);
|
|
85
|
-
var isConditional = or(
|
|
86
|
-
isControlFlow,
|
|
87
|
-
isOneOf([
|
|
88
|
-
AST_NODE_TYPES.LogicalExpression,
|
|
89
|
-
AST_NODE_TYPES.ConditionalExpression
|
|
90
|
-
])
|
|
91
|
-
);
|
|
92
|
-
var isArrayTupleType = isOneOf([AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSTupleType]);
|
|
93
71
|
var isProperty = isOneOf([
|
|
94
72
|
AST_NODE_TYPES.PropertyDefinition,
|
|
95
73
|
AST_NODE_TYPES.TSIndexSignature,
|
|
@@ -120,60 +98,12 @@ var isJSX = isOneOf([
|
|
|
120
98
|
AST_NODE_TYPES.JSXSpreadChild,
|
|
121
99
|
AST_NODE_TYPES.JSXText
|
|
122
100
|
]);
|
|
123
|
-
var
|
|
124
|
-
AST_NODE_TYPES.
|
|
125
|
-
AST_NODE_TYPES.
|
|
126
|
-
AST_NODE_TYPES.
|
|
127
|
-
AST_NODE_TYPES.
|
|
128
|
-
|
|
129
|
-
var isTypeDeclaration = isOneOf([
|
|
130
|
-
AST_NODE_TYPES.TSInterfaceDeclaration,
|
|
131
|
-
AST_NODE_TYPES.TSTypeAliasDeclaration
|
|
132
|
-
]);
|
|
133
|
-
var isLeftHandSideExpression = isOneOf([
|
|
134
|
-
AST_NODE_TYPES.ArrayExpression,
|
|
135
|
-
AST_NODE_TYPES.ArrayPattern,
|
|
136
|
-
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
137
|
-
AST_NODE_TYPES.CallExpression,
|
|
138
|
-
AST_NODE_TYPES.ClassExpression,
|
|
139
|
-
AST_NODE_TYPES.FunctionExpression,
|
|
140
|
-
AST_NODE_TYPES.Identifier,
|
|
141
|
-
AST_NODE_TYPES.JSXElement,
|
|
142
|
-
AST_NODE_TYPES.JSXFragment,
|
|
143
|
-
AST_NODE_TYPES.Literal,
|
|
144
|
-
AST_NODE_TYPES.TemplateLiteral,
|
|
145
|
-
AST_NODE_TYPES.MemberExpression,
|
|
146
|
-
AST_NODE_TYPES.MetaProperty,
|
|
147
|
-
AST_NODE_TYPES.ObjectExpression,
|
|
148
|
-
AST_NODE_TYPES.ObjectPattern,
|
|
149
|
-
AST_NODE_TYPES.SequenceExpression,
|
|
150
|
-
AST_NODE_TYPES.Super,
|
|
151
|
-
AST_NODE_TYPES.TaggedTemplateExpression,
|
|
152
|
-
AST_NODE_TYPES.ThisExpression
|
|
153
|
-
]);
|
|
154
|
-
var isLeftHandSideExpressionType = isOneOf([
|
|
155
|
-
AST_NODE_TYPES.ArrayExpression,
|
|
156
|
-
AST_NODE_TYPES.ArrayPattern,
|
|
157
|
-
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
158
|
-
AST_NODE_TYPES.CallExpression,
|
|
159
|
-
AST_NODE_TYPES.ClassExpression,
|
|
160
|
-
AST_NODE_TYPES.FunctionExpression,
|
|
161
|
-
AST_NODE_TYPES.Identifier,
|
|
162
|
-
AST_NODE_TYPES.JSXElement,
|
|
163
|
-
AST_NODE_TYPES.JSXFragment,
|
|
164
|
-
AST_NODE_TYPES.Literal,
|
|
165
|
-
AST_NODE_TYPES.TemplateLiteral,
|
|
166
|
-
AST_NODE_TYPES.MemberExpression,
|
|
167
|
-
AST_NODE_TYPES.MetaProperty,
|
|
168
|
-
AST_NODE_TYPES.ObjectExpression,
|
|
169
|
-
AST_NODE_TYPES.ObjectPattern,
|
|
170
|
-
AST_NODE_TYPES.SequenceExpression,
|
|
171
|
-
AST_NODE_TYPES.Super,
|
|
172
|
-
AST_NODE_TYPES.TaggedTemplateExpression,
|
|
173
|
-
AST_NODE_TYPES.ThisExpression,
|
|
174
|
-
AST_NODE_TYPES.TSAsExpression,
|
|
175
|
-
AST_NODE_TYPES.TSNonNullExpression,
|
|
176
|
-
AST_NODE_TYPES.TSTypeAssertion
|
|
101
|
+
var isLoop = isOneOf([
|
|
102
|
+
AST_NODE_TYPES.DoWhileStatement,
|
|
103
|
+
AST_NODE_TYPES.ForInStatement,
|
|
104
|
+
AST_NODE_TYPES.ForOfStatement,
|
|
105
|
+
AST_NODE_TYPES.ForStatement,
|
|
106
|
+
AST_NODE_TYPES.WhileStatement
|
|
177
107
|
]);
|
|
178
108
|
var isTypeExpression = isOneOf([
|
|
179
109
|
AST_NODE_TYPES.TSAsExpression,
|
|
@@ -230,7 +160,7 @@ function getFunctionId(node) {
|
|
|
230
160
|
case isTypeAssertionExpression(node.parent):
|
|
231
161
|
return getFunctionId(node.parent);
|
|
232
162
|
}
|
|
233
|
-
return
|
|
163
|
+
return unit;
|
|
234
164
|
}
|
|
235
165
|
function getFunctionInitPath(node) {
|
|
236
166
|
if (node.type === AST_NODE_TYPES.FunctionDeclaration) {
|
|
@@ -251,7 +181,7 @@ function getFunctionInitPath(node) {
|
|
|
251
181
|
case (parent.type === AST_NODE_TYPES.PropertyDefinition && parent.parent.parent.type === AST_NODE_TYPES.ClassDeclaration):
|
|
252
182
|
return [parent.parent.parent, parent.parent, parent, node];
|
|
253
183
|
}
|
|
254
|
-
return
|
|
184
|
+
return unit;
|
|
255
185
|
}
|
|
256
186
|
function hasCallInFunctionInitPath(callName, initPath) {
|
|
257
187
|
return initPath.some((n) => {
|
|
@@ -275,7 +205,7 @@ function isImmediatelyInvokedFunction(node) {
|
|
|
275
205
|
return node.type !== AST_NODE_TYPES.FunctionDeclaration && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node;
|
|
276
206
|
}
|
|
277
207
|
function findParentNode(node, test) {
|
|
278
|
-
if (node == null) return
|
|
208
|
+
if (node == null) return unit;
|
|
279
209
|
let parent = node.parent;
|
|
280
210
|
while (parent != null && parent.type !== AST_NODE_TYPES.Program) {
|
|
281
211
|
if (test(parent)) {
|
|
@@ -283,7 +213,7 @@ function findParentNode(node, test) {
|
|
|
283
213
|
}
|
|
284
214
|
parent = parent.parent;
|
|
285
215
|
}
|
|
286
|
-
return
|
|
216
|
+
return unit;
|
|
287
217
|
}
|
|
288
218
|
function getNestedIdentifiers(node) {
|
|
289
219
|
const identifiers = [];
|
|
@@ -586,10 +516,10 @@ function getPropertyName(node) {
|
|
|
586
516
|
if (node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
587
517
|
return node.quasis[0]?.value.raw;
|
|
588
518
|
}
|
|
589
|
-
return
|
|
519
|
+
return unit;
|
|
590
520
|
}
|
|
591
521
|
function isThenCall(node) {
|
|
592
522
|
return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "then";
|
|
593
523
|
}
|
|
594
524
|
|
|
595
|
-
export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall,
|
|
525
|
+
export { findParentNode, getArrayMethodCallbackIndexParamPosition, getClassId, getFunctionId, getFunctionInitPath, getJSExpression, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, hasCallInFunctionInitPath, is, isArrayFromCall, isArrayMapCall, isClass, isEmptyFunction, isFunction, isFunctionType, isImmediatelyInvokedFunction, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThenCall, isThisExpression, isTypeAssertionExpression, isTypeExpression, toDelimiterFormat, toStringFormat };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.120",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -27,19 +27,18 @@
|
|
|
27
27
|
"./package.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@typescript-eslint/types": "^8.
|
|
31
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
32
|
-
"@typescript-eslint/utils": "^8.
|
|
30
|
+
"@typescript-eslint/types": "^8.38.0",
|
|
31
|
+
"@typescript-eslint/typescript-estree": "^8.38.0",
|
|
32
|
+
"@typescript-eslint/utils": "^8.38.0",
|
|
33
33
|
"string-ts": "^2.2.1",
|
|
34
|
-
"ts-pattern": "^5.
|
|
35
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
34
|
+
"ts-pattern": "^5.8.0",
|
|
35
|
+
"@eslint-react/eff": "2.0.0-next.120"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"tsup": "^8.
|
|
38
|
+
"tsup": "^8.5.0",
|
|
39
39
|
"@local/configs": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
|
-
"bun": ">=1.0.15",
|
|
43
42
|
"node": ">=20.19.0"
|
|
44
43
|
},
|
|
45
44
|
"scripts": {
|