From 3f6eab3aee37b155a742581c30b413b48705a012 Mon Sep 17 00:00:00 2001 From: Tanner Ricks <182143365+tanner-ricks@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:25:42 -0600 Subject: [PATCH] [Bug] Triage existing linting issues (#1060) Went through several linter issues and fixed most ## Changes - Went through and found areas of easy linter improvements and fixed them. - Went through and found areas referencing this ticket and either fixed them, or put them under the umbrella of the post-mvp linter issues. ## How to test this PR 1. Pull the branch for the sbl-frontend repo 2. Restart the stack as necessary 3. Check the github pipeline and make sure that linters are green 4. Run the e2e tests and verify no new failures --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .eslintrc.json | 9 +++- e2e/utils/createDomainAssociation.ts | 2 - e2e/utils/createInstitution.ts | 3 +- e2e/utils/createKeycloakUser.ts | 8 +-- e2e/utils/deleteKeycloakUser.ts | 2 +- e2e/utils/getKeycloakToken.ts | 8 ++- e2e/utils/verifyDownloadableReport.ts | 1 - src/App.tsx | 52 +++++-------------- src/api/requests/downloadValidationReport.ts | 4 +- src/components/Link.utils.tsx | 2 +- src/components/SectionIntro.tsx | 3 -- src/pages/Error/_shared.tsx | 6 +-- .../Filing/FilingApp/FileSubmission.data.tsx | 2 - src/pages/Filing/FilingApp/FilingCreate.tsx | 8 ++- .../Filing/FilingApp/FilingErrors/index.tsx | 15 ++---- .../Filing/FilingApp/FilingProtectedRoute.tsx | 14 ++--- .../Filing/FilingApp/FilingWarnings/index.tsx | 14 ++--- .../FilingApp/InstitutionProtectedRoute.tsx | 7 +-- .../Filing/UpdateFinancialProfile/UfpForm.tsx | 5 +- .../AffiliateInformation.tsx | 2 +- .../FinancialInstitutionDetails.tsx | 2 +- .../IdentifyingInformation.tsx | 2 +- src/pages/FilingDetails/index.tsx | 3 +- .../ProfileForm/CreateProfileForm/index.tsx | 8 +-- src/pages/Summary/SummaryRoutes.tsx | 5 +- .../TypesFinancialInstitutions/index.tsx | 4 +- src/utils/useInstitutionVerifyAssociation.tsx | 2 +- 27 files changed, 67 insertions(+), 126 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 42c3ef976..1da73d0b3 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", @@ -110,6 +116,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", @@ -149,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 13c4435e1..a31a45f49 100644 --- a/e2e/utils/createInstitution.ts +++ b/e2e/utils/createInstitution.ts @@ -50,8 +50,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/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 9956f4224..883190a0b 100644 --- a/e2e/utils/getKeycloakToken.ts +++ b/e2e/utils/getKeycloakToken.ts @@ -14,16 +14,14 @@ 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) { - // 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..cee95d315 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,17 @@ function ProtectedRoute({ if (!isInitialAuthorizationLoading && !isAuthenticated) { void onLogin(); - return null; + return <>; } if (isAnyAuthorizationLoading) return ; + if (!UserProfile) { + throw new Error('User Profile does not exist'); + } + const isUserAssociatedWithAnyInstitution = - UserProfile.institutions.length > 0; + (UserProfile?.institutions?.length ?? 0) > 0; if (!isUserAssociatedWithAnyInstitution && !isProfileFormPath) return ; if (isProfileFormPath && isUserAssociatedWithAnyInstitution) @@ -240,19 +242,12 @@ export default function App(): ReactElement { }> - - } - > + }> } /> {import.meta.env.DEV ? ( @@ -262,7 +257,6 @@ export default function App(): ReactElement { @@ -273,7 +267,6 @@ export default function App(): ReactElement { @@ -287,11 +280,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 +292,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 +310,6 @@ export default function App(): ReactElement { @@ -333,7 +322,6 @@ export default function App(): ReactElement { @@ -346,7 +334,6 @@ export default function App(): ReactElement { @@ -359,7 +346,6 @@ export default function App(): ReactElement { @@ -368,7 +354,6 @@ export default function App(): ReactElement { @@ -377,7 +362,6 @@ export default function App(): ReactElement { @@ -388,7 +372,6 @@ export default function App(): ReactElement { @@ -399,7 +382,6 @@ export default function App(): ReactElement { @@ -408,7 +390,6 @@ export default function App(): ReactElement {
@@ -419,7 +400,6 @@ export default function App(): ReactElement {
@@ -430,7 +410,6 @@ export default function App(): ReactElement { @@ -439,7 +418,6 @@ export default function App(): ReactElement { @@ -448,7 +426,6 @@ export default function App(): ReactElement { @@ -459,7 +436,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/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/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/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 9f58079f7..f39468f3f 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 { lei: plei, year: 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); @@ -209,9 +210,7 @@ function FilingErrors(): JSX.Element { actualDataGetSubmissionLatest?.counter ? ( @@ -236,9 +235,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)} @@ -255,9 +252,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 @@ -271,9 +266,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 b8d03d3b5..43b5f3473 100644 --- a/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx +++ b/src/pages/Filing/FilingApp/FilingProtectedRoute.tsx @@ -30,12 +30,14 @@ 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 + if (error || typeof submission === 'string' || !submission) + return ( + + ); + + // @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 7e5c779f8..6ce54b01a 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 { lei: plei, year: 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, }); @@ -164,9 +162,7 @@ function FilingWarnings(): JSX.Element { submission?.counter ? ( @@ -190,9 +186,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 @@ -208,9 +202,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/Filing/UpdateFinancialProfile/UfpForm.tsx b/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx index a26a1934b..7e62bfeb0 100644 --- a/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx +++ b/src/pages/Filing/UpdateFinancialProfile/UfpForm.tsx @@ -31,7 +31,7 @@ import buildProfileFormDefaults from './buildProfileFormDefaults'; import { formErrorsOrder } from './formErrorsOrder'; export default function UFPForm({ - data, + data = {} as InstitutionDetailsApiType, isError = false, }: { data: InstitutionDetailsApiType | undefined; @@ -93,8 +93,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/Filing/ViewInstitutionProfile/AffiliateInformation.tsx b/src/pages/Filing/ViewInstitutionProfile/AffiliateInformation.tsx index af7722118..4075ef183 100644 --- a/src/pages/Filing/ViewInstitutionProfile/AffiliateInformation.tsx +++ b/src/pages/Filing/ViewInstitutionProfile/AffiliateInformation.tsx @@ -20,7 +20,7 @@ const defaultDescription = ( ); export function AffiliateInformation({ - data, + data = {} as InstitutionDetailsApiType, heading = 'Parent entity information (if applicable)', description = defaultDescription, }: { diff --git a/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx b/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx index 87d95dd30..40c3a388f 100644 --- a/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx +++ b/src/pages/Filing/ViewInstitutionProfile/FinancialInstitutionDetails.tsx @@ -38,7 +38,7 @@ const defaultDescription = ( ); export function FinancialInstitutionDetails({ - data, + data = {} as InstitutionDetailsApiType, heading, isDomainsVisible = true, description = defaultDescription, diff --git a/src/pages/Filing/ViewInstitutionProfile/IdentifyingInformation.tsx b/src/pages/Filing/ViewInstitutionProfile/IdentifyingInformation.tsx index 63b15420b..d735413a5 100644 --- a/src/pages/Filing/ViewInstitutionProfile/IdentifyingInformation.tsx +++ b/src/pages/Filing/ViewInstitutionProfile/IdentifyingInformation.tsx @@ -21,7 +21,7 @@ const defaultDescription = ( ); export function IdentifyingInformation({ - data, + data = {} as InstitutionDetailsApiType, heading = 'Financial institution identifying information', description = defaultDescription, alertStatus, 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..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 { @@ -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); @@ -171,9 +170,6 @@ function CreateProfileForm(): JSX.Element {