@eslint-react/ast 1.28.1-next.3 → 1.28.1-next.4
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 +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +20 -15
- package/dist/index.mjs +18 -14
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -29,6 +29,8 @@ type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignat
|
|
|
29
29
|
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;
|
|
30
30
|
type TSESTreeDestructuringPattern = TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
|
|
31
31
|
type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
|
|
32
|
+
type TSESTreeTSOnlyExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
|
|
33
|
+
type TSESTreeTSAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
32
34
|
|
|
33
35
|
type FunctionInitPath =
|
|
34
36
|
/**
|
|
@@ -138,6 +140,13 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
|
|
|
138
140
|
*/
|
|
139
141
|
declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
|
|
140
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Gets the ECMAScript expression from a TS expression.
|
|
145
|
+
* @param node The TS expression.
|
|
146
|
+
* @returns The ECMAScript expression within the TS expression.
|
|
147
|
+
*/
|
|
148
|
+
declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
|
|
149
|
+
|
|
141
150
|
/**
|
|
142
151
|
* Gets the static name of a function AST node. For function declarations it is
|
|
143
152
|
* easy. For anonymous function expressions it is much harder. If you search for
|
|
@@ -2356,7 +2365,8 @@ declare const isDestructuringPattern: (node: TSESTree$1.Node | null | undefined)
|
|
|
2356
2365
|
declare const isTypeDeclaration: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
|
|
2357
2366
|
declare const isLeftHandSideExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression;
|
|
2358
2367
|
declare const isLeftHandSideExpressionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression | TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSTypeAssertion;
|
|
2359
|
-
declare const
|
|
2368
|
+
declare const isTsOnlyExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
2369
|
+
declare const isTsAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
2360
2370
|
|
|
2361
2371
|
declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
2362
2372
|
|
|
@@ -2407,6 +2417,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
2407
2417
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
2408
2418
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
2409
2419
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
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, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
2420
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTSAssertionExpression, type TSESTreeTSOnlyExpression, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignat
|
|
|
29
29
|
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;
|
|
30
30
|
type TSESTreeDestructuringPattern = TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
|
|
31
31
|
type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
|
|
32
|
+
type TSESTreeTSOnlyExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
|
|
33
|
+
type TSESTreeTSAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
32
34
|
|
|
33
35
|
type FunctionInitPath =
|
|
34
36
|
/**
|
|
@@ -138,6 +140,13 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
|
|
|
138
140
|
*/
|
|
139
141
|
declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
|
|
140
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Gets the ECMAScript expression from a TS expression.
|
|
145
|
+
* @param node The TS expression.
|
|
146
|
+
* @returns The ECMAScript expression within the TS expression.
|
|
147
|
+
*/
|
|
148
|
+
declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
|
|
149
|
+
|
|
141
150
|
/**
|
|
142
151
|
* Gets the static name of a function AST node. For function declarations it is
|
|
143
152
|
* easy. For anonymous function expressions it is much harder. If you search for
|
|
@@ -2356,7 +2365,8 @@ declare const isDestructuringPattern: (node: TSESTree$1.Node | null | undefined)
|
|
|
2356
2365
|
declare const isTypeDeclaration: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
|
|
2357
2366
|
declare const isLeftHandSideExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression;
|
|
2358
2367
|
declare const isLeftHandSideExpressionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression | TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSTypeAssertion;
|
|
2359
|
-
declare const
|
|
2368
|
+
declare const isTsOnlyExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
2369
|
+
declare const isTsAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
2360
2370
|
|
|
2361
2371
|
declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
2362
2372
|
|
|
@@ -2407,6 +2417,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
2407
2417
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
2408
2418
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
2409
2419
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
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, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
2420
|
+
export { type FunctionInitPath, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTSAssertionExpression, type TSESTreeTSOnlyExpression, type TSESTreeTypeDeclaration, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
|
package/dist/index.js
CHANGED
|
@@ -228,14 +228,27 @@ var isLeftHandSideExpressionType = isOneOf([
|
|
|
228
228
|
types.AST_NODE_TYPES.TSNonNullExpression,
|
|
229
229
|
types.AST_NODE_TYPES.TSTypeAssertion
|
|
230
230
|
]);
|
|
231
|
-
var
|
|
231
|
+
var isTsOnlyExpression = isOneOf([
|
|
232
|
+
types.AST_NODE_TYPES.TSAsExpression,
|
|
233
|
+
types.AST_NODE_TYPES.TSTypeAssertion,
|
|
234
|
+
types.AST_NODE_TYPES.TSNonNullExpression,
|
|
235
|
+
types.AST_NODE_TYPES.TSSatisfiesExpression,
|
|
236
|
+
types.AST_NODE_TYPES.TSInstantiationExpression
|
|
237
|
+
]);
|
|
238
|
+
var isTsAssertionExpression = isOneOf([
|
|
232
239
|
types.AST_NODE_TYPES.TSAsExpression,
|
|
233
240
|
types.AST_NODE_TYPES.TSTypeAssertion,
|
|
234
241
|
types.AST_NODE_TYPES.TSNonNullExpression,
|
|
235
242
|
types.AST_NODE_TYPES.TSSatisfiesExpression
|
|
236
243
|
]);
|
|
237
244
|
|
|
238
|
-
// src/get-
|
|
245
|
+
// src/get-ecma-expression.ts
|
|
246
|
+
function getEcmaExpression(node) {
|
|
247
|
+
if (isTsOnlyExpression(node)) {
|
|
248
|
+
return getEcmaExpression(node.expression);
|
|
249
|
+
}
|
|
250
|
+
return node;
|
|
251
|
+
}
|
|
239
252
|
function getFunctionIdentifier(node) {
|
|
240
253
|
switch (true) {
|
|
241
254
|
// function MaybeComponent() {}
|
|
@@ -264,7 +277,7 @@ function getFunctionIdentifier(node) {
|
|
|
264
277
|
// const MaybeComponent = (() => {})!;
|
|
265
278
|
// const MaybeComponent = (() => {}) as FunctionComponent;
|
|
266
279
|
// const MaybeComponent = (() => {}) satisfies FunctionComponent;
|
|
267
|
-
case
|
|
280
|
+
case isTsAssertionExpression(node.parent):
|
|
268
281
|
return getFunctionIdentifier(node.parent);
|
|
269
282
|
}
|
|
270
283
|
return eff._;
|
|
@@ -537,8 +550,7 @@ var isNodeEqual = eff.dual(2, (a, b) => {
|
|
|
537
550
|
}
|
|
538
551
|
});
|
|
539
552
|
function isThisExpression(node) {
|
|
540
|
-
|
|
541
|
-
return node.type === types.AST_NODE_TYPES.ThisExpression;
|
|
553
|
+
return getEcmaExpression(node).type === types.AST_NODE_TYPES.ThisExpression;
|
|
542
554
|
}
|
|
543
555
|
function toReadableNodeName(node, getText) {
|
|
544
556
|
switch (node.type) {
|
|
@@ -575,16 +587,9 @@ function toReadableNodeType(node) {
|
|
|
575
587
|
return stringTs.toLowerCase(stringTs.delimiterCase(node.type, " "));
|
|
576
588
|
}
|
|
577
589
|
|
|
578
|
-
// src/unwrap-type-expression.ts
|
|
579
|
-
function unwrapTypeExpression(node) {
|
|
580
|
-
if (isTypeExpression(node)) {
|
|
581
|
-
return unwrapTypeExpression(node.expression);
|
|
582
|
-
}
|
|
583
|
-
return node;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
590
|
exports.findParentNode = findParentNode;
|
|
587
591
|
exports.getClassIdentifier = getClassIdentifier;
|
|
592
|
+
exports.getEcmaExpression = getEcmaExpression;
|
|
588
593
|
exports.getFunctionIdentifier = getFunctionIdentifier;
|
|
589
594
|
exports.getFunctionInitPath = getFunctionInitPath;
|
|
590
595
|
exports.getLiteralValueType = getLiteralValueType;
|
|
@@ -620,8 +625,8 @@ exports.isNodeEqual = isNodeEqual;
|
|
|
620
625
|
exports.isOneOf = isOneOf;
|
|
621
626
|
exports.isProperty = isProperty;
|
|
622
627
|
exports.isThisExpression = isThisExpression;
|
|
628
|
+
exports.isTsAssertionExpression = isTsAssertionExpression;
|
|
629
|
+
exports.isTsOnlyExpression = isTsOnlyExpression;
|
|
623
630
|
exports.isTypeDeclaration = isTypeDeclaration;
|
|
624
|
-
exports.isTypeExpression = isTypeExpression;
|
|
625
631
|
exports.toReadableNodeName = toReadableNodeName;
|
|
626
632
|
exports.toReadableNodeType = toReadableNodeType;
|
|
627
|
-
exports.unwrapTypeExpression = unwrapTypeExpression;
|
package/dist/index.mjs
CHANGED
|
@@ -226,14 +226,27 @@ var isLeftHandSideExpressionType = isOneOf([
|
|
|
226
226
|
AST_NODE_TYPES.TSNonNullExpression,
|
|
227
227
|
AST_NODE_TYPES.TSTypeAssertion
|
|
228
228
|
]);
|
|
229
|
-
var
|
|
229
|
+
var isTsOnlyExpression = isOneOf([
|
|
230
|
+
AST_NODE_TYPES.TSAsExpression,
|
|
231
|
+
AST_NODE_TYPES.TSTypeAssertion,
|
|
232
|
+
AST_NODE_TYPES.TSNonNullExpression,
|
|
233
|
+
AST_NODE_TYPES.TSSatisfiesExpression,
|
|
234
|
+
AST_NODE_TYPES.TSInstantiationExpression
|
|
235
|
+
]);
|
|
236
|
+
var isTsAssertionExpression = isOneOf([
|
|
230
237
|
AST_NODE_TYPES.TSAsExpression,
|
|
231
238
|
AST_NODE_TYPES.TSTypeAssertion,
|
|
232
239
|
AST_NODE_TYPES.TSNonNullExpression,
|
|
233
240
|
AST_NODE_TYPES.TSSatisfiesExpression
|
|
234
241
|
]);
|
|
235
242
|
|
|
236
|
-
// src/get-
|
|
243
|
+
// src/get-ecma-expression.ts
|
|
244
|
+
function getEcmaExpression(node) {
|
|
245
|
+
if (isTsOnlyExpression(node)) {
|
|
246
|
+
return getEcmaExpression(node.expression);
|
|
247
|
+
}
|
|
248
|
+
return node;
|
|
249
|
+
}
|
|
237
250
|
function getFunctionIdentifier(node) {
|
|
238
251
|
switch (true) {
|
|
239
252
|
// function MaybeComponent() {}
|
|
@@ -262,7 +275,7 @@ function getFunctionIdentifier(node) {
|
|
|
262
275
|
// const MaybeComponent = (() => {})!;
|
|
263
276
|
// const MaybeComponent = (() => {}) as FunctionComponent;
|
|
264
277
|
// const MaybeComponent = (() => {}) satisfies FunctionComponent;
|
|
265
|
-
case
|
|
278
|
+
case isTsAssertionExpression(node.parent):
|
|
266
279
|
return getFunctionIdentifier(node.parent);
|
|
267
280
|
}
|
|
268
281
|
return _;
|
|
@@ -535,8 +548,7 @@ var isNodeEqual = dual(2, (a, b) => {
|
|
|
535
548
|
}
|
|
536
549
|
});
|
|
537
550
|
function isThisExpression(node) {
|
|
538
|
-
|
|
539
|
-
return node.type === AST_NODE_TYPES.ThisExpression;
|
|
551
|
+
return getEcmaExpression(node).type === AST_NODE_TYPES.ThisExpression;
|
|
540
552
|
}
|
|
541
553
|
function toReadableNodeName(node, getText) {
|
|
542
554
|
switch (node.type) {
|
|
@@ -573,12 +585,4 @@ function toReadableNodeType(node) {
|
|
|
573
585
|
return toLowerCase(delimiterCase(node.type, " "));
|
|
574
586
|
}
|
|
575
587
|
|
|
576
|
-
|
|
577
|
-
function unwrapTypeExpression(node) {
|
|
578
|
-
if (isTypeExpression(node)) {
|
|
579
|
-
return unwrapTypeExpression(node.expression);
|
|
580
|
-
}
|
|
581
|
-
return node;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
export { findParentNode, getClassIdentifier, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType, unwrapTypeExpression };
|
|
588
|
+
export { findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKeyLiteralLike, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.28.1-next.
|
|
3
|
+
"version": "1.28.1-next.4",
|
|
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.25.0",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
42
|
"ts-pattern": "^5.6.2",
|
|
43
|
-
"@eslint-react/eff": "1.28.1-next.
|
|
43
|
+
"@eslint-react/eff": "1.28.1-next.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.4.0",
|