react-doctor/tanstack-start-no-anchor-element
`import { Link } from '@tanstack/react-router'` — enables type-safe routes, preloading via `preload="intent"`, and client-side navigation
- Category: TanStack Start
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: tanstack-start
- Enabled when: framework=tanstack-start and capabilities=tanstack-start
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires on a JSX <a> element in a file whose path matches /routes/ when its href is a string literal starting with /. Dynamic href expressions, external URLs, mailto:/tel:, and hash links are not flagged. False positive: an intentional full-page reload such as a logout link or OAuth handoff that must escape client-side routing.
Fix prompt
Use this once validation confirms the diagnostic is real.
Replace with <Link to="/path"> from @tanstack/react-router and add preload="intent" to prefetch on hover. Link gives type-checked params, search params, and to values, and avoids the full document reload that <a> triggers. See https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent
Related rules
More TanStack Start rules from the rules reference:
react-doctor/tanstack-start-no-direct-fetch-in-loader: Use `createServerFn()` from @tanstack/react-start — provides type-safe RPC, input validation, and proper server/client code splittingreact-doctor/tanstack-start-no-dynamic-server-fn-import: Use `import { myFn } from '~/utils/my.functions'` — the bundler replaces server code with RPC stubs only for static importsreact-doctor/tanstack-start-no-navigate-in-render: Use `throw redirect({ to: '/path' })` in `beforeLoad` or `loader` instead — navigate() during render causes hydration issuesreact-doctor/tanstack-start-no-use-server-in-handler: TanStack Start handles server boundaries automatically via the Vite plugin — "use server" inside createServerFn causes compilation errorsreact-doctor/tanstack-start-no-useeffect-fetch: Fetch data in the route `loader` instead — the router coordinates loading before rendering to avoid waterfalls