react-doctor: order route properties canonically (tanstack-start-route-property-order) - #173
Open
stonexer wants to merge 1 commit into
Open
react-doctor: order route properties canonically (tanstack-start-route-property-order)#173stonexer wants to merge 1 commit into
stonexer wants to merge 1 commit into
Conversation
…e-property-order) TanStack Router's type inference feeds earlier route properties into later ones, so an options object whose keys are out of the canonical order (params -> validateSearch -> loaderDeps -> ssr -> context -> beforeLoad -> loader -> head) silently loses inference on the later ones. Four route files were out of order: - index.tsx, onboarding.tsx, t.$teamId.tsx put `ssr` ahead of `validateSearch`/`loaderDeps`, so the search shape did not feed `loaderDeps`/`loader`. - templates.tsx put `head` ahead of `loader`, so `head` could not see the loader's data type. Pure key reorder inside each options object - no property added, removed or edited, and no runtime behavior change (the router reads these by name). Verified: react-doctor error findings 19 -> 15 with the family fully cleared (0 sites) and warnings unchanged at 216, so the reorder introduced nothing new; `pnpm -r typecheck` clean; server suite 858 passed / 3 skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
react-doctorflagstanstack-start-route-property-order×4 (Bugs, error severity) — the one actionable error family in the backlog. TanStack Router's type inference feeds earlier route properties into later ones, so an options object whose keys are out of the canonical order (params → validateSearch → loaderDeps → ssr → context → beforeLoad → loader → head) silently loses inference on the later ones.The four sites
routes/index.tsx:16ssrahead ofvalidateSearch/loaderDeps— the?template=search shape doesn't feedloaderDeps/loaderroutes/onboarding.tsx:23ssrahead ofvalidateSearch/loaderDeps(?team=)routes/t.$teamId.tsx:20ssrahead ofvalidateSearch(?template=)routes/templates.tsx:23headahead ofloader—headcan't see the loader's data typeroutes/templates_.$slug.tsxalready ordersloaderbeforeheadand is correctly absent from the finding set; every other route file carries only one of the coupled properties.The change
A pure key reorder inside each options object. No property added, removed or edited; no runtime behavior change (the router reads these by name — only TypeScript's inference is order-sensitive). The
?template=/?team=comments move with the properties they document.Verification
react-doctoron this branch vs the same worktree unfixed: errors 19 → 15, family fully cleared (0 sites,--verbosegrep finds no mention), warnings unchanged at 216 — so the reorder introduced nothing new. Files with findings 58 → 56.pnpm -r typecheck— clean, both packages.pnpm --filter @loopany/server test— 858 passed / 3 skipped, 91 files.Rule reference: https://react.doctor/docs/rules/react-doctor/tanstack-start-route-property-order (mirrors TanStack's own
create-route-property-orderESLint rule).