From 153692de6fc2f33d4faac60a62bc5788609bdfaf Mon Sep 17 00:00:00 2001 From: Samuel Therrien Date: Thu, 14 Nov 2024 22:29:16 -0500 Subject: [PATCH] Nitpicks to reduce changes from #279 --- .../src/components/analytics/SiteSuccessRatesChart.tsx | 1 + .../src/components/inputs/MultipleSelectChip.tsx | 2 +- .../src/components/settings/AdminInvitationDialog.tsx | 2 +- canopeum_frontend/src/components/settings/EditProfile.tsx | 4 ++-- canopeum_frontend/src/models/Coordinate.ts | 3 ++- canopeum_frontend/src/pages/Login.tsx | 4 ++-- canopeum_frontend/src/pages/Register.tsx | 6 +++--- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/canopeum_frontend/src/components/analytics/SiteSuccessRatesChart.tsx b/canopeum_frontend/src/components/analytics/SiteSuccessRatesChart.tsx index 355fa2d1d..d45fc5695 100644 --- a/canopeum_frontend/src/components/analytics/SiteSuccessRatesChart.tsx +++ b/canopeum_frontend/src/components/analytics/SiteSuccessRatesChart.tsx @@ -58,6 +58,7 @@ const SiteSuccessRatesChart = ({ siteSummaries }: Props) => { const renderChartTooltip = (props: ChartsAxisContentProps) => { const selectedSerie = props.series.find(serie => serie.id === props.axisValue) + // @typescript-eslint/no-unsafe-type-assertion -- value type is known from the context const data = selectedSerie?.data.find(value => !!value) as number | undefined return ( diff --git a/canopeum_frontend/src/components/inputs/MultipleSelectChip.tsx b/canopeum_frontend/src/components/inputs/MultipleSelectChip.tsx index 8c7b647e9..7edff7af8 100644 --- a/canopeum_frontend/src/components/inputs/MultipleSelectChip.tsx +++ b/canopeum_frontend/src/components/inputs/MultipleSelectChip.tsx @@ -66,7 +66,7 @@ const MultipleSelectChip = ( { // TODO(NicolasDontigny): Find a more efficient way - // map values to their display text here + // to map values to their display text here } {selected .map(value => options.find(option => option.value === value)) diff --git a/canopeum_frontend/src/components/settings/AdminInvitationDialog.tsx b/canopeum_frontend/src/components/settings/AdminInvitationDialog.tsx index d65c8ccfe..ceb4a454f 100644 --- a/canopeum_frontend/src/components/settings/AdminInvitationDialog.tsx +++ b/canopeum_frontend/src/components/settings/AdminInvitationDialog.tsx @@ -124,7 +124,7 @@ const AdminInvitationDialog = ({ open, handleClose }: Props) => { emailError ? 'is-invalid' : '' - } `} + }`} id='email-input' onBlur={() => validateEmail()} onChange={event => setEmail(event.target.value)} diff --git a/canopeum_frontend/src/components/settings/EditProfile.tsx b/canopeum_frontend/src/components/settings/EditProfile.tsx index ead9672dc..5752688c5 100644 --- a/canopeum_frontend/src/components/settings/EditProfile.tsx +++ b/canopeum_frontend/src/components/settings/EditProfile.tsx @@ -291,7 +291,7 @@ const EditProfile = () => { Could be fixed by creating a global Input component */ ? 'is-invalid' : '' - } `} + }`} id='password-input' onBlur={() => validateCurrentPassword()} onChange={event => setCurrentPassword(event.target.value)} @@ -314,7 +314,7 @@ const EditProfile = () => { newPasswordError ? 'is-invalid' : '' - } `} + }`} id='password-input' onBlur={() => validateNewPassword()} onChange={event => setNewPassword(event.target.value)} diff --git a/canopeum_frontend/src/models/Coordinate.ts b/canopeum_frontend/src/models/Coordinate.ts index 938029176..1d7e46c05 100644 --- a/canopeum_frontend/src/models/Coordinate.ts +++ b/canopeum_frontend/src/models/Coordinate.ts @@ -35,7 +35,8 @@ export const extractCoordinate = (coordinates: string) => { const char3 = coordinates.indexOf('.') const char4 = coordinates.indexOf('"') - /* NOTE: It should be impossible for the nullish coalescence to happen here, + /* @typescript-eslint/no-unsafe-type-assertion -- + NOTE: It should be impossible for the nullish coalescence to happen here, We're also type-guarding the string union immediatly after */ const cardinal = coordinates.at(-1) as Cardinal if (!(VALID_CARDINALS.includes(cardinal))) { diff --git a/canopeum_frontend/src/pages/Login.tsx b/canopeum_frontend/src/pages/Login.tsx index 09a87b056..a314fd8da 100644 --- a/canopeum_frontend/src/pages/Login.tsx +++ b/canopeum_frontend/src/pages/Login.tsx @@ -93,7 +93,7 @@ const Login = () => { emailError ? 'is-invalid' : '' - } `} + }`} id='email-input' onBlur={() => validateEmail()} onChange={event => setEmail(event.target.value)} @@ -113,7 +113,7 @@ const Login = () => { passwordError ? 'is-invalid' : '' - } `} + }`} id='password-input' onBlur={() => validatePassword()} onChange={event => setPassword(event.target.value)} diff --git a/canopeum_frontend/src/pages/Register.tsx b/canopeum_frontend/src/pages/Register.tsx index 45cb2a6ca..9b6ec87bc 100644 --- a/canopeum_frontend/src/pages/Register.tsx +++ b/canopeum_frontend/src/pages/Register.tsx @@ -187,7 +187,7 @@ const Register = () => { -- Create an Input Component? */ ? 'is-invalid' : '' - } `} + }`} id='username-input' onBlur={() => validateUsername()} onChange={event => setUsername(event.target.value)} @@ -208,7 +208,7 @@ const Register = () => { emailError ? 'is-invalid' : '' - } `} + }`} disabled={!!userInvitation} id='email-input' onBlur={() => validateEmail()} @@ -235,7 +235,7 @@ const Register = () => { passwordError ? 'is-invalid' : '' - } `} + }`} id='password-input' onBlur={() => validatePassword()} onChange={event => setPassword(event.target.value)}