@eslint-react/ast 1.30.2 → 1.30.3-beta.1

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 CHANGED
@@ -28,8 +28,8 @@ type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignat
28
28
  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;
29
29
  type TSESTreeDestructuringPattern = TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
30
30
  type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
31
- type TSESTreeTSOnlyExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
32
- type TSESTreeTSAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
31
+ type TSESTreeTypeExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
32
+ type TSESTreeTypeAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
33
33
 
34
34
  type FunctionInitPath =
35
35
  /**
@@ -140,11 +140,11 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
140
140
  declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
141
141
 
142
142
  /**
143
- * Recursively get the inner expression until it's not a TSOnlyExpression
143
+ * Recursively get the inner expression until it's not a TypeExpression
144
144
  * @param node - The node to get the expression from
145
145
  * @returns The inner expression
146
146
  */
147
- declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
147
+ declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
148
148
 
149
149
  /**
150
150
  * Gets the static name of a function AST node. For function declarations it is
@@ -194,6 +194,8 @@ declare function getNestedIdentifiers(node: TSESTree.Node): readonly TSESTree.Id
194
194
  */
195
195
  declare function getNestedReturnStatements(node: TSESTree.Node): readonly TSESTree.ReturnStatement[];
196
196
 
197
+ declare function getPropertyName(node: TSESTree.Node): string | _;
198
+
197
199
  declare function getTopLevelIdentifier(node: TSESTree.Node): TSESTree.Identifier | _;
198
200
 
199
201
  declare const is: <NodeType extends AST_NODE_TYPES$1>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
@@ -219,8 +221,8 @@ declare const isDestructuringPattern: (node: TSESTree$1.Node | null | undefined)
219
221
  declare const isTypeDeclaration: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
220
222
  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;
221
223
  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;
222
- 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;
223
- declare const isTsAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
224
+ declare const isTypeExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
225
+ declare const isTypeAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
224
226
 
225
227
  declare function isEmptyFunction(node: TSESTreeFunction): boolean;
226
228
 
@@ -269,4 +271,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
269
271
  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";
270
272
  type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
271
273
 
