diff --git a/web/packages/accounts/api/srp.ts b/web/packages/accounts/api/srp.ts index 40be7b00e3..cec06e837b 100644 --- a/web/packages/accounts/api/srp.ts +++ b/web/packages/accounts/api/srp.ts @@ -166,6 +166,7 @@ export const verifySRPSession = async ( log.error("verifySRPSession failed", e); if ( e instanceof ApiError && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison e.httpStatusCode === HttpStatusCode.Unauthorized ) { throw Error(CustomError.INCORRECT_PASSWORD); diff --git a/web/packages/accounts/api/user.ts b/web/packages/accounts/api/user.ts index 763dbb190a..02148bf41a 100644 --- a/web/packages/accounts/api/user.ts +++ b/web/packages/accounts/api/user.ts @@ -61,6 +61,7 @@ export const logout = async () => { // ignore if unauthorized, can be triggered during on token expiry. else if ( e instanceof ApiError && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison e.httpStatusCode === HttpStatusCode.Unauthorized ) { return; diff --git a/web/packages/accounts/components/Login.tsx b/web/packages/accounts/components/Login.tsx index f8cc69d957..e41576af67 100644 --- a/web/packages/accounts/components/Login.tsx +++ b/web/packages/accounts/components/Login.tsx @@ -31,10 +31,10 @@ export const Login: React.FC = ({ signUp, host }) => { log.debug(() => ["srpAttributes", JSON.stringify(srpAttributes)]); if (!srpAttributes || srpAttributes.isEmailMFAEnabled) { await sendOtt(email); - router.push(PAGES.VERIFY); + void router.push(PAGES.VERIFY); } else { setData(LS_KEYS.SRP_ATTRIBUTES, srpAttributes); - router.push(PAGES.CREDENTIALS); + void router.push(PAGES.CREDENTIALS); } } catch (e) { if (e instanceof Error) { diff --git a/web/packages/accounts/components/LoginComponents.tsx b/web/packages/accounts/components/LoginComponents.tsx index 3063910a2d..178ae5df35 100644 --- a/web/packages/accounts/components/LoginComponents.tsx +++ b/web/packages/accounts/components/LoginComponents.tsx @@ -101,7 +101,7 @@ export const VerifyingPasskey: React.FC = ({ const response = await checkPasskeyVerificationStatus(passkeySessionID); if (!response) setVerificationStatus("pending"); - else router.push(await saveCredentialsAndNavigateTo(response)); + else void router.push(await saveCredentialsAndNavigateTo(response)); } catch (e) { log.error("Passkey verification status check failed", e); showMiniDialog( @@ -115,7 +115,7 @@ export const VerifyingPasskey: React.FC = ({ }; const handleRecover = () => { - router.push("/passkeys/recover"); + void router.push("/passkeys/recover"); }; return ( diff --git a/web/packages/accounts/components/SignUp.tsx b/web/packages/accounts/components/SignUp.tsx index b5c98f5b27..0d2efef62c 100644 --- a/web/packages/accounts/components/SignUp.tsx +++ b/web/packages/accounts/components/SignUp.tsx @@ -109,7 +109,7 @@ export const SignUp: React.FC = ({ router, login, host }) => { masterKey, ); setJustSignedUp(true); - router.push(PAGES.VERIFY); + void router.push(PAGES.VERIFY); } catch (e) { setFieldError("confirm", t("PASSWORD_GENERATION_FAILED")); throw e; diff --git a/web/packages/accounts/eslint.config.mjs b/web/packages/accounts/eslint.config.mjs index 823d196bed..08d3b6bc4d 100644 --- a/web/packages/accounts/eslint.config.mjs +++ b/web/packages/accounts/eslint.config.mjs @@ -17,8 +17,6 @@ export default [ "@typescript-eslint/no-unsafe-argument": "off", "@typescript-eslint/no-unsafe-call": "off", /** TODO: Disabled as we migrate, try to prune these again */ - "@typescript-eslint/no-floating-promises": "off", - "@typescript-eslint/no-unsafe-enum-comparison": "off", "@typescript-eslint/no-unnecessary-type-assertion": "off", "@typescript-eslint/array-type": "off", "@typescript-eslint/no-empty-function": "off", diff --git a/web/packages/accounts/pages/change-email.tsx b/web/packages/accounts/pages/change-email.tsx index 94b182e01a..019ee92556 100644 --- a/web/packages/accounts/pages/change-email.tsx +++ b/web/packages/accounts/pages/change-email.tsx @@ -24,7 +24,7 @@ const Page: React.FC = () => { useEffect(() => { const user = getData(LS_KEYS.USER); if (!user?.token) { - router.push("/"); + void router.push("/"); } }, []); @@ -83,7 +83,7 @@ const ChangeEmailForm: React.FC = () => { await changeEmail(email, ott!); await setLSUser({ ...getData(LS_KEYS.USER), email }); setLoading(false); - goToApp(); + void goToApp(); } catch (e) { setLoading(false); setFieldError("ott", t("INCORRECT_CODE")); diff --git a/web/packages/accounts/pages/change-password.tsx b/web/packages/accounts/pages/change-password.tsx index 54870dcd3c..dc9f92d2b7 100644 --- a/web/packages/accounts/pages/change-password.tsx +++ b/web/packages/accounts/pages/change-password.tsx @@ -47,7 +47,7 @@ const Page: React.FC = () => { setUser(user); if (!user?.token) { stashRedirect(PAGES.CHANGE_PASSWORD); - router.push("/"); + void router.push("/"); } else { setToken(user.token); } @@ -132,7 +132,7 @@ const Page: React.FC = () => { const redirectToAppHome = () => { setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true }); - router.push(appHomeRoute); + void router.push(appHomeRoute); }; // TODO: Handle the case where user is not loaded yet. diff --git a/web/packages/accounts/pages/credentials.tsx b/web/packages/accounts/pages/credentials.tsx index 01f9174a0b..7887a57453 100644 --- a/web/packages/accounts/pages/credentials.tsx +++ b/web/packages/accounts/pages/credentials.tsx @@ -119,7 +119,7 @@ const Page: React.FC = ({ appContext }) => { const main = async () => { const user: User = getData(LS_KEYS.USER); if (!user?.email) { - router.push("/"); + void router.push("/"); return; } setUser(user); @@ -141,7 +141,7 @@ const Page: React.FC = ({ appContext }) => { } const token = getToken(); if (key && token) { - router.push(appHomeRoute); + void router.push(appHomeRoute); return; } const kekEncryptedAttributes: B64EncryptionResult = getKey( @@ -180,7 +180,7 @@ const Page: React.FC = ({ appContext }) => { (keyAttributes && !keyAttributes.memLimit) ) { clearLocalStorage(); - router.push("/"); + void router.push("/"); return; } setKeyAttributes(keyAttributes); @@ -190,10 +190,10 @@ const Page: React.FC = ({ appContext }) => { if (srpAttributes) { setSrpAttributes(srpAttributes); } else { - router.push("/"); + void router.push("/"); } }; - main(); + void main(); showNavBar(true); }, []); // TODO: ^ validateSession is a dependency, but add that only after we've @@ -252,7 +252,7 @@ const Page: React.FC = ({ appContext }) => { twoFactorSessionID, isTwoFactorEnabled: true, }); - router.push(PAGES.TWO_FACTOR_VERIFY); + void router.push(PAGES.TWO_FACTOR_VERIFY); throw Error(CustomError.TWO_FACTOR_ENABLED); } else { const user = getData(LS_KEYS.USER); @@ -314,7 +314,7 @@ const Page: React.FC = ({ appContext }) => { } catch (e) { log.error("migrate to srp failed", e); } - router.push(unstashRedirect() ?? appHomeRoute); + void router.push(unstashRedirect() ?? appHomeRoute); } catch (e) { log.error("useMasterPassword failed", e); } diff --git a/web/packages/accounts/pages/generate.tsx b/web/packages/accounts/pages/generate.tsx index 02e4c5747a..bea4416139 100644 --- a/web/packages/accounts/pages/generate.tsx +++ b/web/packages/accounts/pages/generate.tsx @@ -51,22 +51,22 @@ const Page: React.FC = ({ appContext }) => { const user: User = getData(LS_KEYS.USER); setUser(user); if (!user?.token) { - router.push("/"); + void router.push("/"); } else if (key) { if (justSignedUp()) { setOpenRecoveryKey(true); setLoading(false); } else { - router.push(appHomeRoute); + void router.push(appHomeRoute); } } else if (keyAttributes?.encryptedKey) { - router.push(PAGES.CREDENTIALS); + void router.push(PAGES.CREDENTIALS); } else { setToken(user.token); setLoading(false); } }; - main(); + void main(); appContext.showNavBar(true); }, []); @@ -106,7 +106,7 @@ const Page: React.FC = ({ appContext }) => { open={openRecoveryKey} onClose={() => { setOpenRecoveryKey(false); - router.push(appHomeRoute); + void router.push(appHomeRoute); }} showMiniDialog={showMiniDialog} /> diff --git a/web/packages/accounts/pages/login.tsx b/web/packages/accounts/pages/login.tsx index 7d297f303c..d1005bdcd3 100644 --- a/web/packages/accounts/pages/login.tsx +++ b/web/packages/accounts/pages/login.tsx @@ -21,14 +21,14 @@ const Page: React.FC = ({ appContext }) => { void customAPIHost().then(setHost); const user = getData(LS_KEYS.USER); if (user?.email) { - router.push(PAGES.VERIFY); + void router.push(PAGES.VERIFY); } setLoading(false); showNavBar(true); }, []); const signUp = () => { - router.push(PAGES.SIGNUP); + void router.push(PAGES.SIGNUP); }; return loading ? ( diff --git a/web/packages/accounts/pages/passkeys/finish.tsx b/web/packages/accounts/pages/passkeys/finish.tsx index 9c074bcfa3..a1cda8b548 100644 --- a/web/packages/accounts/pages/passkeys/finish.tsx +++ b/web/packages/accounts/pages/passkeys/finish.tsx @@ -32,10 +32,8 @@ const Page: React.FC = () => { const response = searchParams.get("response"); if (!passkeySessionID || !response) return; - saveCredentialsAndNavigateTo(passkeySessionID, response).then( - (slug: string) => { - router.push(slug); - }, + void saveCredentialsAndNavigateTo(passkeySessionID, response).then( + (slug: string) => router.push(slug), ); }, []); diff --git a/web/packages/accounts/pages/recover.tsx b/web/packages/accounts/pages/recover.tsx index 411c76a7ce..9897d83b84 100644 --- a/web/packages/accounts/pages/recover.tsx +++ b/web/packages/accounts/pages/recover.tsx @@ -43,19 +43,19 @@ const Page: React.FC = ({ appContext }) => { const keyAttributes: KeyAttributes = getData(LS_KEYS.KEY_ATTRIBUTES); const key = getKey(SESSION_KEYS.ENCRYPTION_KEY); if (!user?.email) { - router.push("/"); + void router.push("/"); return; } if (!user?.encryptedToken && !user?.token) { - sendOtt(user.email); + void sendOtt(user.email); stashRedirect(PAGES.RECOVER); - router.push(PAGES.VERIFY); + void router.push(PAGES.VERIFY); return; } if (!keyAttributes) { - router.push(PAGES.GENERATE); + void router.push(PAGES.GENERATE); } else if (key) { - router.push(appHomeRoute); + void router.push(appHomeRoute); } else { setKeyAttributes(keyAttributes); } @@ -91,7 +91,7 @@ const Page: React.FC = ({ appContext }) => { await decryptAndStoreToken(keyAttr, masterKey); setData(LS_KEYS.SHOW_BACK_BUTTON, { value: false }); - router.push(PAGES.CHANGE_PASSWORD); + void router.push(PAGES.CHANGE_PASSWORD); } catch (e) { log.error("password recovery failed", e); setFieldError(t("INCORRECT_RECOVERY_KEY")); diff --git a/web/packages/accounts/pages/signup.tsx b/web/packages/accounts/pages/signup.tsx index 2aca89c261..8f60d9986c 100644 --- a/web/packages/accounts/pages/signup.tsx +++ b/web/packages/accounts/pages/signup.tsx @@ -21,14 +21,14 @@ const Page: React.FC = ({ appContext }) => { void customAPIHost().then(setHost); const user = getData(LS_KEYS.USER); if (user?.email) { - router.push(PAGES.VERIFY); + void router.push(PAGES.VERIFY); } setLoading(false); showNavBar(true); }, []); const login = () => { - router.push(PAGES.LOGIN); + void router.push(PAGES.LOGIN); }; return ( diff --git a/web/packages/accounts/pages/two-factor/recover.tsx b/web/packages/accounts/pages/two-factor/recover.tsx index 9718902ce1..1c88773deb 100644 --- a/web/packages/accounts/pages/two-factor/recover.tsx +++ b/web/packages/accounts/pages/two-factor/recover.tsx @@ -57,12 +57,12 @@ const Page: React.FC = ({ appContext, twoFactorType }) => { const user = getData(LS_KEYS.USER); const sid = user.passkeySessionID || user.twoFactorSessionID; if (!user || !user.email || !sid) { - router.push("/"); + void router.push("/"); } else if ( !(user.isTwoFactorEnabled || user.isTwoFactorEnabledPasskey) && (user.encryptedToken || user.token) ) { - router.push(PAGES.GENERATE); + void router.push(PAGES.GENERATE); } else { setSessionID(sid); } @@ -81,6 +81,7 @@ const Page: React.FC = ({ appContext, twoFactorType }) => { } catch (e) { if ( e instanceof ApiError && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison e.httpStatusCode === HttpStatusCode.NotFound ) { logout(); @@ -91,7 +92,7 @@ const Page: React.FC = ({ appContext, twoFactorType }) => { } } }; - main(); + void main(); }, []); const recover: SingleInputFormProps["callback"] = async ( @@ -133,7 +134,7 @@ const Page: React.FC = ({ appContext, twoFactorType }) => { isTwoFactorEnabled: false, }); setData(LS_KEYS.KEY_ATTRIBUTES, keyAttributes); - router.push(PAGES.CREDENTIALS); + void router.push(PAGES.CREDENTIALS); } catch (e) { log.error("two factor recovery failed", e); setFieldError(t("INCORRECT_RECOVERY_KEY")); diff --git a/web/packages/accounts/pages/two-factor/setup.tsx b/web/packages/accounts/pages/two-factor/setup.tsx index 794a2faebe..289c9f95b6 100644 --- a/web/packages/accounts/pages/two-factor/setup.tsx +++ b/web/packages/accounts/pages/two-factor/setup.tsx @@ -41,7 +41,7 @@ const Page: React.FC = () => { log.error("failed to get two factor setup code", e); } }; - main(); + void main(); }, []); const onSubmit: VerifyTwoFactorCallback = async ( @@ -57,7 +57,7 @@ const Page: React.FC = () => { ...getData(LS_KEYS.USER), isTwoFactorEnabled: true, }); - router.push(appHomeRoute); + void router.push(appHomeRoute); }; return ( diff --git a/web/packages/accounts/pages/two-factor/verify.tsx b/web/packages/accounts/pages/two-factor/verify.tsx index 0db7eb9fee..0e609be0d9 100644 --- a/web/packages/accounts/pages/two-factor/verify.tsx +++ b/web/packages/accounts/pages/two-factor/verify.tsx @@ -36,17 +36,17 @@ const Page: React.FC = ({ appContext }) => { const main = async () => { const user: User = getData(LS_KEYS.USER); if (!user?.email || !user.twoFactorSessionID) { - router.push("/"); + void router.push("/"); } else if ( !user.isTwoFactorEnabled && (user.encryptedToken || user.token) ) { - router.push(PAGES.CREDENTIALS); + void router.push(PAGES.CREDENTIALS); } else { setSessionID(user.twoFactorSessionID); } }; - main(); + void main(); }, []); const onSubmit: VerifyTwoFactorCallback = async (otp) => { @@ -60,10 +60,11 @@ const Page: React.FC = ({ appContext }) => { id, }); setData(LS_KEYS.KEY_ATTRIBUTES, keyAttributes!); - router.push(unstashRedirect() ?? PAGES.CREDENTIALS); + void router.push(unstashRedirect() ?? PAGES.CREDENTIALS); } catch (e) { if ( e instanceof ApiError && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison e.httpStatusCode === HttpStatusCode.NotFound ) { logout(); diff --git a/web/packages/accounts/pages/verify.tsx b/web/packages/accounts/pages/verify.tsx index 868d3e47b7..5479e11873 100644 --- a/web/packages/accounts/pages/verify.tsx +++ b/web/packages/accounts/pages/verify.tsx @@ -60,12 +60,12 @@ const Page: React.FC = ({ appContext }) => { const redirect = await redirectionIfNeeded(user); if (redirect) { - router.push(redirect); + void router.push(redirect); } else { setEmail(user.email); } }; - main(); + void main(); showNavBar(true); }, []); @@ -108,7 +108,7 @@ const Page: React.FC = ({ appContext }) => { isTwoFactorEnabled: true, }); setIsFirstLogin(true); - router.push(PAGES.TWO_FACTOR_VERIFY); + void router.push(PAGES.TWO_FACTOR_VERIFY); } else { await setLSUser({ email, @@ -134,20 +134,22 @@ const Page: React.FC = ({ appContext }) => { await configureSRP(srpSetupAttributes); } } - localForage.clear(); + await localForage.clear(); setIsFirstLogin(true); const redirectURL = unstashRedirect(); if (keyAttributes?.encryptedKey) { clearKeys(); - router.push(redirectURL ?? PAGES.CREDENTIALS); + void router.push(redirectURL ?? PAGES.CREDENTIALS); } else { - router.push(redirectURL ?? PAGES.GENERATE); + void router.push(redirectURL ?? PAGES.GENERATE); } } } catch (e) { if (e instanceof ApiError) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (e?.httpStatusCode === HttpStatusCode.Unauthorized) { setFieldError(t("INVALID_CODE")); + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison } else if (e?.httpStatusCode === HttpStatusCode.Gone) { setFieldError(t("EXPIRED_CODE")); }