File tree Expand file tree Collapse file tree 4 files changed +39
-55
lines changed
crates/biome_js_analyze/tests/specs/nursery/noHtmlLinkForPages Expand file tree Collapse file tree 4 files changed +39
-55
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,9 @@ export const Page = () => {
2626
2727export const Page = ( ) => {
2828 return (
29- < div >
29+ < >
3030 < a href = './photo' > Photo</ a >
31- </ div >
32- ) ;
33- }
34-
35- export const Page = ( ) => {
36- return (
37- < div >
3831 < a href = '../photo' > Photo</ a >
39- </ div >
32+ </ >
4033 ) ;
4134}
Original file line number Diff line number Diff line change @@ -32,17 +32,10 @@ export const Page = () => {
3232
3333export const Page = () => {
3434 return (
35- <div >
35+ <>
3636 <a href = ' ./photo' >Photo</a >
37- </div >
38- );
39- }
40-
41- export const Page = () => {
42- return (
43- <div >
4437 <a href = ' ../photo' >Photo</a >
45- </div >
38+ < / >
4639 );
4740}
4841
@@ -139,11 +132,11 @@ invalid.jsx:30:7 lint/nursery/noHtmlLinkForPages ━━━━━━━━━━
139132 ! <a > element has an internal link to ./photo.
140133
141134 28 │ return (
142- 29 │ <div >
135+ 29 │ <>
143136 > 30 │ <a href = ' ./photo' >Photo</a >
144137 │ ^^^^^^^^^^^^^^^^^^
145- 31 │ </ div >
146- 32 │ );
138+ 31 │ < a href = ' ../photo ' >Photo</ a >
139+ 32 │ </>
147140
148141 i <a > elements for internal navigation can cause unnecessary full-page reloads. Use next/link component instead.
149142
@@ -155,16 +148,16 @@ invalid.jsx:30:7 lint/nursery/noHtmlLinkForPages ━━━━━━━━━━
155148```
156149
157150```
158- invalid.jsx:38 :7 lint/nursery/noHtmlLinkForPages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
151+ invalid.jsx:31 :7 lint/nursery/noHtmlLinkForPages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
159152
160153 ! <a > element has an internal link to ../photo.
161154
162- 36 │ return (
163- 37 │ < div >
164- > 38 │ <a href = ' ../photo' >Photo</a >
155+ 29 │ <>
156+ 30 │ < a href = ' ./photo ' >Photo</ a >
157+ > 31 │ <a href = ' ../photo' >Photo</a >
165158 │ ^^^^^^^^^^^^^^^^^^^
166- 39 │ </div >
167- 40 │ );
159+ 32 │ </>
160+ 33 │ );
168161
169162 i <a > elements for internal navigation can cause unnecessary full-page reloads. Use next/link component instead.
170163
Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ import Link from 'next/link';
44
55export const Page = ( ) => {
66 return (
7- < Link href = '/' >
8- < a > Homepage</ a >
9- </ Link >
7+ < a > Homepage</ a >
108 ) ;
119}
1210
@@ -24,7 +22,11 @@ export const Page = () => {
2422
2523export const Page = ( ) => {
2624 return (
27- < a href = 'https://example.com/' > Homepage</ a >
25+ < >
26+ < a href = 'https://example.com/' > Homepage</ a >
27+ < a href = 'http://example.com/' > Homepage</ a >
28+ < a href = '//example.com/' > Homepage</ a >
29+ </ >
2830 ) ;
2931}
3032
@@ -51,21 +53,18 @@ export const Page = () => {
5153
5254export const Page = ( ) => {
5355 return (
54- < Link href = './photo' > Photo</ Link >
55- ) ;
56- }
57-
58- export const Page = ( ) => {
59- return (
60- < Link href = '../photo' > Photo</ Link >
56+ < >
57+ < Link href = './photo' > Photo</ Link >
58+ < Link href = '../photo' > Photo</ Link >
59+ </ >
6160 ) ;
6261}
6362
6463export const Page = ( ) => {
6564 return (
66- < >
67- < a href = 'mailto:test@example.com' > Email</ a >
68- < a href = 'tel:+1234567890' > Phone</ a >
65+ < >
66+ < a href = 'mailto:test@example.com' > Email</ a >
67+ < a href = 'tel:+1234567890' > Phone</ a >
6968 </ >
7069 ) ;
7170}
Original file line number Diff line number Diff line change @@ -10,9 +10,7 @@ import Link from 'next/link';
1010
1111export const Page = () => {
1212 return (
13- <Link href = ' /' >
14- <a >Homepage</a >
15- </Link >
13+ <a >Homepage</a >
1614 );
1715}
1816
@@ -30,7 +28,11 @@ export const Page = () => {
3028
3129export const Page = () => {
3230 return (
33- <a href = ' https://example.com/' >Homepage</a >
31+ <>
32+ <a href = ' https://example.com/' >Homepage</a >
33+ <a href = ' http://example.com/' >Homepage</a >
34+ <a href = ' //example.com/' >Homepage</a >
35+ < / >
3436 );
3537}
3638
@@ -57,21 +59,18 @@ export const Page = () => {
5759
5860export const Page = () => {
5961 return (
60- <Link href = ' ./photo' >Photo</Link >
61- );
62- }
63-
64- export const Page = () => {
65- return (
66- <Link href = ' ../photo' >Photo</Link >
62+ <>
63+ <Link href = ' ./photo' >Photo</Link >
64+ <Link href = ' ../photo' >Photo</Link >
65+ < / >
6766 );
6867}
6968
7069export const Page = () => {
7170 return (
72- <>
73- <a href = ' mailto:test@example.com' >Email</a >
74- <a href = ' tel:+1234567890' >Phone</a >
71+ <>
72+ <a href = ' mailto:test@example.com' >Email</a >
73+ <a href = ' tel:+1234567890' >Phone</a >
7574 < / >
7675 );
7776}
You can’t perform that action at this time.
0 commit comments