@eslint-react/ast 2.0.0-next.0 → 2.0.0-next.2
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.js +194 -241
- package/package.json +5 -13
- package/dist/index.d.mts +0 -284
- package/dist/index.mjs +0 -589
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.2",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -14,22 +14,14 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Rel1cx<rel1cx@proton.me>",
|
|
16
16
|
"sideEffects": false,
|
|
17
|
+
"type": "module",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"default": "./dist/index.mjs"
|
|
22
|
-
},
|
|
23
|
-
"require": {
|
|
24
|
-
"types": "./dist/index.d.ts",
|
|
25
|
-
"default": "./dist/index.js"
|
|
26
|
-
}
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
27
22
|
},
|
|
28
23
|
"./package.json": "./package.json"
|
|
29
24
|
},
|
|
30
|
-
"main": "dist/index.js",
|
|
31
|
-
"module": "dist/index.mjs",
|
|
32
|
-
"types": "dist/index.d.ts",
|
|
33
25
|
"files": [
|
|
34
26
|
"dist",
|
|
35
27
|
"./package.json"
|
|
@@ -40,7 +32,7 @@
|
|
|
40
32
|
"@typescript-eslint/utils": "^8.30.1",
|
|
41
33
|
"string-ts": "^2.2.1",
|
|
42
34
|
"ts-pattern": "^5.7.0",
|
|
43
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
35
|
+
"@eslint-react/eff": "2.0.0-next.2"
|
|
44
36
|
},
|
|
45
37
|
"devDependencies": {
|
|
46
38
|
"tsup": "^8.4.0",
|
package/dist/index.d.mts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
2
|
-
import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
|
|
3
|
-
import { _ } from '@eslint-react/eff';
|
|
4
|
-
|
|
5
|
-
declare function isArrayFromCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
|
|
6
|
-
declare function isArrayMapCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
|
|
7
|
-
|
|
8
|
-
declare function getArrayMethodCallbackIndexParamPosition(methodName: string): number;
|
|
9
|
-
|
|
10
|
-
type TSESTreeFunction = TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclaration | TSESTree$1.FunctionExpression;
|
|
11
|
-
type TSESTreeFunctionType = TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunction | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignature | TSESTreeFunction;
|
|
12
|
-
type TSESTreeClass = TSESTree$1.ClassDeclaration | TSESTree$1.ClassExpression;
|
|
13
|
-
type TSESTreeMethodOrProperty = TSESTree$1.PropertyDefinition | TSESTree$1.MethodDefinition;
|
|
14
|
-
type TSESTreeLoop = TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
|
|
15
|
-
type TSESTreeArrayTupleType = TSESTree$1.TSArrayType | TSESTree$1.TSTupleType;
|
|
16
|
-
type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignature | TSESTree$1.TSParameterProperty | TSESTree$1.TSPropertySignature;
|
|
17
|
-
type TSESTreeJSX = TSESTree$1.JSXAttribute | TSESTree$1.JSXChild | TSESTree$1.JSXClosingElement | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXElement | TSESTree$1.JSXEmptyExpression | TSESTree$1.JSXExpression | TSESTree$1.JSXExpressionContainer | TSESTree$1.JSXFragment | TSESTree$1.JSXIdentifier | TSESTree$1.JSXIdentifierToken | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXSpreadAttribute | TSESTree$1.JSXSpreadChild | TSESTree$1.JSXTagNameExpression | TSESTree$1.JSXText | TSESTree$1.JSXTextToken;
|
|
18
|
-
type TSESTreeDestructuringPattern = TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
|
|
19
|
-
type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
|
|
20
|
-
type TSESTreeTypeExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
|
|
21
|
-
type TSESTreeTypeAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Gets class identifier from ClassDeclaration or ClassExpression
|
|
25
|
-
* @param node The AST node to check
|
|
26
|
-
* @returns class identifier or null
|
|
27
|
-
*/
|
|
28
|
-
declare function getClassId(node: TSESTreeClass): TSESTree.Identifier | _;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Recursively get the inner expression until it's not a TypeExpression
|
|
32
|
-
* @param node - The node to get the expression from
|
|
33
|
-
* @returns The inner expression
|
|
34
|
-
*/
|
|
35
|
-
declare function getJSExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
|
|
36
|
-
declare function isThisExpression(node: TSESTree.Expression): boolean;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Gets the static name of a function AST node. For function declarations it is
|
|
40
|
-
* easy. For anonymous function expressions it is much harder. If you search for
|
|
41
|
-
* `IsAnonymousFunctionDefinition()` in the ECMAScript spec you'll find places
|
|
42
|
-
* where JS gives anonymous function expressions names. We roughly detect the
|
|
43
|
-
* same AST nodes with some exceptions to better fit our use case.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.Identifier | _;
|
|
47
|
-
|
|
48
|
-
type FunctionInitPath =
|
|
49
|
-
/**
|
|
50
|
-
* function Comp() { return <div />; }
|
|
51
|
-
*/
|
|
52
|
-
readonly [TSESTree.FunctionDeclaration]
|
|
53
|
-
/**
|
|
54
|
-
* const Comp = () => <div />;
|
|
55
|
-
* const Comp = function () { return <div />; };
|
|
56
|
-
*/
|
|
57
|
-
| readonly [
|
|
58
|
-
TSESTree.VariableDeclaration,
|
|
59
|
-
TSESTree.VariableDeclarator,
|
|
60
|
-
TSESTreeFunction
|
|
61
|
-
]
|
|
62
|
-
/**
|
|
63
|
-
* const Comp = React.memo(() => <div />);
|
|
64
|
-
* const Comp = React.forwardRef(() => <div />);
|
|
65
|
-
*/
|
|
66
|
-
| readonly [
|
|
67
|
-
TSESTree.VariableDeclaration,
|
|
68
|
-
TSESTree.VariableDeclarator,
|
|
69
|
-
TSESTree.CallExpression,
|
|
70
|
-
TSESTreeFunction
|
|
71
|
-
]
|
|
72
|
-
/**
|
|
73
|
-
* const Comp = React.memo(React.forwardRef(() => <div />));
|
|
74
|
-
*/
|
|
75
|
-
| readonly [
|
|
76
|
-
TSESTree.VariableDeclaration,
|
|
77
|
-
TSESTree.VariableDeclarator,
|
|
78
|
-
TSESTree.CallExpression,
|
|
79
|
-
TSESTree.CallExpression,
|
|
80
|
-
TSESTreeFunction
|
|
81
|
-
]
|
|
82
|
-
/**
|
|
83
|
-
* const Comps = {
|
|
84
|
-
* TopNav() { return <div />; },
|
|
85
|
-
* SidPanel: () => <div />,
|
|
86
|
-
* }
|
|
87
|
-
*/
|
|
88
|
-
| readonly [
|
|
89
|
-
TSESTree.VariableDeclaration,
|
|
90
|
-
TSESTree.VariableDeclarator,
|
|
91
|
-
TSESTree.ObjectExpression,
|
|
92
|
-
TSESTree.Property,
|
|
93
|
-
TSESTreeFunction
|
|
94
|
-
]
|
|
95
|
-
/**
|
|
96
|
-
* const Comps = {
|
|
97
|
-
* TopNav: React.memo(() => <div />),
|
|
98
|
-
* SidPanel: React.forwardRef(() => <div />),
|
|
99
|
-
* }
|
|
100
|
-
*/
|
|
101
|
-
| readonly [
|
|
102
|
-
TSESTree.VariableDeclaration,
|
|
103
|
-
TSESTree.VariableDeclarator,
|
|
104
|
-
TSESTree.ObjectExpression,
|
|
105
|
-
TSESTree.Property,
|
|
106
|
-
TSESTree.CallExpression,
|
|
107
|
-
TSESTreeFunction
|
|
108
|
-
]
|
|
109
|
-
/**
|
|
110
|
-
* const Comps = {
|
|
111
|
-
* TopNav: React.memo(React.forwardRef(() => <div />)),
|
|
112
|
-
* SidPanel: React.forwardRef(React.memo(() => <div />)),
|
|
113
|
-
* }
|
|
114
|
-
*/
|
|
115
|
-
| readonly [
|
|
116
|
-
TSESTree.VariableDeclaration,
|
|
117
|
-
TSESTree.VariableDeclarator,
|
|
118
|
-
TSESTree.ObjectExpression,
|
|
119
|
-
TSESTree.Property,
|
|
120
|
-
TSESTree.CallExpression,
|
|
121
|
-
TSESTree.CallExpression,
|
|
122
|
-
TSESTreeFunction
|
|
123
|
-
]
|
|
124
|
-
/**
|
|
125
|
-
* class Comp {
|
|
126
|
-
* TopNav() { return <div />; }
|
|
127
|
-
* }
|
|
128
|
-
*/
|
|
129
|
-
| readonly [
|
|
130
|
-
TSESTree.ClassDeclaration,
|
|
131
|
-
TSESTree.ClassBody,
|
|
132
|
-
TSESTree.MethodDefinition,
|
|
133
|
-
TSESTreeFunction
|
|
134
|
-
]
|
|
135
|
-
/**
|
|
136
|
-
* class Comp {
|
|
137
|
-
* TopNav = () => <div />;
|
|
138
|
-
* }
|
|
139
|
-
*/
|
|
140
|
-
| readonly [
|
|
141
|
-
TSESTree.ClassDeclaration,
|
|
142
|
-
TSESTree.ClassBody,
|
|
143
|
-
TSESTree.PropertyDefinition,
|
|
144
|
-
TSESTreeFunction
|
|
145
|
-
];
|
|
146
|
-
declare function getFunctionInitPath(node: TSESTreeFunction): FunctionInitPath | _;
|
|
147
|
-
declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionInitPath): boolean;
|
|
148
|
-
|
|
149
|
-
declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Find the parent node that satisfies the test function
|
|
153
|
-
* @param node The AST node
|
|
154
|
-
* @param test The test function
|
|
155
|
-
* @returns The parent node that satisfies the test function or `_` if not found
|
|
156
|
-
*/
|
|
157
|
-
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | _, test: (n: TSESTree.Node) => n is A): A | _;
|
|
158
|
-
/**
|
|
159
|
-
* Find the parent node that satisfies the test function or `_` if not found
|
|
160
|
-
* @param node The AST node
|
|
161
|
-
* @param test The test function
|
|
162
|
-
* @returns The parent node that satisfies the test function
|
|
163
|
-
*/
|
|
164
|
-
declare function findParentNode(node: TSESTree.Node | _, test: (node: TSESTree.Node) => boolean): TSESTree.Node | _;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Get all nested identifiers in a expression like node
|
|
168
|
-
* @param node The node to get the nested identifiers from
|
|
169
|
-
* @returns All nested identifiers
|
|
170
|
-
*/
|
|
171
|
-
declare function getNestedIdentifiers(node: TSESTree.Node): readonly TSESTree.Identifier[];
|
|
172
|
-
/**
|
|
173
|
-
* Gets the nested return statements in the node that are within the same function
|
|
174
|
-
* @param node The AST node
|
|
175
|
-
* @returns The nested return statements in the node
|
|
176
|
-
*/
|
|
177
|
-
declare function getNestedReturnStatements(node: TSESTree.Node): readonly TSESTree.ReturnStatement[];
|
|
178
|
-
/**
|
|
179
|
-
* Get all nested expressions of type T in an expression like node
|
|
180
|
-
* @param type The type of the expression to retrieve within the node
|
|
181
|
-
* @returns A partially applied function bound to a predicate of type T. The returned function can be called passing a
|
|
182
|
-
* node, and it will return an array of all nested expressions of type T.
|
|
183
|
-
*/
|
|
184
|
-
declare function getNestedExpressionsOfType<TNodeType extends AST_NODE_TYPES>(type: TNodeType): (node: TSESTree.Node) => Extract<TSESTree.Node, {
|
|
185
|
-
type: TNodeType;
|
|
186
|
-
}>[];
|
|
187
|
-
/**
|
|
188
|
-
* Get all nested new expressions in an expression like node
|
|
189
|
-
* @param node The node to get the nested new expressions from
|
|
190
|
-
* @returns All nested new expressions
|
|
191
|
-
*/
|
|
192
|
-
declare const getNestedNewExpressions: (node: TSESTree.Node) => TSESTree.NewExpression[];
|
|
193
|
-
/**
|
|
194
|
-
* Get all nested call expressions in a expression like node
|
|
195
|
-
* @param node The node to get the nested call expressions from
|
|
196
|
-
* @returns All nested call expressions
|
|
197
|
-
*/
|
|
198
|
-
declare const getNestedCallExpressions: (node: TSESTree.Node) => TSESTree.CallExpression[];
|
|
199
|
-
|
|
200
|
-
declare const is: <NodeType extends TSESTree.AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
201
|
-
type: NodeType;
|
|
202
|
-
}>;
|
|
203
|
-
declare const isOneOf: <NodeTypes extends readonly TSESTree.AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
204
|
-
type: NodeTypes[number];
|
|
205
|
-
}>;
|
|
206
|
-
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
|
|
207
|
-
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;
|
|
208
|
-
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
209
|
-
declare const isMethodOrProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
210
|
-
declare const isLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
|
|
211
|
-
declare const isControlFlow: (data: TSESTree.Node | null | undefined) => data is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.SwitchStatement | TSESTree.WhileStatement;
|
|
212
|
-
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;
|
|
213
|
-
declare const isArrayTupleType: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSArrayType | TSESTree.TSTupleType;
|
|
214
|
-
declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignatureComputedName | TSESTree.TSPropertySignatureNonComputedName;
|
|
215
|
-
declare const isJSXElement: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement;
|
|
216
|
-
declare const isJSXFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
|
|
217
|
-
declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName;
|
|
218
|
-
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;
|
|
219
|
-
declare const isDestructuringPattern: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrayPattern | TSESTree.AssignmentPattern | TSESTree.ObjectPattern | TSESTree.RestElement;
|
|
220
|
-
declare const isTypeDeclaration: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeAliasDeclaration;
|
|
221
|
-
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;
|
|
222
|
-
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;
|
|
223
|
-
declare const isTypeExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
224
|
-
declare const isTypeAssertionExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Check if a node is multiline
|
|
228
|
-
* @param node The AST node to check
|
|
229
|
-
* @returns `true` if the node is multiline
|
|
230
|
-
*/
|
|
231
|
-
declare function isMultiLine(node: TSESTree.Node): boolean;
|
|
232
|
-
/**
|
|
233
|
-
* Check if a node is a line break
|
|
234
|
-
* @param node The AST node to check
|
|
235
|
-
* @returns boolean
|
|
236
|
-
*/
|
|
237
|
-
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
238
|
-
|
|
239
|
-
declare function isLiteral(node: TSESTree.Node): node is TSESTree.Literal;
|
|
240
|
-
declare function isLiteral(node: TSESTree.Node, type: "boolean"): node is TSESTree.BooleanLiteral;
|
|
241
|
-
declare function isLiteral(node: TSESTree.Node, type: "null"): node is TSESTree.NullLiteral;
|
|
242
|
-
declare function isLiteral(node: TSESTree.Node, type: "number"): node is TSESTree.NumberLiteral;
|
|
243
|
-
declare function isLiteral(node: TSESTree.Node, type: "regexp"): node is TSESTree.RegExpLiteral;
|
|
244
|
-
declare function isLiteral(node: TSESTree.Node, type: "string"): node is TSESTree.StringLiteral;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Determines whether node equals to another node
|
|
248
|
-
* @param a node to compare
|
|
249
|
-
* @param b node to compare
|
|
250
|
-
* @returns `true` if node equal
|
|
251
|
-
* @see https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/util/isNodeEqual.ts
|
|
252
|
-
*/
|
|
253
|
-
declare const isNodeEqual: {
|
|
254
|
-
(a: TSESTree.Node): (b: TSESTree.Node) => boolean;
|
|
255
|
-
(a: TSESTree.Node, b: TSESTree.Node): boolean;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Check if the given node is a member expression that accesses `process.env.NODE_ENV`
|
|
260
|
-
* @param node The AST node
|
|
261
|
-
* @returns True if the node is a member expression that accesses `process.env.NODE_ENV`, false otherwise
|
|
262
|
-
*/
|
|
263
|
-
declare function isProcessEnvNodeEnv(node: TSESTree.Node | null | _): node is TSESTree.MemberExpression;
|
|
264
|
-
/**
|
|
265
|
-
* Check if the given node is a binary expression that compares `process.env.NODE_ENV` with a string literal
|
|
266
|
-
* @param node The AST node
|
|
267
|
-
* @param operator The operator used in the comparison
|
|
268
|
-
* @param value The string literal value to compare against
|
|
269
|
-
* @returns True if the node is a binary expression that compares `process.env.NODE_ENV` with the specified value, false otherwise
|
|
270
|
-
*/
|
|
271
|
-
declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null | _, operator: "===" | "!==", value: "development" | "production"): node is TSESTree.BinaryExpression;
|
|
272
|
-
|
|
273
|
-
declare function getPropertyName(node: TSESTree.Node): string | _;
|
|
274
|
-
|
|
275
|
-
declare function toDelimiterCaseType(node: TSESTree.Node, delimiter?: string): "RegExp literal" | Lowercase<string> | `JSX ${Lowercase<string>}`;
|
|
276
|
-
/**
|
|
277
|
-
* Returns human readable node name for given AST node
|
|
278
|
-
* @param node AST node
|
|
279
|
-
* @param getText A function that returns the text of the node in the source code
|
|
280
|
-
* @returns Human readable node name
|
|
281
|
-
*/
|
|
282
|
-
declare function toString(node: TSESTree.Node, getText: (node: TSESTree.Node) => string): string;
|
|
283
|
-
|
|
284
|
-
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, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toDelimiterCaseType, toString };
|