Skip to content

Commit

Permalink
style: add the tanstack router eslint plugin (#422)
Browse files Browse the repository at this point in the history
* install @tanstack/eslint-plugin-router

* add the tanstack router eslint plugin into the config

* style: linting the warnings reported by the plugin
  • Loading branch information
SeanCassiere authored Sep 21, 2024
1 parent 1fa8e20 commit 85d8577
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
import eslintJs from "@eslint/js";
import tanstackRouterPlugin from "@tanstack/eslint-plugin-router";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintReact from "eslint-plugin-react";
import eslintReactCompiler from "eslint-plugin-react-compiler";
Expand All @@ -10,6 +11,7 @@ import tseslint from "typescript-eslint";
export default tseslint.config(
eslintJs.configs.recommended,
...tseslint.configs.recommended,
...tanstackRouterPlugin.configs["flat/recommended"],
eslintConfigPrettier,
{
files: ["**.config.{cjs,mjs,ts,js}", "postbuild.cjs"],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/eslint-plugin-router": "^1.58.6",
"@tanstack/router-plugin": "^1.58.4",
"@types/node": "^22.5.4",
"@types/react": "^18.3.5",
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/routes/_auth/(reports)/reports._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Route = createFileRoute("/_auth/(reports)/reports/")({
searchListOptions: fetchReportsListOptions({ auth }),
};
},
loaderDeps: ({ search: { category } }) => ({ category }),
loader: async ({ context }) => {
const { queryClient, searchListOptions } = context;

Expand All @@ -38,7 +39,6 @@ export const Route = createFileRoute("/_auth/(reports)/reports/")({

return;
},
loaderDeps: ({ search: { category } }) => ({ category }),
component: ReportSearchPage,
});

Expand Down
2 changes: 1 addition & 1 deletion src/routes/_public/oidc-callback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export const Route = createFileRoute("/_public/oidc-callback")({
state: z.string().optional(),
session_state: z.string().optional(),
}),
beforeLoad: ({ search }) => ({ search }),
loaderDeps: ({ search }) => ({
redirect: search?.redirect,
code: search?.code,
scope: search?.scope,
state: search?.state,
session_state: search?.session_state,
}),
beforeLoad: ({ search }) => ({ search }),
loader: async ({ context, preload, location }) => {
const locationPathname = location.pathname;
if (preload || !locationPathname.includes("oidc-callback")) return;
Expand Down

0 comments on commit 85d8577

Please sign in to comment.