diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 0443a81bbb..f9ef172e06 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -38,6 +38,7 @@ rules: "@typescript-eslint/explicit-function-return-type": "off" "@typescript-eslint/explicit-module-boundary-types": "error" "@typescript-eslint/method-signature-style": ["error", "property"] + "@typescript-eslint/no-floating-promises": error "@typescript-eslint/no-invalid-void-type": error # We're disabling the `no-namespace` rule to use a pattern of defining an interface, # and then defining functions that operate on that data via namespace. This is helpful for diff --git a/site/components/SignIn/SignInForm.tsx b/site/components/SignIn/SignInForm.tsx index b66735c5da..4299f33667 100644 --- a/site/components/SignIn/SignInForm.tsx +++ b/site/components/SignIn/SignInForm.tsx @@ -87,8 +87,8 @@ export const SignInForm: React.FC = ({ try { await loginHandler(email, password) // Tell SWR to invalidate the cache for the user endpoint - mutate("/api/v2/user") - router.push("/") + await mutate("/api/v2/user") + await router.push("/") } catch (err) { helpers.setFieldError("password", "The username or password is incorrect.") } diff --git a/site/contexts/UserContext.tsx b/site/contexts/UserContext.tsx index 544d5dd835..a7885d2e47 100644 --- a/site/contexts/UserContext.tsx +++ b/site/contexts/UserContext.tsx @@ -23,7 +23,9 @@ export const useUser = (redirectOnError = false): UserContext => { const requestError = ctx.error useEffect(() => { if (redirectOnError && requestError) { - router.push({ + // 'void' means we are ignoring handling the promise returned + // from router.push (and lets the linter know we're OK with that!) + void router.push({ pathname: "/login", query: { redirect: router.asPath,