Skip to content

chore: setup router eslint plugin #464

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["react-app"],
"extends": ["react-app", "plugin:@tanstack/eslint-plugin-router/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["react-hooks"]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"dev:backend": "convex dev --tail-logs",
"build": "vite build",
"start": "vite start",
"lint": "prettier --check '**/*' --ignore-unknown && eslint --ext .ts,.tsx ./src",
"format": "prettier --write '**/*' --ignore-unknown",
"lint": "prettier --check 'src/**/*' --ignore-unknown && eslint --ext .ts,.tsx ./src",
"format": "prettier --write 'src/**/*' --ignore-unknown",
"linkAll": "node scripts/link.js"
},
"dependencies": {
Expand Down Expand Up @@ -89,6 +89,7 @@
"@content-collections/core": "^0.8.2",
"@content-collections/vite": "^0.2.4",
"@shikijs/transformers": "^1.10.3",
"@tanstack/eslint-plugin-router": "^1.131.2",
"@types/node": "^24.3.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
Expand Down
131 changes: 122 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ export const Route = createRootRouteWithContext<{
convexQueryClient: ConvexQueryClient
ensureUser: () => Promise<TanStackUser>
}>()({
beforeLoad: async (ctx) => {
if (
ctx.location.href.match(/\/docs\/(react|vue|angular|svelte|solid)\//gm)
) {
throw redirect({
href: ctx.location.href.replace(
/\/docs\/(react|vue|angular|svelte|solid)\//gm,
'/docs/framework/$1/'
),
})
}

// // During SSR only (the only time serverHttpClient exists),
// // set the auth token for Convex to make HTTP queries with.
// if (token) {
// ctx.context.convexQueryClient.serverHttpClient?.setAuth(token)
// }
},
head: () => ({
meta: [
{
Expand Down Expand Up @@ -123,24 +141,6 @@ export const Route = createRootRouteWithContext<{
},
],
}),
beforeLoad: async (ctx) => {
if (
ctx.location.href.match(/\/docs\/(react|vue|angular|svelte|solid)\//gm)
) {
throw redirect({
href: ctx.location.href.replace(
/\/docs\/(react|vue|angular|svelte|solid)\//gm,
'/docs/framework/$1/'
),
})
}

// // During SSR only (the only time serverHttpClient exists),
// // set the auth token for Convex to make HTTP queries with.
// if (token) {
// ctx.context.convexQueryClient.serverHttpClient?.setAuth(token)
// }
},
staleTime: Infinity,
errorComponent: (props) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_libraries/form.$version.index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function FormVersionIndex() {
className: 'bg-yellow-400 text-black',
}}
/>

<div className="w-fit mx-auto px-4">
<OpenSourceStats library={library} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_libraries/pacer.$version.index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function PacerVersionIndex() {
<div className="w-fit mx-auto px-4">
<OpenSourceStats library={library} />
</div>

<LibraryFeatureHighlights
featureHighlights={library.featureHighlights}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,4 @@ mark {
font-style: italic;
font-weight: 900;
src: url('/fonts/inter-v19-latin-900italic.woff2') format('woff2');
}
}
Loading