From e0b4a75782266df977d4da33b135379559d6fe8f Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:09:34 -0600 Subject: [PATCH 1/6] checkpoint 1 --- .eslintrc.json | 8 +++- e2e/utils/createDomainAssociation.ts | 2 - e2e/utils/createInstitution.ts | 3 +- e2e/utils/createKeycloakUser.ts | 8 +--- e2e/utils/getKeycloakToken.ts | 4 +- e2e/utils/verifyDownloadableReport.ts | 1 - src/App.tsx | 48 ++++--------------- src/api/requests/downloadValidationReport.ts | 4 +- src/pages/Error/_shared.tsx | 6 +-- .../Filing/FilingApp/FileSubmission.data.tsx | 2 - .../Filing/FilingApp/FilingProtectedRoute.tsx | 3 +- .../Filing/UpdateFinancialProfile/UfpForm.tsx | 3 +- src/pages/FilingDetails/index.tsx | 3 +- .../ProfileForm/CreateProfileForm/index.tsx | 3 +- .../TypesFinancialInstitutions/index.tsx | 4 +- 15 files changed, 29 insertions(+), 73 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7bbf84b48..8080dae10 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,6 +26,12 @@ "plugin:prettier/recommended" ], "rules": { + "no-console": [ + "error", + { + "allow": ["warn", "error"] + } + ], "react/jsx-props-no-spreading": "off", "no-dupe-else-if": "error", "no-promise-executor-return": "error", @@ -150,7 +156,7 @@ ], "react/jsx-no-constructed-context-values": "error", "react/jsx-no-script-url": "error", - "react/jsx-no-useless-fragment": "error", + "react/jsx-no-useless-fragment": "off", "unicorn/filename-case": [ "error", diff --git a/e2e/utils/createDomainAssociation.ts b/e2e/utils/createDomainAssociation.ts index fc8908869..f10419e9a 100644 --- a/e2e/utils/createDomainAssociation.ts +++ b/e2e/utils/createDomainAssociation.ts @@ -21,8 +21,6 @@ export default async function createDomainAssociation({ try { await axios.request(optionsForDomainAssociation); } catch (error) { - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - // eslint-disable-next-line no-console console.error( 'error when creating a domain/institution association :>>', error, diff --git a/e2e/utils/createInstitution.ts b/e2e/utils/createInstitution.ts index 778b7a86f..2eacb1c81 100644 --- a/e2e/utils/createInstitution.ts +++ b/e2e/utils/createInstitution.ts @@ -48,8 +48,7 @@ export default async function createInstitution({ try { await axios.request(options); } catch (error) { - // eslint-disable-next-line no-console - console.log('error when creating institutions :>>', error); + console.error('error when creating institutions :>>', error); throw error; } } diff --git a/e2e/utils/createKeycloakUser.ts b/e2e/utils/createKeycloakUser.ts index 3938d652e..d945c3a7a 100644 --- a/e2e/utils/createKeycloakUser.ts +++ b/e2e/utils/createKeycloakUser.ts @@ -4,9 +4,7 @@ import { config } from './authConstants'; export class KeycloakService { private readonly kcAdminClient: KeycloakAdminClient; - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility - constructor() { + public constructor() { this.kcAdminClient = new KeycloakAdminClient({ baseUrl: config.target, realmName: config.realm, @@ -46,7 +44,6 @@ export default async function createKeycloakUser({ grantType: config.cli.grantType, }); } catch (error) { - // eslint-disable-next-line no-console console.error( 'error when attempting to auth into keycloak admin :>>', error, @@ -70,8 +67,7 @@ export default async function createKeycloakUser({ }); result = response?.id ?? ''; } catch (error) { - // eslint-disable-next-line no-console - console.log('error when trying to create a user in keycloak :>>', error); + console.error('error when trying to create a user in keycloak :>>', error); throw error; } return result; diff --git a/e2e/utils/getKeycloakToken.ts b/e2e/utils/getKeycloakToken.ts index 9956f4224..f5887be60 100644 --- a/e2e/utils/getKeycloakToken.ts +++ b/e2e/utils/getKeycloakToken.ts @@ -21,9 +21,7 @@ export default async function getAdminKeycloakToken(): Promise { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return data.access_token as string; } catch (error) { - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - // eslint-disable-next-line no-console - console.log( + console.error( 'error when trying to fetch an admin token from keycloak :>>', error, ); diff --git a/e2e/utils/verifyDownloadableReport.ts b/e2e/utils/verifyDownloadableReport.ts index a947011d4..0b2bf9786 100644 --- a/e2e/utils/verifyDownloadableReport.ts +++ b/e2e/utils/verifyDownloadableReport.ts @@ -65,7 +65,6 @@ export async function verifyDownloadableReport({ console.log(`Deleted the downloaded file: ${downloadFilePath}`); } } catch (error) { - // eslint-disable-next-line no-console console.error( `Failed to delete file: ${downloadFilePath}. Error: ${ (error as Error).message diff --git a/src/App.tsx b/src/App.tsx index 573455eaf..31bdd378d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-misused-promises */ import { useQuery } from '@tanstack/react-query'; import { MarkdownText } from 'MarkdownTest'; import { fetchUserProfile } from 'api/requests'; @@ -65,7 +64,6 @@ const TypesFinancialInstitutions = lazy( async () => import('pages/TypesFinancialInstitutions'), ); const FilingCreate = lazy( - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 async () => import('pages/Filing/FilingApp/FilingCreate'), ); @@ -75,7 +73,6 @@ if (import.meta.env.DEV) { window.toggleRouting = toggleRouting; window.setIsRoutingEnabled = setIsRoutingEnabled; } -// eslint-disable-next-line no-console if (!isRoutingEnabled) console.warn('Routing is disabled!'); /** @@ -116,7 +113,7 @@ export function NavItem({ ); } -function BasicLayout(): Promise | ReactElement { +function BasicLayout(): ReactElement { const headerLinks = [...useHeaderAuthLinks()]; const location = useLocation(); const auth = useSblAuth(); @@ -140,7 +137,8 @@ function BasicLayout(): Promise | ReactElement { errorMessage.includes("Session doesn't have required client") && location.pathname !== '/' ) { - return auth.onLogout(); + void auth.onLogout(); + return <>; } } @@ -177,7 +175,7 @@ interface ProtectedRouteProperties { isAuthenticated: boolean; isLoading: boolean; onLogin: () => Promise; - UserProfile: UserProfileType; + UserProfile: UserProfileType | undefined; children: JSX.Element; } @@ -188,7 +186,7 @@ function ProtectedRoute({ onLogin, UserProfile, children, -}: ProtectedRouteProperties): JSX.Element | null { +}: ProtectedRouteProperties): JSX.Element { const { pathname } = useLocation(); const isProfileFormPath = pathname.includes('/profile/complete'); @@ -198,13 +196,13 @@ function ProtectedRoute({ if (!isInitialAuthorizationLoading && !isAuthenticated) { void onLogin(); - return null; + return <>; } if (isAnyAuthorizationLoading) return ; const isUserAssociatedWithAnyInstitution = - UserProfile.institutions.length > 0; + (UserProfile?.institutions?.length ?? 0) > 0; if (!isUserAssociatedWithAnyInstitution && !isProfileFormPath) return ; if (isProfileFormPath && isUserAssociatedWithAnyInstitution) @@ -240,19 +238,12 @@ export default function App(): ReactElement { }> - - } - > + }> } /> {import.meta.env.DEV ? ( @@ -262,7 +253,6 @@ export default function App(): ReactElement { @@ -273,7 +263,6 @@ export default function App(): ReactElement { @@ -287,11 +276,10 @@ export default function App(): ReactElement { '/filing/:year/:lei/errors', '/filing/:year/:lei/errors/errors-syntax', '/filing/:year/:lei/errors/errors-logic', - ].map((path, index) => ( + ].map(path => ( @@ -300,14 +288,12 @@ export default function App(): ReactElement { } - // eslint-disable-next-line react/no-array-index-key - key={index} + key={`error-route${path.replaceAll(/[/:]+/gi, '-')}`} /> ))} @@ -320,7 +306,6 @@ export default function App(): ReactElement { @@ -333,7 +318,6 @@ export default function App(): ReactElement { @@ -346,7 +330,6 @@ export default function App(): ReactElement { @@ -359,7 +342,6 @@ export default function App(): ReactElement { @@ -368,7 +350,6 @@ export default function App(): ReactElement { @@ -377,7 +358,6 @@ export default function App(): ReactElement { @@ -388,7 +368,6 @@ export default function App(): ReactElement { @@ -399,7 +378,6 @@ export default function App(): ReactElement { @@ -408,7 +386,6 @@ export default function App(): ReactElement {
@@ -419,7 +396,6 @@ export default function App(): ReactElement {
@@ -430,7 +406,6 @@ export default function App(): ReactElement { @@ -439,7 +414,6 @@ export default function App(): ReactElement { @@ -448,7 +422,6 @@ export default function App(): ReactElement { @@ -459,7 +432,6 @@ export default function App(): ReactElement { diff --git a/src/api/requests/downloadValidationReport.ts b/src/api/requests/downloadValidationReport.ts index 8409d2b9a..682c2593a 100644 --- a/src/api/requests/downloadValidationReport.ts +++ b/src/api/requests/downloadValidationReport.ts @@ -59,9 +59,7 @@ export const downloadValidationReport = async ({ URL.revokeObjectURL(url); }); } catch (error) { - // Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 - // eslint-disable-next-line no-console - console.log(error); + console.error(error); } finally { if (afterDownloadCallback) afterDownloadCallback(); } diff --git a/src/pages/Error/_shared.tsx b/src/pages/Error/_shared.tsx index 9b32d8e4a..2c5385d77 100644 --- a/src/pages/Error/_shared.tsx +++ b/src/pages/Error/_shared.tsx @@ -11,11 +11,7 @@ export function LinkContactSupport(): JSX.Element { ); } -export function LinkVisitHomepage({ - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - // eslint-disable-next-line @typescript-eslint/no-unused-vars - ...properties -}): JSX.Element { +export function LinkVisitHomepage(): JSX.Element { return ( Visit homepage diff --git a/src/pages/Filing/FilingApp/FileSubmission.data.tsx b/src/pages/Filing/FilingApp/FileSubmission.data.tsx index ee5ac2be4..229130d0c 100644 --- a/src/pages/Filing/FilingApp/FileSubmission.data.tsx +++ b/src/pages/Filing/FilingApp/FileSubmission.data.tsx @@ -124,8 +124,6 @@ export function MustUploadFirstAlert(): JSX.Element { status='error' aria-live='polite' aria-atomic='true' - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - headingLevel='' message='Your file must be successfully uploaded and validation checks performed to continue to the next step.' /> ); diff --git a/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx b/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx index b8d03d3b5..efd1cb405 100644 --- a/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx +++ b/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx @@ -3,6 +3,7 @@ import type { JSX } from 'react'; import { Navigate, useLocation, useParams } from 'react-router-dom'; import { FILING_PAGE_ORDER, NegativeOne, Zero } from 'utils/constants'; import { useFilingAndSubmissionInfo } from 'utils/useFilingAndSubmissionInfo'; +import type { CombinedInfoType } from 'utils/useFilingAndSubmissionInfo'; import { Error500 } from '../../Error/Error500'; import { getFilingSteps } from './FilingSteps.helpers'; @@ -31,8 +32,6 @@ export function FilingProtectedRoute({ if (isLoading) return ; if (error) - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment return ; // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 diff --git a/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx b/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx index cc7625013..49502aa63 100644 --- a/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx +++ b/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx @@ -83,8 +83,7 @@ export default function UFPForm({ state: { scenario: scenarios.SuccessInstitutionProfileUpdate }, }); } catch (error) { - // eslint-disable-next-line no-console - console.log('Error submitting UFP', error); + console.error('Error submitting UFP', error); } } else { scrollToElement(formErrorHeaderId); diff --git a/src/pages/FilingDetails/index.tsx b/src/pages/FilingDetails/index.tsx index 0ace82c26..20f7bde9a 100644 --- a/src/pages/FilingDetails/index.tsx +++ b/src/pages/FilingDetails/index.tsx @@ -276,8 +276,7 @@ function FilingDetails(): JSX.Element { navigate(`/filing/${year}/${lei}/submit`); } catch (error) { - // eslint-disable-next-line no-console - console.log(error); + console.error(error); } finally { setIsSubmitting(false); } diff --git a/src/pages/ProfileForm/CreateProfileForm/index.tsx b/src/pages/ProfileForm/CreateProfileForm/index.tsx index 0194ee0d4..a00f57ffe 100644 --- a/src/pages/ProfileForm/CreateProfileForm/index.tsx +++ b/src/pages/ProfileForm/CreateProfileForm/index.tsx @@ -99,8 +99,7 @@ function CreateProfileForm(): JSX.Element { state: { scenario: scenarios.Warning4 }, }); } catch (error) { - // eslint-disable-next-line no-console - console.log(error); + console.error(error); } } else { scrollToElement(formErrorHeaderId); diff --git a/src/pages/TypesFinancialInstitutions/index.tsx b/src/pages/TypesFinancialInstitutions/index.tsx index 3b98f3471..61b152ce9 100644 --- a/src/pages/TypesFinancialInstitutions/index.tsx +++ b/src/pages/TypesFinancialInstitutions/index.tsx @@ -81,8 +81,8 @@ function TypesFinancialInstitutions(): JSX.Element { try { await mutateAsync(); navigate(`/filing/${filingPeriod}/${lei}/create`); - } catch { - // eslint-disable-next-line no-console + } catch (error) { + console.error(`Unable to update institution type for ${lei}`, error); throw new Error( `[Error][submitUpdateInstitutionTypeSbl] Unable to update institution type for ${lei}`, ); From ab7f05909ef9de2db2bf30159f2b2b5194991cb7 Mon Sep 17 00:00:00 2001 From: tanner-ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:59:00 -0600 Subject: [PATCH 2/6] Finished primary analysis --- .eslintrc.json | 1 + e2e/utils/deleteKeycloakUser.ts | 2 +- e2e/utils/getKeycloakToken.ts | 4 ++-- src/components/Link.utils.tsx | 2 +- src/components/SectionIntro.tsx | 3 --- src/pages/Filing/FilingApp/FilingCreate.tsx | 8 +++----- src/pages/Filing/FilingApp/FilingErrors/index.tsx | 15 ++++----------- .../Filing/FilingApp/FilingProtectedRoute.tsx | 11 +++++++---- .../Filing/FilingApp/FilingWarnings/index.tsx | 14 +++----------- .../FilingApp/InstitutionProtectedRoute.tsx | 7 ++++--- src/pages/ProfileForm/CreateProfileForm/index.tsx | 5 +---- src/pages/Summary/SummaryRoutes.tsx | 5 ++--- src/utils/useInstitutionVerifyAssociation.tsx | 2 +- 13 files changed, 30 insertions(+), 49 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8080dae10..c071e8957 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -117,6 +117,7 @@ "react/no-unused-state": "off", "react/prefer-stateless-function": "off", "react/require-render-return": "off", + "react/require-default-props": "off", "react/sort-comp": "off", "react/state-in-constructor": "off", "react/static-property-placement": "off", diff --git a/e2e/utils/deleteKeycloakUser.ts b/e2e/utils/deleteKeycloakUser.ts index c0881fb11..72d2ed725 100644 --- a/e2e/utils/deleteKeycloakUser.ts +++ b/e2e/utils/deleteKeycloakUser.ts @@ -27,7 +27,7 @@ export default async function deleteKeycloakUser({ try { await kcAdminClient.users.del({ - id: id, + id, }); } catch (error) { // eslint-disable-next-line no-console diff --git a/e2e/utils/getKeycloakToken.ts b/e2e/utils/getKeycloakToken.ts index f5887be60..883190a0b 100644 --- a/e2e/utils/getKeycloakToken.ts +++ b/e2e/utils/getKeycloakToken.ts @@ -14,10 +14,10 @@ export default async function getAdminKeycloakToken(): Promise { data: encodedParameters, }; try { - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 + // Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { data } = await axios.request(optionsForGetAdminKeycloakToken); - // Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 + // Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return data.access_token as string; } catch (error) { diff --git a/src/components/Link.utils.tsx b/src/components/Link.utils.tsx index 092e07685..7b368fbf9 100644 --- a/src/components/Link.utils.tsx +++ b/src/components/Link.utils.tsx @@ -40,7 +40,7 @@ export function IconExternalLink(): ReactElement { return ( <> {' '} - {/* @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 */} + {/* @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 */} ); diff --git a/src/components/SectionIntro.tsx b/src/components/SectionIntro.tsx index 52efa34d4..c0b4f9017 100644 --- a/src/components/SectionIntro.tsx +++ b/src/components/SectionIntro.tsx @@ -3,9 +3,6 @@ import { Heading } from 'design-system-react'; import type { ReactNode } from 'react'; export interface SectionIntroProperties { - // TODO: chore(linting): set react/require-default-props function property to defaultArguments - // https://github.com/cfpb/sbl-frontend/issues/355 - // eslint-disable-next-line react/require-default-props heading?: ReactNode; children: ReactNode; } diff --git a/src/pages/Filing/FilingApp/FilingCreate.tsx b/src/pages/Filing/FilingApp/FilingCreate.tsx index 50ca6851d..ab3ebfab0 100644 --- a/src/pages/Filing/FilingApp/FilingCreate.tsx +++ b/src/pages/Filing/FilingApp/FilingCreate.tsx @@ -1,15 +1,11 @@ -// Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 -// eslint-disable-next-line @typescript-eslint/no-unused-vars import AlertApiUnavailable from 'components/AlertApiUnavailable'; import { LoadingContent } from 'components/Loading'; -// Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 -// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Button } from 'design-system-react'; import { Navigate, useNavigate, useParams } from 'react-router-dom'; import { FILING_STATUS_CODE_FILING_EXISTS } from 'utils/constants'; import useCreateFiling from 'utils/useCreateFiling'; -export function FilingCreate(): JSX.Element | null | undefined { +export function FilingCreate(): JSX.Element { const { lei, year } = useParams(); const navigate = useNavigate(); @@ -46,6 +42,8 @@ export function FilingCreate(): JSX.Element | null | undefined { ); + + return <>; } export default FilingCreate; diff --git a/src/pages/Filing/FilingApp/FilingErrors/index.tsx b/src/pages/Filing/FilingApp/FilingErrors/index.tsx index 0ab60261f..3bbddc00f 100644 --- a/src/pages/Filing/FilingApp/FilingErrors/index.tsx +++ b/src/pages/Filing/FilingApp/FilingErrors/index.tsx @@ -22,7 +22,10 @@ import { FilingNavButtons } from '../FilingNavButtons'; import { InstitutionFetchFailAlert } from '../FilingWarnings/FilingWarningsAlerts'; function FilingErrors(): JSX.Element { - const { lei, year } = useParams(); + const { plei, pyear } = useParams(); + const lei = plei ?? ''; + const year = pyear ?? ''; + const navigate = useNavigate(); const location = useLocation(); @@ -30,14 +33,12 @@ function FilingErrors(): JSX.Element { isFetching: isFetchingGetSubmissionLatest, error: errorGetSubmissionLatest, data: actualDataGetSubmissionLatest, - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 } = useGetSubmissionLatest({ lei, filingPeriod: year }); const { data: institution, isLoading: isLoadingInstitution, isError: isErrorInstitution, - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 } = useInstitutionDetails(lei); const [isStep2, setIsStep2] = useState(false); @@ -207,9 +208,7 @@ function FilingErrors(): JSX.Element { {errorState && actualDataGetSubmissionLatest?.id ? ( @@ -234,9 +233,7 @@ function FilingErrors(): JSX.Element { id='single-field-errors' heading={`Single-field errors: ${singleFieldRowErrorsCount.toLocaleString()} found`} fieldArray={singleFieldErrorsUsed} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 lei={lei} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 filingPeriod={year} submissionId={actualDataGetSubmissionLatest.id} bottomMargin={Boolean(isStep2)} @@ -253,9 +250,7 @@ function FilingErrors(): JSX.Element { id='multi-field-errors' heading={`Multi-field errors: ${multiFieldRowErrorsCount.toLocaleString()} found`} fieldArray={logicErrorsMulti} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 lei={lei} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 filingPeriod={year} submissionId={actualDataGetSubmissionLatest.id} bottomMargin @@ -269,9 +264,7 @@ function FilingErrors(): JSX.Element { id='register-level-errors' heading={`Register-level errors: ${registerLevelRowErrorsCount.toLocaleString()} found`} fieldArray={registerErrors} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 lei={lei} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 filingPeriod={year} submissionId={actualDataGetSubmissionLatest.id} > diff --git a/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx b/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx index efd1cb405..43b5f3473 100644 --- a/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx +++ b/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx @@ -3,7 +3,6 @@ import type { JSX } from 'react'; import { Navigate, useLocation, useParams } from 'react-router-dom'; import { FILING_PAGE_ORDER, NegativeOne, Zero } from 'utils/constants'; import { useFilingAndSubmissionInfo } from 'utils/useFilingAndSubmissionInfo'; -import type { CombinedInfoType } from 'utils/useFilingAndSubmissionInfo'; import { Error500 } from '../../Error/Error500'; import { getFilingSteps } from './FilingSteps.helpers'; @@ -31,10 +30,14 @@ export function FilingProtectedRoute({ if (isLoading) return ; - if (error) - return ; + if (error || typeof submission === 'string' || !submission) + return ( + + ); - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 + // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 const { nextStepIndex } = getFilingSteps(submission, filing); const targetPage = location.pathname.split('/').slice(NegativeOne)[Zero]; diff --git a/src/pages/Filing/FilingApp/FilingWarnings/index.tsx b/src/pages/Filing/FilingApp/FilingWarnings/index.tsx index 75e219f07..6bc5c853e 100644 --- a/src/pages/Filing/FilingApp/FilingWarnings/index.tsx +++ b/src/pages/Filing/FilingApp/FilingWarnings/index.tsx @@ -37,7 +37,9 @@ const isSubmissionAccepted = (submission?: SubmissionResponse): boolean => { function FilingWarnings(): JSX.Element { const navigate = useNavigate(); const queryClient = useQueryClient(); - const { lei, year } = useParams(); + const { plei, pyear } = useParams(); + const lei = plei ?? ''; + const year = pyear ?? ''; const [boxChecked, setBoxChecked] = useState(false); const [formSubmitError, setFormSubmitError] = useState(false); const [hasVerifyError, setHasVerifyError] = useState(false); @@ -46,14 +48,12 @@ function FilingWarnings(): JSX.Element { data: submission, isLoading: isSubmissionLoading, isError: errorSubmissionFetch, - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 } = useGetSubmissionLatest({ lei, filingPeriod: year }); const { data: institution, isLoading: isInstitutionLoading, isError: errorInstitutionFetch, - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 } = useInstitutionDetails(lei); const formattedData = useMemo( @@ -90,9 +90,7 @@ function FilingWarnings(): JSX.Element { mutateAsync: mutateSubmitWarningsAccept, isLoading: isLoadingSubmitWarningsAccept, } = useSubmitWarningsAccept({ - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 lei, - // @ts-expect-error Part of code cleanup for post-mvp see: https://github.com/cfpb/sbl-frontend/issues/717 filingPeriod: year, }); @@ -163,9 +161,7 @@ function FilingWarnings(): JSX.Element { submission?.id ? ( @@ -189,9 +185,7 @@ function FilingWarnings(): JSX.Element { id='single-field-warnings' heading={`Single-field warnings: ${singleFieldRowWarningsCount.toLocaleString()} found`} fieldArray={logicWarningsSingle} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 lei={lei} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 filingPeriod={year} submissionId={submission.id} isWarning @@ -207,9 +201,7 @@ function FilingWarnings(): JSX.Element { id='multi-field-warnings' heading={`Multi-field warnings: ${multiFieldRowWarningsCount.toLocaleString()} found`} fieldArray={logicWarningsMulti} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 lei={lei} - // @ts-expect-error Part of evaluation for linter issues see: https://github.com/cfpb/sbl-frontend/issues/1039 filingPeriod={year} submissionId={submission.id} isWarning diff --git a/src/pages/Filing/FilingApp/InstitutionProtectedRoute.tsx b/src/pages/Filing/FilingApp/InstitutionProtectedRoute.tsx index a2b65367c..822429b50 100644 --- a/src/pages/Filing/FilingApp/InstitutionProtectedRoute.tsx +++ b/src/pages/Filing/FilingApp/InstitutionProtectedRoute.tsx @@ -27,9 +27,10 @@ export function InstitutionProtectedRoute({ return ( ); diff --git a/src/pages/ProfileForm/CreateProfileForm/index.tsx b/src/pages/ProfileForm/CreateProfileForm/index.tsx index a00f57ffe..4569b5320 100644 --- a/src/pages/ProfileForm/CreateProfileForm/index.tsx +++ b/src/pages/ProfileForm/CreateProfileForm/index.tsx @@ -77,7 +77,7 @@ function CreateProfileForm(): JSX.Element { const { mutateAsync: mutateSubmitUserProfile } = useSubmitUserProfile(); const { mutateAsync: mutateSubmitUserProfileFi } = useSubmitUserProfileFi(); - const onSubmitButtonAction = async (): Promise => { + const onSubmitButtonAction = async (): void => { const passesValidation = await trigger(); if (passesValidation) { try { @@ -170,9 +170,6 @@ function CreateProfileForm(): JSX.Element {