@@ -213,10 +213,18 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
213213 ] as const satisfies VariantType [ ] ;
214214
215215 const services = ESLintUtils . getParserServices ( context , false ) ;
216- function getReportDescriptor ( node : TSESTree . Expression | _ ) : ReportDescriptor < MessageID > | _ {
216+ function getReportDescriptor (
217+ node :
218+ | _
219+ | TSESTree . Expression
220+ | TSESTree . JSXExpressionContainer
221+ | TSESTree . JSXExpressionContainer [ "expression" ] ,
222+ ) : ReportDescriptor < MessageID > | _ {
217223 if ( node == null ) return _ ;
224+ if ( AST . is ( T . JSXExpressionContainer ) ( node ) ) return getReportDescriptor ( node . expression ) ;
225+ if ( AST . isJSX ( node ) ) return _ ;
226+ if ( AST . isTypeExpression ( node ) ) return getReportDescriptor ( node . expression ) ;
218227 return match < typeof node , ReportDescriptor < MessageID > | _ > ( node )
219- . when ( AST . isJSX , ( ) => _ )
220228 . with ( { type : T . LogicalExpression , operator : "&&" } , ( { left, right } ) => {
221229 const isLeftUnaryNot = left . type === T . UnaryExpression && left . operator === "!" ;
222230 if ( isLeftUnaryNot ) {
@@ -260,10 +268,8 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
260268 } )
261269 . otherwise ( ( ) => _ ) ;
262270 }
263- const visitorFunction = flow ( getReportDescriptor , Report . make ( context ) . send ) ;
264271 return {
265- "JSXExpressionContainer > ConditionalExpression" : visitorFunction ,
266- "JSXExpressionContainer > LogicalExpression" : visitorFunction ,
272+ JSXExpressionContainer : flow ( getReportDescriptor , Report . make ( context ) . send ) ,
267273 } ;
268274}
269275
0 commit comments