-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
examples: replace relative paths with path aliases to improve consist… #6046
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
base: main
Are you sure you want to change the base?
Conversation
…ency and conciseness.
WalkthroughFive files in the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/react/start-basic-cloudflare/src/routes/users.$userId.tsx (1)
4-4: Alias change forUsertype looks good; optional note on alias style.Using
import type { User } from '~/utils/users'matches the rest of this PR and remains a type-only import, so it shouldn’t affect runtime. There is a mix ofsrc/components/...and~/...aliases across these example routes; if you want maximum consistency, a small follow-up could standardize on one alias style for components too, but it isn’t required for this change.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
examples/react/start-basic-cloudflare/src/routes/posts.$postId.tsx(1 hunks)examples/react/start-basic-cloudflare/src/routes/posts.tsx(1 hunks)examples/react/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsx(1 hunks)examples/react/start-basic-cloudflare/src/routes/users.$userId.tsx(1 hunks)examples/react/start-basic-cloudflare/src/routes/users.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode with extensive type safety for all code
Files:
examples/react/start-basic-cloudflare/src/routes/users.tsxexamples/react/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsxexamples/react/start-basic-cloudflare/src/routes/posts.$postId.tsxexamples/react/start-basic-cloudflare/src/routes/users.$userId.tsxexamples/react/start-basic-cloudflare/src/routes/posts.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Implement ESLint rules for router best practices using the ESLint plugin router
Files:
examples/react/start-basic-cloudflare/src/routes/users.tsxexamples/react/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsxexamples/react/start-basic-cloudflare/src/routes/posts.$postId.tsxexamples/react/start-basic-cloudflare/src/routes/users.$userId.tsxexamples/react/start-basic-cloudflare/src/routes/posts.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to docs/**/*.{md,mdx} : Use relative links to `docs/` folder format (e.g., `./guide/data-loading`) for internal documentation references
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.
Applied to files:
examples/react/start-basic-cloudflare/src/routes/users.tsxexamples/react/start-basic-cloudflare/src/routes/users.$userId.tsx
🔇 Additional comments (4)
examples/react/start-basic-cloudflare/src/routes/posts.tsx (1)
2-2: Alias-based import forfetchPostslooks good.Switching to
~/utils/postsimproves readability and matches the alias pattern used elsewhere, with no behavior change as long as the~alias is configured for TS and the bundler in this example.Please ensure the
~path alias is defined in this example’stsconfig(and Vite/Cloudflare build config) so these imports resolve in both dev and build.examples/react/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsx (1)
2-2: Consistent alias import forfetchPost.Using
~/utils/postshere aligns this route with the other posts routes and keeps the loader behavior unchanged.examples/react/start-basic-cloudflare/src/routes/users.tsx (1)
2-2: Alias import forUsertype is safe and clearer.Updating to
import type { User } from '~/utils/users'keeps this as a type-only import and aligns with the alias usage in other routes without changing runtime behavior.examples/react/start-basic-cloudflare/src/routes/posts.$postId.tsx (1)
2-2: Utilities now share the same~alias as components.Importing
fetchPostfrom~/utils/postsbrings this route in line with its existing~/components/...imports, improving local consistency with no functional change.
I used TanStack and Cloudflare to build my web project today, and it amazed me. Also, I noticed there are some minor flaws in the example code that could be improved.