-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESLint rule for using <Link> without <a> child and ensuring passHref is used #23713
Comments
Would this work with component libraries that expose custom components for anchor tags? For example, Chakra-UI has a |
@paambaati Yeah, that would be fine since it's using <Link href="#" passHref>
<ChakraLink>
// something
</ChakraLink>
<Link> This should show an error when you try to do this: <Link href="#">
<ChakraLink>
// something
</ChakraLink>
<Link> |
Yeah, I've been looking for this one for over a year now - at @upleveled our students will often use Up until now, we've just been reviewing their code and telling them to avoid this pattern, but we'd love to enable an ESLint rule! Especially when we get projects as large as this sometimes: https://github.com/uebriges/nextjstravelplaner |
Adds a lint rule warning to the Next.js ESLint plugin if `passHref=true` is not assigned for `<Link>` wrapping a custom component. Fixes #23713
Adds a lint rule warning to the Next.js ESLint plugin if `passHref=true` is not assigned for `<Link>` wrapping a custom component. Fixes vercel#23713
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the feature you'd like to request
Until the RFC for
<Link to="/route">
lands solving #5533, we should provide better guidance to users when they're doing something inaccessible.#8207
Describe the solution you'd like
If you use a
<Link>
without an<a>
child and don't usepassHref=true
, show a warning.Describe alternatives you've considered
N/A
The text was updated successfully, but these errors were encountered: