@eslint-react/ast 1.24.0-next.8 → 1.24.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.mts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -5,23 +5,24 @@ import { SyntaxKind } from 'typescript';
|
|
|
5
5
|
import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/typescript-estree';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Find the parent node that satisfies the
|
|
8
|
+
* Find the parent node that satisfies the test function
|
|
9
9
|
* @param node The AST node
|
|
10
|
-
* @param
|
|
11
|
-
* @returns The parent node that satisfies the
|
|
10
|
+
* @param test The test function
|
|
11
|
+
* @returns The parent node that satisfies the test function or `_` if not found
|
|
12
12
|
*/
|
|
13
|
-
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | _,
|
|
13
|
+
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | _, test: (n: TSESTree.Node) => n is A): A | _;
|
|
14
14
|
/**
|
|
15
|
-
* Find the parent node that satisfies the test function
|
|
15
|
+
* Find the parent node that satisfies the test function or `_` if not found
|
|
16
16
|
* @param node The AST node
|
|
17
17
|
* @param test The test function
|
|
18
|
-
* @returns The parent node that satisfies the test
|
|
18
|
+
* @returns The parent node that satisfies the test function
|
|
19
19
|
*/
|
|
20
20
|
declare function findParentNode(node: TSESTree.Node | _, test: (node: TSESTree.Node) => boolean): TSESTree.Node | _;
|
|
21
21
|
|
|
22
22
|
type TSESTreeFunction = TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclaration | TSESTree$1.FunctionExpression;
|
|
23
23
|
type TSESTreeFunctionType = TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunction | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignature | TSESTreeFunction;
|
|
24
24
|
type TSESTreeClass = TSESTree$1.ClassDeclaration | TSESTree$1.ClassExpression;
|
|
25
|
+
type TSESTreeMethodOrProperty = TSESTree$1.PropertyDefinition | TSESTree$1.MethodDefinition;
|
|
25
26
|
type TSESTreeLoop = TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
|
|
26
27
|
type TSESTreeArrayTupleType = TSESTree$1.TSArrayType | TSESTree$1.TSTupleType;
|
|
27
28
|
type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignature | TSESTree$1.TSParameterProperty | TSESTree$1.TSPropertySignature;
|
|
@@ -2342,6 +2343,7 @@ declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES$2[]>(nodeTypes
|
|
|
2342
2343
|
declare const isFunction: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression;
|
|
2343
2344
|
declare const isFunctionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression | TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunctionNoDeclare | TSESTree$1.TSDeclareFunctionWithDeclare | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignatureComputedName | TSESTree$1.TSMethodSignatureNonComputedName;
|
|
2344
2345
|
declare const isClass: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ClassDeclarationWithName | TSESTree$1.ClassDeclarationWithOptionalName | TSESTree$1.ClassExpression;
|
|
2346
|
+
declare const isMethodOrProperty: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.MethodDefinitionComputedName | TSESTree$1.MethodDefinitionNonComputedName | TSESTree$1.PropertyDefinitionComputedName | TSESTree$1.PropertyDefinitionNonComputedName;
|
|
2345
2347
|
declare const isLoop: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
|
|
2346
2348
|
declare const isControlFlow: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
|
|
2347
2349
|
declare const isConditional: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.ConditionalExpression | TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.LogicalExpression | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
|
|
@@ -2429,4 +2431,4 @@ type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
|
2429
2431
|
|
|
2430
2432
|
declare function unwrapTypeExpression(node: TSESTree.Node): TSESTree.Node;
|
|
2431
2433
|
|
|
2432
|
-
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeProperty, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
2434
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,23 +5,24 @@ import { SyntaxKind } from 'typescript';
|
|
|
5
5
|
import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/typescript-estree';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Find the parent node that satisfies the
|
|
8
|
+
* Find the parent node that satisfies the test function
|
|
9
9
|
* @param node The AST node
|
|
10
|
-
* @param
|
|
11
|
-
* @returns The parent node that satisfies the
|
|
10
|
+
* @param test The test function
|
|
11
|
+
* @returns The parent node that satisfies the test function or `_` if not found
|
|
12
12
|
*/
|
|
13
|
-
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | _,
|
|
13
|
+
declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | _, test: (n: TSESTree.Node) => n is A): A | _;
|
|
14
14
|
/**
|
|
15
|
-
* Find the parent node that satisfies the test function
|
|
15
|
+
* Find the parent node that satisfies the test function or `_` if not found
|
|
16
16
|
* @param node The AST node
|
|
17
17
|
* @param test The test function
|
|
18
|
-
* @returns The parent node that satisfies the test
|
|
18
|
+
* @returns The parent node that satisfies the test function
|
|
19
19
|
*/
|
|
20
20
|
declare function findParentNode(node: TSESTree.Node | _, test: (node: TSESTree.Node) => boolean): TSESTree.Node | _;
|
|
21
21
|
|
|
22
22
|
type TSESTreeFunction = TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclaration | TSESTree$1.FunctionExpression;
|
|
23
23
|
type TSESTreeFunctionType = TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunction | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignature | TSESTreeFunction;
|
|
24
24
|
type TSESTreeClass = TSESTree$1.ClassDeclaration | TSESTree$1.ClassExpression;
|
|
25
|
+
type TSESTreeMethodOrProperty = TSESTree$1.PropertyDefinition | TSESTree$1.MethodDefinition;
|
|
25
26
|
type TSESTreeLoop = TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
|
|
26
27
|
type TSESTreeArrayTupleType = TSESTree$1.TSArrayType | TSESTree$1.TSTupleType;
|
|
27
28
|
type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignature | TSESTree$1.TSParameterProperty | TSESTree$1.TSPropertySignature;
|
|
@@ -2342,6 +2343,7 @@ declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES$2[]>(nodeTypes
|
|
|
2342
2343
|
declare const isFunction: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression;
|
|
2343
2344
|
declare const isFunctionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression | TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunctionNoDeclare | TSESTree$1.TSDeclareFunctionWithDeclare | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignatureComputedName | TSESTree$1.TSMethodSignatureNonComputedName;
|
|
2344
2345
|
declare const isClass: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ClassDeclarationWithName | TSESTree$1.ClassDeclarationWithOptionalName | TSESTree$1.ClassExpression;
|
|
2346
|
+
declare const isMethodOrProperty: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.MethodDefinitionComputedName | TSESTree$1.MethodDefinitionNonComputedName | TSESTree$1.PropertyDefinitionComputedName | TSESTree$1.PropertyDefinitionNonComputedName;
|
|
2345
2347
|
declare const isLoop: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
|
|
2346
2348
|
declare const isControlFlow: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
|
|
2347
2349
|
declare const isConditional: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.ConditionalExpression | TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.LogicalExpression | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
|
|
@@ -2429,4 +2431,4 @@ type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
|
2429
2431
|
|
|
2430
2432
|
declare function unwrapTypeExpression(node: TSESTree.Node): TSESTree.Node;
|
|
2431
2433
|
|
|
2432
|
-
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeProperty, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
2434
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
package/dist/index.js
CHANGED
|
@@ -116,6 +116,10 @@ var isFunctionType = isOneOf([
|
|
|
116
116
|
types.AST_NODE_TYPES.TSMethodSignature
|
|
117
117
|
]);
|
|
118
118
|
var isClass = isOneOf([types.AST_NODE_TYPES.ClassDeclaration, types.AST_NODE_TYPES.ClassExpression]);
|
|
119
|
+
var isMethodOrProperty = isOneOf([
|
|
120
|
+
types.AST_NODE_TYPES.PropertyDefinition,
|
|
121
|
+
types.AST_NODE_TYPES.MethodDefinition
|
|
122
|
+
]);
|
|
119
123
|
var isLoop = isOneOf([
|
|
120
124
|
types.AST_NODE_TYPES.DoWhileStatement,
|
|
121
125
|
types.AST_NODE_TYPES.ForInStatement,
|
|
@@ -637,6 +641,7 @@ exports.isLeftHandSideExpression = isLeftHandSideExpression;
|
|
|
637
641
|
exports.isLeftHandSideExpressionType = isLeftHandSideExpressionType;
|
|
638
642
|
exports.isLoop = isLoop;
|
|
639
643
|
exports.isMapCallLoose = isMapCallLoose;
|
|
644
|
+
exports.isMethodOrProperty = isMethodOrProperty;
|
|
640
645
|
exports.isMultiLine = isMultiLine;
|
|
641
646
|
exports.isNodeEqual = isNodeEqual;
|
|
642
647
|
exports.isOneOf = isOneOf;
|
package/dist/index.mjs
CHANGED
|
@@ -114,6 +114,10 @@ var isFunctionType = isOneOf([
|
|
|
114
114
|
AST_NODE_TYPES.TSMethodSignature
|
|
115
115
|
]);
|
|
116
116
|
var isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
|
|
117
|
+
var isMethodOrProperty = isOneOf([
|
|
118
|
+
AST_NODE_TYPES.PropertyDefinition,
|
|
119
|
+
AST_NODE_TYPES.MethodDefinition
|
|
120
|
+
]);
|
|
117
121
|
var isLoop = isOneOf([
|
|
118
122
|
AST_NODE_TYPES.DoWhileStatement,
|
|
119
123
|
AST_NODE_TYPES.ForInStatement,
|
|
@@ -600,4 +604,4 @@ function unwrapTypeExpression(node) {
|
|
|
600
604
|
return node;
|
|
601
605
|
}
|
|
602
606
|
|
|
603
|
-
export { findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
607
|
+
export { findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getIdentifiersFromBinaryExpression, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionOfClassMethod, isFunctionOfClassProperty, isFunctionOfImmediatelyInvoked, isFunctionOfObjectMethod, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isRegExpLiteral, isStringLiteral, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.24.0
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@typescript-eslint/typescript-estree": "^8.20.0",
|
|
38
38
|
"@typescript-eslint/utils": "^8.20.0",
|
|
39
39
|
"string-ts": "^2.2.0",
|
|
40
|
-
"ts-pattern": "^5.6.
|
|
41
|
-
"@eslint-react/eff": "1.24.0
|
|
40
|
+
"ts-pattern": "^5.6.1",
|
|
41
|
+
"@eslint-react/eff": "1.24.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.3.5",
|