Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Follow the adopted and supported routing strategy
Add routes using the project's chosen supported router; Pages Router is supported, not universally deprecated.
Bad example
| 1 | // pages/watchlist/index.tsx (legacy Pages Router) |
| 2 | import type { GetServerSideProps } from 'next'; |
| 3 |
|
| 4 | export default function WatchlistPage({ data }) { |
| 5 | return <Watchlist data={data} />; |
| 6 | } |
| 7 |
|
| 8 | export const getServerSideProps: GetServerSideProps = async () => { |
| 9 | const data = await fetchData(); |
| 10 | return { props: { data } }; |
| 11 | }; |
Explanation (EN)
In a project that has deliberately adopted App Router, adding another Pages Router route can create avoidable mixed-router maintenance.
Objašnjenje (HR)
U projektu koji je namjerno usvojio App Router nova Pages Router ruta može dodati nepotrebno održavanje dvaju routera.
Good example
| 1 | // Project convention: new routes use App Router. |
| 2 | export default async function WatchlistPage() { |
| 3 | const data = await fetchData(); |
| 4 | return <Watchlist data={data} />; |
| 5 | } |
Explanation (EN)
The page follows this project's App Router convention; this is not evidence that all Pages Router applications must migrate.
Objašnjenje (HR)
Stranica slijedi App Router konvenciju ovog projekta. To ne znači da svaka Pages Router aplikacija mora migrirati.
Notes (EN)
Follow the repository routing strategy and supported framework version. Prefer App Router for new routes when the project has adopted it and required integrations are compatible.
Bilješke (HR)
Slijedi strategiju rutiranja repozitorija i podržanu verziju frameworka. Za nove rute prednost daj App Routeru kada ga je projekt usvojio i potrebne integracije su kompatibilne.
Exceptions / Tradeoffs (EN)
Next.js Pages Router remains supported. Adding a route there is valid in a Pages Router application; migration requires its own scope and behavior checks.
Iznimke / Tradeoffi (HR)
Next.js Pages Router i dalje je podržan. Nova ruta u aplikaciji koja ga koristi može biti ispravna; migracija zahtijeva vlastiti opseg i provjere ponašanja.