272
- 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, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
274
+ export { type FunctionInitPath, type ReadableNodeType, 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, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/dist/index.d.ts CHANGED
@@ -28,8 +28,8 @@ type TSESTreeProperty = TSESTree$1.PropertyDefinition | TSESTree$1.TSIndexSignat
28
28
  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;
29
29
  type TSESTreeDestructuringPattern = TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
30
30
  type TSESTreeTypeDeclaration = TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
31
- type TSESTreeTSOnlyExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
32
- type TSESTreeTSAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
31
+ type TSESTreeTypeExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion | TSESTree$1.TSInstantiationExpression;
32
+ type TSESTreeTypeAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
33
33
 
34
34
  type FunctionInitPath =
35
35
  /**
@@ -140,11 +140,11 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
140
140
  declare function getClassIdentifier(node: TSESTreeClass): TSESTree.Identifier | _;
141
141
 
142
142
  /**
143
- * Recursively get the inner expression until it's not a TSOnlyExpression
143
+ * Recursively get the inner expression until it's not a TypeExpression
144
144
  * @param node - The node to get the expression from
145
145
  * @returns The inner expression
146
146
  */
147
- declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTSOnlyExpression>;
147
+ declare function getEcmaExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
148
148
 
149
149
  /**
150
150
  * Gets the static name of a function AST node. For function declarations it is
@@ -194,6 +194,8 @@ declare function getNestedIdentifiers(node: TSESTree.Node): readonly TSESTree.Id
194
194
  */
195
195
  declare function getNestedReturnStatements(node: TSESTree.Node): readonly TSESTree.ReturnStatement[];
196
196
 
197
+ declare function getPropertyName(node: TSESTree.Node): string | _;
198
+
197
199
  declare function getTopLevelIdentifier(node: TSESTree.Node): TSESTree.Identifier | _;
198
200
 
199
201
  declare const is: <NodeType extends AST_NODE_TYPES$1>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
@@ -219,8 +221,8 @@ declare const isDestructuringPattern: (node: TSESTree$1.Node | null | undefined)
219
221
  declare const isTypeDeclaration: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
220
222
  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;
221
223
  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;
222
- 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;
223
- declare const isTsAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
224
+ declare const isTypeExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
225
+ declare const isTypeAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
224
226
 
225
227
  declare function isEmptyFunction(node: TSESTreeFunction): boolean;
226
228
 
@@ -269,4 +271,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
269
271
  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";
270
272
  type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
271
273
 
272
- 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, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
274
+ export { type FunctionInitPath, type ReadableNodeType, 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, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/dist/index.js CHANGED
@@ -192,14 +192,14 @@ var isLeftHandSideExpressionType = isOneOf([
192
192
  types.AST_NODE_TYPES.TSNonNullExpression,
193
193
  types.AST_NODE_TYPES.TSTypeAssertion
194
194
  ]);
195
- var isTsOnlyExpression = isOneOf([
195
+ var isTypeExpression = isOneOf([
196
196
  types.AST_NODE_TYPES.TSAsExpression,
197
197
  types.AST_NODE_TYPES.TSTypeAssertion,
198
198
  types.AST_NODE_TYPES.TSNonNullExpression,
199
199
  types.AST_NODE_TYPES.TSSatisfiesExpression,
200
200
  types.AST_NODE_TYPES.TSInstantiationExpression
201
201
  ]);
202
- var isTsAssertionExpression = isOneOf([
202
+ var isTypeAssertionExpression = isOneOf([
203
203
  types.AST_NODE_TYPES.TSAsExpression,
204
204
  types.AST_NODE_TYPES.TSTypeAssertion,
205
205
  types.AST_NODE_TYPES.TSNonNullExpression,
@@ -208,7 +208,7 @@ var isTsAssertionExpression = isOneOf([
208
208
 
209
209
  // src/get-ecma-expression.ts
210
210
  function getEcmaExpression(node) {
211
- if (isTsOnlyExpression(node)) {
211
+ if (isTypeExpression(node)) {
212
212
  return getEcmaExpression(node.expression);
213
213
  }
214
214
  return node;
@@ -241,7 +241,7 @@ function getFunctionIdentifier(node) {
241
241
  // const MaybeComponent = (() => {})!;
242
242
  // const MaybeComponent = (() => {}) as FunctionComponent;
243
243
  // const MaybeComponent = (() => {}) satisfies FunctionComponent;
244
- case isTsAssertionExpression(node.parent):
244
+ case isTypeAssertionExpression(node.parent):
245
245
  return getFunctionIdentifier(node.parent);
246
246
  }
247
247
  return eff._;
@@ -417,6 +417,21 @@ function getNestedReturnStatements(node) {
417
417
  });
418
418
  return returnStatements;
419
419
  }
420
+ function getPropertyName(node) {
421
+ if (isTypeExpression(node)) {
422
+ return getPropertyName(getEcmaExpression(node));
423
+ }
424
+ if (node.type === types.AST_NODE_TYPES.Identifier || node.type === types.AST_NODE_TYPES.PrivateIdentifier) {
425
+ return node.name;
426
+ }
427
+ if (node.type === types.AST_NODE_TYPES.Literal) {
428
+ return String(node.value);
429
+ }
430
+ if (node.type === types.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
431
+ return node.quasis[0]?.value.raw;
432
+ }
433
+ return eff._;
434
+ }
420
435
  function getTopLevelIdentifier(node) {
421
436
  switch (node.type) {
422
437
  case types.AST_NODE_TYPES.Identifier:
@@ -516,6 +531,7 @@ function toReadableNodeName(node, getText) {
516
531
  case types.AST_NODE_TYPES.CallExpression:
517
532
  return toReadableNodeName(node.callee, getText);
518
533
  case types.AST_NODE_TYPES.Identifier:
534
+ case types.AST_NODE_TYPES.PrivateIdentifier:
519
535
  return node.name;
520
536
  case types.AST_NODE_TYPES.JSXIdentifier:
521
537
  return `<${node.name}>`;
@@ -557,6 +573,7 @@ exports.getNestedExpressionsOfType = getNestedExpressionsOfType;
557
573
  exports.getNestedIdentifiers = getNestedIdentifiers;
558
574
  exports.getNestedNewExpressions = getNestedNewExpressions;
559
575
  exports.getNestedReturnStatements = getNestedReturnStatements;
576
+ exports.getPropertyName = getPropertyName;
560
577
  exports.getTopLevelIdentifier = getTopLevelIdentifier;
561
578
  exports.hasCallInFunctionInitPath = hasCallInFunctionInitPath;
562
579
  exports.is = is;
@@ -583,8 +600,8 @@ exports.isNodeEqual = isNodeEqual;
583
600
  exports.isOneOf = isOneOf;
584
601
  exports.isProperty = isProperty;
585
602
  exports.isThisExpression = isThisExpression;
586
- exports.isTsAssertionExpression = isTsAssertionExpression;
587
- exports.isTsOnlyExpression = isTsOnlyExpression;
603
+ exports.isTypeAssertionExpression = isTypeAssertionExpression;
588
604
  exports.isTypeDeclaration = isTypeDeclaration;
605
+ exports.isTypeExpression = isTypeExpression;
589
606
  exports.toReadableNodeName = toReadableNodeName;
590
607
  exports.toReadableNodeType = toReadableNodeType;
package/dist/index.mjs CHANGED
@@ -190,14 +190,14 @@ var isLeftHandSideExpressionType = isOneOf([
190
190
  AST_NODE_TYPES.TSNonNullExpression,
191
191
  AST_NODE_TYPES.TSTypeAssertion
192
192
  ]);
193
- var isTsOnlyExpression = isOneOf([
193
+ var isTypeExpression = isOneOf([
194
194
  AST_NODE_TYPES.TSAsExpression,
195
195
  AST_NODE_TYPES.TSTypeAssertion,
196
196
  AST_NODE_TYPES.TSNonNullExpression,
197
197
  AST_NODE_TYPES.TSSatisfiesExpression,
198
198
  AST_NODE_TYPES.TSInstantiationExpression
199
199
  ]);
200
- var isTsAssertionExpression = isOneOf([
200
+ var isTypeAssertionExpression = isOneOf([
201
201
  AST_NODE_TYPES.TSAsExpression,
202
202
  AST_NODE_TYPES.TSTypeAssertion,
203
203
  AST_NODE_TYPES.TSNonNullExpression,
@@ -206,7 +206,7 @@ var isTsAssertionExpression = isOneOf([
206
206
 
207
207
  // src/get-ecma-expression.ts
208
208
  function getEcmaExpression(node) {
209
- if (isTsOnlyExpression(node)) {
209
+ if (isTypeExpression(node)) {
210
210
  return getEcmaExpression(node.expression);
211
211
  }
212
212
  return node;
@@ -239,7 +239,7 @@ function getFunctionIdentifier(node) {
239
239
  // const MaybeComponent = (() => {})!;
240
240
  // const MaybeComponent = (() => {}) as FunctionComponent;
241
241
  // const MaybeComponent = (() => {}) satisfies FunctionComponent;
242
- case isTsAssertionExpression(node.parent):
242
+ case isTypeAssertionExpression(node.parent):
243
243
  return getFunctionIdentifier(node.parent);
244
244
  }
245
245
  return _;
@@ -415,6 +415,21 @@ function getNestedReturnStatements(node) {
415
415
  });
416
416
  return returnStatements;
417
417
  }
418
+ function getPropertyName(node) {
419
+ if (isTypeExpression(node)) {
420
+ return getPropertyName(getEcmaExpression(node));
421
+ }
422
+ if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) {
423
+ return node.name;
424
+ }
425
+ if (node.type === AST_NODE_TYPES.Literal) {
426
+ return String(node.value);
427
+ }
428
+ if (node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
429
+ return node.quasis[0]?.value.raw;
430
+ }
431
+ return _;
432
+ }
418
433
  function getTopLevelIdentifier(node) {
419
434
  switch (node.type) {
420
435
  case AST_NODE_TYPES.Identifier:
@@ -514,6 +529,7 @@ function toReadableNodeName(node, getText) {
514
529
  case AST_NODE_TYPES.CallExpression:
515
530
  return toReadableNodeName(node.callee, getText);
516
531
  case AST_NODE_TYPES.Identifier:
532
+ case AST_NODE_TYPES.PrivateIdentifier:
517
533
  return node.name;
518
534
  case AST_NODE_TYPES.JSXIdentifier:
519
535
  return `<${node.name}>`;
@@ -544,4 +560,4 @@ function toReadableNodeType(node) {
544
560
  return toLowerCase(delimiterCase(node.type, " "));
545
561
  }
546
562
 
547
- 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, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTsAssertionExpression, isTsOnlyExpression, isTypeDeclaration, toReadableNodeName, toReadableNodeType };
563
+ export { findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMapCallLoose, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "1.30.2",
3
+ "version": "1.30.3-beta.1",
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.26.0",
41
41
  "string-ts": "^2.2.1",
42
42
  "ts-pattern": "^5.6.2",
43
- "@eslint-react/eff": "1.30.2"
43
+ "@eslint-react/eff": "1.30.3-beta.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "tsup": "^8.4.0",