@eslint-react/ast 4.2.3 → 4.2.5-beta.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/dist/index.d.ts +33 -34
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,75 +1,74 @@
|
|
|
1
1
|
import { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/types";
|
|
2
|
-
import { TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
|
|
3
2
|
|
|
4
3
|
//#region src/node-types.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Represents function expressions and declarations in TSESTree
|
|
7
6
|
*/
|
|
8
|
-
type TSESTreeFunction = TSESTree
|
|
7
|
+
type TSESTreeFunction = TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression;
|
|
9
8
|
/**
|
|
10
9
|
* Represents all function-related types including TypeScript function types
|
|
11
10
|
*/
|
|
12
|
-
type TSESTreeFunctionType = TSESTree
|
|
11
|
+
type TSESTreeFunctionType = TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSDeclareFunction | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignature | TSESTreeFunction;
|
|
13
12
|
/**
|
|
14
13
|
* Represents class declarations and expressions in TSESTree
|
|
15
14
|
*/
|
|
16
|
-
type TSESTreeClass = TSESTree
|
|
15
|
+
type TSESTreeClass = TSESTree.ClassDeclaration | TSESTree.ClassExpression;
|
|
17
16
|
/**
|
|
18
17
|
* Represents method definitions and property definitions in classes
|
|
19
18
|
*/
|
|
20
|
-
type TSESTreeMethodOrProperty = TSESTree
|
|
19
|
+
type TSESTreeMethodOrProperty = TSESTree.PropertyDefinition | TSESTree.MethodDefinition;
|
|
21
20
|
/**
|
|
22
21
|
* Represents loop statements in TSESTree
|
|
23
22
|
*/
|
|
24
|
-
type TSESTreeLoop = TSESTree
|
|
23
|
+
type TSESTreeLoop = TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
|
|
25
24
|
/**
|
|
26
25
|
* Represents TypeScript array and tuple types
|
|
27
26
|
*/
|
|
28
|
-
type TSESTreeArrayTupleType = TSESTree
|
|
27
|
+
type TSESTreeArrayTupleType = TSESTree.TSArrayType | TSESTree.TSTupleType;
|
|
29
28
|
/**
|
|
30
29
|
* Represents property-like nodes in TSESTree
|
|
31
30
|
*/
|
|
32
|
-
type TSESTreeProperty = TSESTree
|
|
31
|
+
type TSESTreeProperty = TSESTree.PropertyDefinition | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignature;
|
|
33
32
|
/**
|
|
34
33
|
* Represents all JSX-related nodes in TSESTree
|
|
35
34
|
* Note: This type is for type-level operations. The isJSX() runtime guard in node-is.ts
|
|
36
35
|
* has a slightly different set of nodes as it includes JSXExpressionContainer which is
|
|
37
36
|
* commonly needed for runtime checks but not included in this type union.
|
|
38
37
|
*/
|
|
39
|
-
type TSESTreeJSX = TSESTree
|
|
40
|
-
type TSESTreeJSXElementLike = TSESTree
|
|
38
|
+
type TSESTreeJSX = TSESTree.JSXAttribute | TSESTree.JSXChild | TSESTree.JSXClosingElement | TSESTree.JSXClosingFragment | TSESTree.JSXEmptyExpression | TSESTree.JSXIdentifierToken | TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment | TSESTree.JSXSpreadAttribute | TSESTree.JSXTagNameExpression | TSESTree.JSXTextToken;
|
|
39
|
+
type TSESTreeJSXElementLike = TSESTree.JSXElement | TSESTree.JSXFragment;
|
|
41
40
|
/**
|
|
42
41
|
* Represents JSX attribute-like nodes (attributes and spread attributes)
|
|
43
42
|
*/
|
|
44
|
-
type TSESTreeJSXAttributeLike = TSESTree
|
|
43
|
+
type TSESTreeJSXAttributeLike = TSESTree.JSXAttribute | TSESTree.JSXSpreadAttribute;
|
|
45
44
|
/**
|
|
46
45
|
* Represents destructuring patterns in variable declarations
|
|
47
46
|
*/
|
|
48
|
-
type TSESTreeDestructuringPattern = TSESTree
|
|
47
|
+
type TSESTreeDestructuringPattern = TSESTree.ArrayPattern | TSESTree.AssignmentPattern | TSESTree.ObjectPattern | TSESTree.RestElement;
|
|
49
48
|
/**
|
|
50
49
|
* Represents TypeScript type declaration nodes
|
|
51
50
|
*/
|
|
52
|
-
type TSESTreeTypeDeclaration = TSESTree
|
|
51
|
+
type TSESTreeTypeDeclaration = TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeAliasDeclaration;
|
|
53
52
|
/**
|
|
54
53
|
* Represents TypeScript type expression nodes (type assertions, non-null expressions, etc.)
|
|
55
54
|
*/
|
|
56
|
-
type TSESTreeTypeExpression = TSESTree
|
|
55
|
+
type TSESTreeTypeExpression = TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.TSInstantiationExpression;
|
|
57
56
|
/**
|
|
58
57
|
* Represents TypeScript type assertion expressions (excluding instantiation expressions)
|
|
59
58
|
*/
|
|
60
|
-
type TSESTreeTypeAssertionExpression = TSESTree
|
|
59
|
+
type TSESTreeTypeAssertionExpression = TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
61
60
|
/**
|
|
62
61
|
* Represents a directive expression statement in TSESTree (ex: "use strict";)
|
|
63
62
|
*/
|
|
64
|
-
type TSESTreeDirective = TSESTree
|
|
63
|
+
type TSESTreeDirective = TSESTree.ExpressionStatement & {
|
|
65
64
|
directive: string;
|
|
66
|
-
expression: TSESTree
|
|
65
|
+
expression: TSESTree.StringLiteral;
|
|
67
66
|
};
|
|
68
67
|
/**
|
|
69
68
|
* Represents a directive-like expression statement in TSESTree
|
|
70
69
|
*/
|
|
71
|
-
type TSESTreeDirectiveLike = TSESTree
|
|
72
|
-
expression: TSESTree
|
|
70
|
+
type TSESTreeDirectiveLike = TSESTree.ExpressionStatement & {
|
|
71
|
+
expression: TSESTree.StringLiteral;
|
|
73
72
|
};
|
|
74
73
|
//#endregion
|
|
75
74
|
//#region src/class-id.d.ts
|
|
@@ -200,7 +199,7 @@ declare function isDirectiveInFunction(node: TSESTreeFunction, name: string): bo
|
|
|
200
199
|
* where JS gives anonymous function expressions names. We roughly detect the
|
|
201
200
|
* same AST nodes with some exceptions to better fit our use case.
|
|
202
201
|
*/
|
|
203
|
-
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.
|
|
202
|
+
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | null;
|
|
204
203
|
/**
|
|
205
204
|
* Type representing the return type of getFunctionId
|
|
206
205
|
*/
|
|
@@ -320,19 +319,19 @@ declare const isOneOf: <NodeTypes extends readonly TSESTree.AST_NODE_TYPES[]>(no
|
|
|
320
319
|
* @param node The node to check
|
|
321
320
|
* @returns True if the node is a function
|
|
322
321
|
*/
|
|
323
|
-
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.
|
|
322
|
+
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
|
|
324
323
|
/**
|
|
325
324
|
* Check if a node is a function type (including TypeScript function types)
|
|
326
325
|
* @param node The node to check
|
|
327
326
|
* @returns True if the node is a function type
|
|
328
327
|
*/
|
|
329
|
-
declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.
|
|
328
|
+
declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignatureComputedName | TSESTree.TSMethodSignatureNonComputedName;
|
|
330
329
|
/**
|
|
331
330
|
* Check if a node is a class declaration or expression
|
|
332
331
|
* @param node The node to check
|
|
333
332
|
* @returns True if the node is a class
|
|
334
333
|
*/
|
|
335
|
-
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.
|
|
334
|
+
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassExpression | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName;
|
|
336
335
|
/**
|
|
337
336
|
* Check if a node is a method or property definition
|
|
338
337
|
* @param node The node to check
|
|
@@ -375,7 +374,7 @@ declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) =
|
|
|
375
374
|
* @returns True if the node is a JSX node
|
|
376
375
|
* @see TSESTreeJSX
|
|
377
376
|
*/
|
|
378
|
-
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.
|
|
377
|
+
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.JSXAttribute | TSESTree.JSXClosingElement | TSESTree.JSXClosingFragment | TSESTree.JSXEmptyExpression | TSESTree.JSXExpressionContainer | TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment | TSESTree.JSXSpreadAttribute | TSESTree.JSXSpreadChild | TSESTree.JSXText;
|
|
379
378
|
/**
|
|
380
379
|
* Check if a node is a loop statement
|
|
381
380
|
* @param node The node to check
|
|
@@ -393,7 +392,7 @@ declare const isControlFlow: (data: TSESTree.Node | null | undefined) => data is
|
|
|
393
392
|
* @param node The node to check
|
|
394
393
|
* @returns True if the node is conditional
|
|
395
394
|
*/
|
|
396
|
-
declare const isConditional: (data: TSESTree.Node | null | undefined) => data is TSESTree.ConditionalExpression | TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.
|
|
395
|
+
declare const isConditional: (data: TSESTree.Node | null | undefined) => data is TSESTree.ConditionalExpression | TSESTree.LogicalExpression | TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.SwitchStatement | TSESTree.WhileStatement;
|
|
397
396
|
/**
|
|
398
397
|
* Check if a node is a TypeScript type expression
|
|
399
398
|
* @param node The node to check
|
|
@@ -421,28 +420,28 @@ declare function getFullyQualifiedName(node: TSESTree.Node, getText: (node: TSES
|
|
|
421
420
|
/**
|
|
422
421
|
* Represents an arrow function expression with an implicit return
|
|
423
422
|
*/
|
|
424
|
-
type ImplicitReturnArrowFunctionExpression = TSESTree
|
|
425
|
-
body: TSESTree
|
|
423
|
+
type ImplicitReturnArrowFunctionExpression = TSESTree.ArrowFunctionExpression & {
|
|
424
|
+
body: TSESTree.Expression;
|
|
426
425
|
};
|
|
427
426
|
/**
|
|
428
427
|
* Represents a variable declarator with object destructuring and an identifier initializer
|
|
429
428
|
*/
|
|
430
|
-
type ObjectDestructuringVariableDeclarator = TSESTree
|
|
431
|
-
id: TSESTree
|
|
432
|
-
init: TSESTree
|
|
429
|
+
type ObjectDestructuringVariableDeclarator = TSESTree.VariableDeclarator & {
|
|
430
|
+
id: TSESTree.ObjectPattern;
|
|
431
|
+
init: TSESTree.Identifier;
|
|
433
432
|
};
|
|
434
433
|
/**
|
|
435
434
|
* Represents an assignment expression that assigns to a displayName property
|
|
436
435
|
*/
|
|
437
|
-
type DisplayNameAssignmentExpression = TSESTree
|
|
436
|
+
type DisplayNameAssignmentExpression = TSESTree.AssignmentExpression & {
|
|
438
437
|
type: "AssignmentExpression";
|
|
439
|
-
left: TSESTree
|
|
440
|
-
property: TSESTree
|
|
438
|
+
left: TSESTree.MemberExpression & {
|
|
439
|
+
property: TSESTree.Identifier & {
|
|
441
440
|
name: "displayName";
|
|
442
441
|
};
|
|
443
442
|
};
|
|
444
443
|
operator: "=";
|
|
445
|
-
right: TSESTree
|
|
444
|
+
right: TSESTree.Literal;
|
|
446
445
|
};
|
|
447
446
|
/**
|
|
448
447
|
* Selector for arrow function expressions with implicit return
|