@@ -33,7 +33,7 @@ export default function a11y(
3333 if ( name . startsWith ( 'aria-' ) ) {
3434 if ( invisibleElements . has ( node . name ) ) {
3535 // aria-unsupported-elements
36- validator . warn ( `A11y: <${ node . name } > should not have aria-* attributes` , attribute . start ) ;
36+ validator . warn ( `A11y: <${ node . name } > should not have aria-* attributes` , attribute ) ;
3737 }
3838
3939 const type = name . slice ( 5 ) ;
@@ -42,15 +42,15 @@ export default function a11y(
4242 let message = `A11y: Unknown aria attribute 'aria-${ type } '` ;
4343 if ( match ) message += ` (did you mean '${ match } '?)` ;
4444
45- validator . warn ( message , attribute . start ) ;
45+ validator . warn ( message , attribute ) ;
4646 }
4747 }
4848
4949 // aria-role
5050 if ( name === 'role' ) {
5151 if ( invisibleElements . has ( node . name ) ) {
5252 // aria-unsupported-elements
53- validator . warn ( `A11y: <${ node . name } > should not have role attribute` , attribute . start ) ;
53+ validator . warn ( `A11y: <${ node . name } > should not have role attribute` , attribute ) ;
5454 }
5555
5656 const value = getStaticAttributeValue ( node , 'role' ) ;
@@ -59,30 +59,30 @@ export default function a11y(
5959 let message = `A11y: Unknown role '${ value } '` ;
6060 if ( match ) message += ` (did you mean '${ match } '?)` ;
6161
62- validator . warn ( message , attribute . start ) ;
62+ validator . warn ( message , attribute ) ;
6363 }
6464 }
6565
6666 // no-access-key
6767 if ( name === 'accesskey' ) {
68- validator . warn ( `A11y: Avoid using accesskey` , attribute . start ) ;
68+ validator . warn ( `A11y: Avoid using accesskey` , attribute ) ;
6969 }
7070
7171 // no-autofocus
7272 if ( name === 'autofocus' ) {
73- validator . warn ( `A11y: Avoid using autofocus` , attribute . start ) ;
73+ validator . warn ( `A11y: Avoid using autofocus` , attribute ) ;
7474 }
7575
7676 // scope
7777 if ( name === 'scope' && node . name !== 'th' ) {
78- validator . warn ( `A11y: The scope attribute should only be used with <th> elements` , attribute . start ) ;
78+ validator . warn ( `A11y: The scope attribute should only be used with <th> elements` , attribute ) ;
7979 }
8080
8181 // tabindex-no-positive
8282 if ( name === 'tabindex' ) {
8383 const value = getStaticAttributeValue ( node , 'tabindex' ) ;
8484 if ( ! isNaN ( value ) && + value > 0 ) {
85- validator . warn ( `A11y: avoid tabindex values above zero` , attribute . start ) ;
85+ validator . warn ( `A11y: avoid tabindex values above zero` , attribute ) ;
8686 }
8787 }
8888
@@ -96,21 +96,21 @@ export default function a11y(
9696 attributes . slice ( 0 , - 1 ) . join ( ', ' ) + ` or ${ attributes [ attributes . length - 1 ] } ` :
9797 attributes [ 0 ] ;
9898
99- validator . warn ( `A11y: <${ name } > element should have ${ article } ${ sequence } attribute` , node . start ) ;
99+ validator . warn ( `A11y: <${ name } > element should have ${ article } ${ sequence } attribute` , node ) ;
100100 }
101101 }
102102
103103 function shouldHaveContent ( ) {
104104 if ( node . children . length === 0 ) {
105- validator . warn ( `A11y: <${ node . name } > element should have child content` , node . start ) ;
105+ validator . warn ( `A11y: <${ node . name } > element should have child content` , node ) ;
106106 }
107107 }
108108
109109 function shouldHaveValidHref ( attribute ) {
110110 const href = attributeMap . get ( attribute ) ;
111111 const value = getStaticAttributeValue ( node , attribute ) ;
112112 if ( value === '' || value === '#' ) {
113- validator . warn ( `A11y: '${ value } ' is not a valid ${ attribute } attribute` , href . start ) ;
113+ validator . warn ( `A11y: '${ value } ' is not a valid ${ attribute } attribute` , href ) ;
114114 }
115115 }
116116
@@ -122,7 +122,7 @@ export default function a11y(
122122 // anchor-in-svg-is-valid
123123 shouldHaveValidHref ( 'xlink:href' )
124124 } else {
125- validator . warn ( `A11y: <a> element should have an href attribute` , node . start ) ;
125+ validator . warn ( `A11y: <a> element should have an href attribute` , node ) ;
126126 }
127127
128128 // anchor-has-content
@@ -141,7 +141,7 @@ export default function a11y(
141141 shouldHaveContent ( ) ;
142142
143143 if ( attributeMap . has ( 'aria-hidden' ) ) {
144- validator . warn ( `A11y: <${ node . name } > element should not be hidden` , attributeMap . get ( 'aria-hidden' ) . start ) ;
144+ validator . warn ( `A11y: <${ node . name } > element should not be hidden` , attributeMap . get ( 'aria-hidden' ) ) ;
145145 }
146146 }
147147
@@ -157,14 +157,14 @@ export default function a11y(
157157
158158 // no-distracting-elements
159159 if ( node . name === 'marquee' || node . name === 'blink' ) {
160- validator . warn ( `A11y: Avoid <${ node . name } > elements` , node . start ) ;
160+ validator . warn ( `A11y: Avoid <${ node . name } > elements` , node ) ;
161161 }
162162
163163 if ( node . name === 'figcaption' ) {
164164 const parent = elementStack [ elementStack . length - 1 ] ;
165165 if ( parent ) {
166166 if ( parent . name !== 'figure' ) {
167- validator . warn ( `A11y: <figcaption> must be an immediate child of <figure>` , node . start ) ;
167+ validator . warn ( `A11y: <figcaption> must be an immediate child of <figure>` , node ) ;
168168 } else {
169169 const children = parent . children . filter ( node => {
170170 if ( node . type === 'Comment' ) return false ;
@@ -175,7 +175,7 @@ export default function a11y(
175175 const index = children . indexOf ( node ) ;
176176
177177 if ( index !== 0 && index !== children . length - 1 ) {
178- validator . warn ( `A11y: <figcaption> must be first or last child of <figure>` , node . start ) ;
178+ validator . warn ( `A11y: <figcaption> must be first or last child of <figure>` , node ) ;
179179 }
180180 }
181181 }
0 commit comments