44import { elementType } from "jsx-ast-utils" ;
55import { getPropValue } from "jsx-ast-utils" ;
66import { getProp } from "jsx-ast-utils" ;
7- import { hasNonEmptyProp } from "./hasNonEmptyProp" ;
87import { TSESLint } from "@typescript-eslint/utils" ;
98import { JSXOpeningElement } from "estree-jsx" ;
109import { TSESTree } from "@typescript-eslint/utils" ;
@@ -133,7 +132,9 @@ const hasAssociatedAriaText = (
133132 const varName = expr . name as string ;
134133 const src = getSourceText ( context ) ;
135134 const labelMatch = new RegExp ( `<(?:Label|label)[^>]*\\bid\\s*=\\s*\\{\\s*${ escapeForRegExp ( varName ) } \\s*\\}` , "i" ) . test ( src ) ;
136- const otherMatch = new RegExp ( `<(?:div|span|p|h[1-6])[^>]*\\bid\\s*=\\s*\\{\\s*${ escapeForRegExp ( varName ) } \\s*\\}` , "i" ) . test ( src ) ;
135+ const otherMatch = new RegExp ( `<(?:div|span|p|h[1-6])[^>]*\\bid\\s*=\\s*\\{\\s*${ escapeForRegExp ( varName ) } \\s*\\}` , "i" ) . test (
136+ src
137+ ) ;
137138 return labelMatch || otherMatch ;
138139 }
139140 }
@@ -142,11 +143,15 @@ const hasAssociatedAriaText = (
142143} ;
143144
144145/* thin wrappers kept for compatibility with existing callers */
145- const hasAssociatedLabelViaAriaLabelledBy = ( openingElement : TSESTree . JSXOpeningElement , context : TSESLint . RuleContext < string , unknown [ ] > ) =>
146- hasAssociatedAriaText ( openingElement , context , "aria-labelledby" ) ;
146+ const hasAssociatedLabelViaAriaLabelledBy = (
147+ openingElement : TSESTree . JSXOpeningElement ,
148+ context : TSESLint . RuleContext < string , unknown [ ] >
149+ ) => hasAssociatedAriaText ( openingElement , context , "aria-labelledby" ) ;
147150
148- const hasAssociatedLabelViaAriaDescribedby = ( openingElement : TSESTree . JSXOpeningElement , context : TSESLint . RuleContext < string , unknown [ ] > ) =>
149- hasAssociatedAriaText ( openingElement , context , "aria-describedby" ) ;
151+ const hasAssociatedLabelViaAriaDescribedby = (
152+ openingElement : TSESTree . JSXOpeningElement ,
153+ context : TSESLint . RuleContext < string , unknown [ ] >
154+ ) => hasAssociatedAriaText ( openingElement , context , "aria-describedby" ) ;
150155
151156/**
152157 * htmlFor / id relationship helper for controls (string + identifier fallback)
0 commit comments