+Enforce that all anchors are valid, and they are navigable elements.
+
Style
diff --git a/website/src/docs/lint/rules/useValidAnchor.md b/website/src/docs/lint/rules/useValidAnchor.md
new file mode 100644
index 00000000000..5a94a0dfd4c
--- /dev/null
+++ b/website/src/docs/lint/rules/useValidAnchor.md
@@ -0,0 +1,142 @@
+---
+title: Lint Rule useValidAnchor
+layout: layouts/rule.liquid
+---
+
+# useValidAnchor (since v10.0.0)
+
+Enforce that all anchors are valid, and they are navigable elements.
+
+The anchor element (``) - also called **hyperlink** - is an important element
+that allows users to navigate pages, in the same page, same website or on another website.
+
+While before it was possible to attach logic to an anchor element, with the advent of JSX libraries,
+it's now easier to attach logic to any HTML element, anchors included.
+
+This rule is designed to prevent users to attach logic at the click of anchors, and also makes
+sure that the `href` provided to the anchor element is valid. If the anchor has logic attached to it,
+the rules suggests to turn it to a `button`, because that's likely what the user wants.
+
+Anchor `` elements should be used for navigation, while `` should be
+used for user interaction.
+
+There are **many reasons** why an anchor should not have a logic and have a correct `href` attribute:
+
+- it can disrupt the correct flow of the user navigation e.g. a user that wants to open the link
+in another tab, but the default "click" behaviour is prevented;
+- it can source of invalid links, and [crawlers](https://en.wikipedia.org/wiki/Web_crawler) can't navigate the website, risking to penalise
+[SEO](https://en.wikipedia.org/wiki/Search_engine_optimization) ranking
+
+## Examples
+
+### Invalid
+
+```jsx
+navigate here
+```
+
+{% raw %}
nursery/useValidAnchor.js:1:10 lint/nursery/useValidAnchor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+⚠Provide a valid value for the attribute href.
+
+>1 │ <a href={null}>navigate here</a>
+ │ ^^^^
+ 2 │
+
+ℹThe href attribute should be a valid a URL
+
+ℹCheck this thorough explanation to better understand the context.
+
+
{% endraw %}
+
+```jsx
+navigate here
+```
+
+{% raw %}
nursery/useValidAnchor.js:1:10 lint/nursery/useValidAnchor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+⚠Provide a valid value for the attribute href.
+
+>1 │ <a href={undefined}>navigate here</a>
+ │ ^^^^^^^^^
+ 2 │
+
+ℹThe href attribute should be a valid a URL
+
+ℹCheck this thorough explanation to better understand the context.
+
+
{% endraw %}
+
+```jsx
+navigate here
+```
+
+{% raw %}
nursery/useValidAnchor.js:1:4 lint/nursery/useValidAnchor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+⚠The attribute href has to be assigned to a valid value.
+
+>1 │ <a href>navigate here</a>
+ │ ^^^^
+ 2 │
+
+ℹThe href attribute should be a valid a URL
+
+ℹCheck this thorough explanation to better understand the context.
+
+
{% endraw %}
+
+```jsx
+navigate here
+```
+
+{% raw %}
nursery/useValidAnchor.js:1:9 lint/nursery/useValidAnchor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+⚠Provide a valid value for the attribute href.
+
+>1 │ <a href="javascript:void(0)">navigate here</a>
+ │ ^^^^^^^^^^^^^^^^^^^^
+ 2 │
+
+ℹThe href attribute should be a valid a URL
+
+ℹCheck this thorough explanation to better understand the context.
+
+
{% endraw %}
+
+```jsx
+navigate here
+```
+
+{% raw %}
nursery/useValidAnchor.js:1:1 lint/nursery/useValidAnchor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+⚠Use a button element instead of an a element.
+
+>1 │ <a href="https://example.com" onClick={something}>navigate here</a>
+ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ 2 │
+
+ℹAnchor elements should only be used for default sections or page navigation
+
+ℹCheck this thorough explanation to better understand the context.
+
+
{% endraw %}
+
+### Valid
+
+```jsx
+<>
+ navigate here
+ navigate here
+>
+```
+
+## Accessibility guidelines
+
+[WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard)
+
+## Resources
+
+- [WebAIM - Introduction to Links and Hypertext](https://webaim.org/techniques/hypertext/)
+- [Links vs. Buttons in Modern Web Applications](https://marcysutton.com/links-vs-buttons-in-modern-web-applications/)
+- [Using ARIA - Notes on ARIA use in HTML](https://www.w3.org/TR/using-aria/#NOTES)
+
diff --git a/xtask/lintdoc/src/main.rs b/xtask/lintdoc/src/main.rs
index 82e0733814f..c7a390efcad 100644
--- a/xtask/lintdoc/src/main.rs
+++ b/xtask/lintdoc/src/main.rs
@@ -293,10 +293,17 @@ fn parse_documentation(
write!(content, "`{text}`")?;
}
- Event::Start(Tag::Link(kind, _, _)) => {
- assert_eq!(kind, LinkType::Inline, "unimplemented link type");
- write!(content, "[")?;
- }
+ Event::Start(Tag::Link(kind, _, _)) => match kind {
+ LinkType::Inline => {
+ write!(content, "[")?;
+ }
+ LinkType::Shortcut => {
+ write!(content, "[")?;
+ }
+ _ => {
+ panic!("unimplemented link type")
+ }
+ },
Event::End(Tag::Link(_, url, title)) => {
write!(content, "]({url}")?;
if !title.is_empty() {