Skip to content

Commit 54a3b70

Browse files
authored
Release 1.7.0 (#421)
1 parent 1f8db1d commit 54a3b70

File tree

4 files changed

+104
-4
lines changed

4 files changed

+104
-4
lines changed

src/docs/guide/usage/linter/generated-rules.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The progress of all rule implementations is tracked [here](https://github.com/oxc-project/oxc/issues/481).
44

5-
- Total number of rules: 524
5+
- Total number of rules: 525
66
- Rules turned on by default: 123
77

88
**Legend for 'Fixable?' column:**
@@ -13,7 +13,7 @@ The progress of all rule implementations is tracked [here](https://github.com/ox
1313
- ⚠️💡: a dangerous suggestion is available for this rule
1414
- 🚧: an auto-fix or suggestion is possible, but currently not implemented
1515

16-
## Correctness (176):
16+
## Correctness (177):
1717

1818
Code that is outright wrong or useless.
1919

@@ -130,6 +130,7 @@ Code that is outright wrong or useless.
130130
| [no-duplicate-head](/docs/guide/usage/linter/rules/nextjs/no-duplicate-head.html) | nextjs || |
131131
| [no-head-element](/docs/guide/usage/linter/rules/nextjs/no-head-element.html) | nextjs || |
132132
| [no-head-import-in-document](/docs/guide/usage/linter/rules/nextjs/no-head-import-in-document.html) | nextjs || |
133+
| [no-html-link-for-pages](/docs/guide/usage/linter/rules/nextjs/no-html-link-for-pages.html) | nextjs || |
133134
| [no-img-element](/docs/guide/usage/linter/rules/nextjs/no-img-element.html) | nextjs || 🚧 |
134135
| [no-page-custom-font](/docs/guide/usage/linter/rules/nextjs/no-page-custom-font.html) | nextjs || |
135136
| [no-script-component-in-head](/docs/guide/usage/linter/rules/nextjs/no-script-component-in-head.html) | nextjs || |
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!-- This file is auto-generated by tasks/website/src/linter/rules/doc_page.rs. Do not edit it manually. -->
2+
3+
<script setup>
4+
import { data } from '../version.data.js';
5+
const source = `https://github.com/oxc-project/oxc/blob/${ data }/crates/oxc_linter/src/rules/nextjs/no_html_link_for_pages.rs`;
6+
</script>
7+
8+
# nextjs/no-html-link-for-pages <Badge type="info" text="Correctness" />
9+
10+
<div class="rule-meta">
11+
<Alert class="default-on" type="success">
12+
<span class="emoji">✅</span> This rule is turned on by default.
13+
</Alert>
14+
</div>
15+
16+
### What it does
17+
18+
Prevents the usage of `<a>` elements to navigate between Next.js pages.
19+
20+
### Why is this bad?
21+
22+
Using `<a>` elements for internal navigation in Next.js applications can cause:
23+
24+
- Full page reloads instead of client-side navigation
25+
- Loss of application state
26+
- Slower navigation performance
27+
- Broken prefetching capabilities
28+
29+
Next.js provides the `<Link />` component from `next/link` for client-side navigation
30+
between pages, which provides better performance and user experience.
31+
32+
### Examples
33+
34+
Examples of **incorrect** code for this rule:
35+
36+
```jsx
37+
function HomePage() {
38+
return (
39+
<div>
40+
<a href="/about">About Us</a>
41+
<a href="/contact">Contact</a>
42+
</div>
43+
);
44+
}
45+
```
46+
47+
Examples of **correct** code for this rule:
48+
49+
```jsx
50+
import Link from "next/link";
51+
52+
function HomePage() {
53+
return (
54+
<div>
55+
<Link href="/about">About Us</Link>
56+
<Link href="/contact">Contact</Link>
57+
</div>
58+
);
59+
}
60+
```
61+
62+
External links are allowed:
63+
64+
```jsx
65+
function HomePage() {
66+
return (
67+
<div>
68+
<a href="https://example.com">External Link</a>
69+
<a href="mailto:[email protected]">Email</a>
70+
<a href="tel:+1234567890">Phone</a>
71+
</div>
72+
);
73+
}
74+
```
75+
76+
## How to use
77+
78+
To **enable** this rule in the CLI or using the config file, you can use:
79+
80+
::: code-group
81+
82+
```bash [CLI]
83+
oxlint --deny nextjs/no-html-link-for-pages --nextjs-plugin
84+
```
85+
86+
```json [Config (.oxlintrc.json)]
87+
{
88+
"plugins": ["nextjs"],
89+
"rules": {
90+
"nextjs/no-html-link-for-pages": "error"
91+
}
92+
}
93+
```
94+
95+
:::
96+
97+
## References
98+
99+
- <a v-bind:href="source" target="_blank" rel="noreferrer">Rule Source</a>

src/docs/guide/usage/linter/rules/nextjs/no-script-component-in-head.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Prevent usage of `next/script` in `next/head` component.
2020
### Why is this bad?
2121

2222
The `next/script` component should not be used in a `next/head` component.
23-
Instead move the`<Script />`component outside of`<Head>` instead.
23+
Instead move the `<Script />` component outside of `<Head>` instead.
2424

2525
### Examples
2626

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
22
load() {
3-
return "54cf5cb2536e9f9c1d00c259d04fc4bcf0007683";
3+
return "21e8f0a6a37f336c4a4976c308205e1cda504e5b";
44
},
55
};

0 commit comments

Comments
 (0)