Address lint warnings (#10188)

This commit is contained in:
DS Boyce
2026-04-08 15:54:43 -07:00
committed by GitHub
parent e4b4e48acb
commit d0d00ba9f8
15 changed files with 170 additions and 173 deletions
@@ -48,9 +48,9 @@ export function CaptchaWebView({
return
}
onSuccess(code)
} catch (e: unknown) {
} catch (e) {
// We don't actually want to record an error here, because this will happen quite a bit. We will only be able to
// get hte href of the iframe if it's on our domain, so all the hcaptcha requests will throw here, although it's
// get the href of the iframe if it's on our domain, so all the hcaptcha requests will throw here, although it's
// harmless. Our other indicators of time-to-complete and back press should be more reliable in catching issues.
}
}, [stateParam, onSuccess, onError])
+3 -2
View File
@@ -34,7 +34,7 @@ export function StepCaptchaNative() {
const [ready, setReady] = useState(false)
useEffect(() => {
;(async () => {
void (async () => {
logger.debug('trying to generate attestation token...')
try {
if (IS_IOS) {
@@ -48,7 +48,8 @@ export function StepCaptchaNative() {
setToken(token)
setPayload(base64UrlEncode(payload))
}
} catch (e: any) {
} catch (err) {
const e = err as Error
logger.error(e)
} finally {
setReady(true)
+18 -24
View File
@@ -1,8 +1,6 @@
import {useEffect, useRef, useState} from 'react'
import {type TextInput, View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Plural, Trans} from '@lingui/react/macro'
import {Plural, Trans, useLingui} from '@lingui/react/macro'
import * as EmailValidator from 'email-validator'
import type tldts from 'tldts'
@@ -60,7 +58,7 @@ export function StepInfo({
refetchServer: () => void
isLoadingStarterPack: boolean
}) {
const {_} = useLingui()
const {t: l} = useLingui()
const ax = useAnalytics()
const {state, dispatch} = useSignupContext()
const preemptivelyCompleteActivePolicyUpdate =
@@ -94,12 +92,12 @@ export function StepInfo({
const tldtsRef = useRef<typeof tldts>(undefined)
useEffect(() => {
// @ts-expect-error - valid path
import('tldts/dist/index.cjs.min.js').then(tldts => {
void import('tldts/dist/index.cjs.min.js').then(tldts => {
tldtsRef.current = tldts
})
// This will get used in the avatar creator a few steps later, so lets preload it now
// @ts-expect-error - valid path
import('react-native-view-shot/src/index')
void import('react-native-view-shot/src/index')
}, [])
const onNextPress = () => {
@@ -115,21 +113,21 @@ export function StepInfo({
if (state.serviceDescription?.inviteCodeRequired && !inviteCode) {
return dispatch({
type: 'setError',
value: _(msg`Please enter your invite code.`),
value: l`Please enter your invite code.`,
field: 'invite-code',
})
}
if (!email) {
return dispatch({
type: 'setError',
value: _(msg`Please enter your email.`),
value: l`Please enter your email.`,
field: 'email',
})
}
if (!EmailValidator.validate(email)) {
return dispatch({
type: 'setError',
value: _(msg`Your email appears to be invalid.`),
value: l`Your email appears to be invalid.`,
field: 'email',
})
}
@@ -139,9 +137,7 @@ export function StepInfo({
setHasWarnedEmail(true)
return dispatch({
type: 'setError',
value: _(
msg`Please double-check that you have entered your email address correctly.`,
),
value: l`Please double-check that you have entered your email address correctly.`,
})
}
} else if (hasWarnedEmail) {
@@ -151,14 +147,14 @@ export function StepInfo({
if (!password) {
return dispatch({
type: 'setError',
value: _(msg`Please choose your password.`),
value: l`Please choose your password.`,
field: 'password',
})
}
if (password.length < 8) {
return dispatch({
type: 'setError',
value: _(msg`Your password must be at least 8 characters long.`),
value: l`Your password must be at least 8 characters long.`,
field: 'password',
})
}
@@ -205,7 +201,7 @@ export function StepInfo({
dispatch({type: 'clearError'})
}
}}
label={_(msg`Required for this provider`)}
label={l`Required for this provider`}
defaultValue={state.inviteCode}
autoCapitalize="none"
autoComplete="email"
@@ -241,7 +237,7 @@ export function StepInfo({
dispatch({type: 'clearError'})
}
}}
label={_(msg`Enter your email address`)}
label={l`Enter your email address`}
defaultValue={state.email}
autoCapitalize="none"
autoComplete="email"
@@ -269,7 +265,7 @@ export function StepInfo({
dispatch({type: 'clearError'})
}
}}
label={_(msg`Choose your password`)}
label={l`Choose your password`}
defaultValue={state.password}
secureTextEntry
autoComplete="new-password"
@@ -297,8 +293,8 @@ export function StepInfo({
value: sanitizeDate(new Date(date)),
})
}}
label={_(msg`Date of birth`)}
accessibilityHint={_(msg`Select your date of birth`)}
label={l`Date of birth`}
accessibilityHint={l`Select your date of birth`}
maximumDate={new Date()}
/>
</View>
@@ -331,9 +327,7 @@ export function StepInfo({
<Trans>
Have we got your location wrong?{' '}
<SimpleInlineLinkText
label={_(
msg`Tap here to confirm your location with GPS.`,
)}
label={l`Tap here to confirm your location with GPS.`}
{...createStaticClick(() => {
locationControl.open()
})}>
@@ -363,7 +357,7 @@ export function StepInfo({
props.closeDialog(() => {
// set this after close!
setDeviceGeolocation(props.geolocation)
Toast.show(_(msg`Your location has been updated.`), {
Toast.show(l`Your location has been updated.`, {
type: 'success',
})
})
@@ -380,7 +374,7 @@ export function StepInfo({
onBackPress={onPressBack}
onNextPress={onNextPress}
onRetryPress={refetchServer}
overrideNextText={hasWarnedEmail ? _(msg`It's correct`) : undefined}
overrideNextText={hasWarnedEmail ? l`It's correct` : undefined}
/>
</>
)
+12 -13
View File
@@ -3,9 +3,7 @@ import {AppState, type AppStateStatus, View} from 'react-native'
import ReactNativeDeviceAttest from 'react-native-device-attest'
import Animated, {FadeIn, LayoutAnimationConfig} from 'react-native-reanimated'
import {AppBskyGraphStarterpack} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {Trans, useLingui} from '@lingui/react/macro'
import {FEEDBACK_FORM_URL} from '#/lib/constants'
import {logger} from '#/logger'
@@ -36,7 +34,7 @@ import * as bsky from '#/types/bsky'
export function Signup({onPressBack}: {onPressBack: () => void}) {
const ax = useAnalytics()
const {_} = useLingui()
const {t: l} = useLingui()
const t = useTheme()
const [state, dispatch] = useReducer(reducer, {
...initialState,
@@ -61,6 +59,7 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
uri: activeStarterPack?.uri,
})
// eslint-disable-next-line react/hook-use-state
const [isFetchedAtMount] = useState(starterPack != null)
const showStarterPackCard =
activeStarterPack?.uri && !isFetchingStarterPack && starterPack
@@ -85,21 +84,21 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
dispatch({type: 'setServiceDescription', value: undefined})
dispatch({
type: 'setError',
value: _(
msg`Unable to contact your service. Please check your Internet connection.`,
),
value: l`Unable to contact your service. Please check your Internet connection.`,
})
} else if (serviceInfo) {
dispatch({type: 'setServiceDescription', value: serviceInfo})
dispatch({type: 'setError', value: ''})
}
}, [_, serviceInfo, isError])
}, [l, serviceInfo, isError])
useEffect(() => {
if (state.pendingSubmit) {
if (!state.pendingSubmit.mutableProcessed) {
// OK to mutate assuming it's never read in render.
// eslint-disable-next-line react-hooks/immutability, react-compiler/react-compiler
state.pendingSubmit.mutableProcessed = true
submit(state, dispatch)
void submit(state, dispatch)
}
}
}, [state, dispatch, submit])
@@ -133,8 +132,8 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
<SignupContext.Provider value={{state, dispatch}}>
<LoggedOutLayout
leadin=""
title={_(msg`Create Account`)}
description={_(msg`We're so excited to have you join us!`)}
title={l`Create account`}
description={l`Were so excited to have you join us!`}
scrollable>
<View testID="createAccount" style={a.flex_1}>
{showStarterPackCard &&
@@ -204,7 +203,7 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
isFetchingStarterPack && !isErrorStarterPack
}
isServerError={isError}
refetchServer={refetch}
refetchServer={() => void refetch()}
/>
) : state.activeStep === SignupStep.HANDLE ? (
<StepHandle />
@@ -231,7 +230,7 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
]}>
<Trans>Having trouble?</Trans>{' '}
<InlineLinkText
label={_(msg`Contact support`)}
label={l`Contact support`}
to={FEEDBACK_FORM_URL({email: state.email})}
style={[!gtMobile && a.text_md]}>
<Trans>Contact support</Trans>
+14 -14
View File
@@ -4,8 +4,7 @@ import {
ComAtprotoServerCreateAccount,
type ComAtprotoServerDescribeServer,
} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
import * as EmailValidator from 'email-validator'
import {DEFAULT_SERVICE} from '#/lib/constants'
@@ -18,7 +17,9 @@ import {type AnalyticsContextType, useAnalytics} from '#/analytics'
export type ServiceDescription = ComAtprotoServerDescribeServer.OutputSchema
const DEFAULT_DATE = new Date(Date.now() - 60e3 * 60 * 24 * 365 * 20) // default to 20 years ago
const date = new Date()
date.setFullYear(date.getFullYear() - 20) // default to 20 years ago
const DEFAULT_DATE = date
export enum SignupStep {
INFO,
@@ -256,7 +257,7 @@ export const useSignupContext = () => useContext(SignupContext)
export function useSubmitSignup() {
const ax = useAnalytics()
const {_} = useLingui()
const {t: l} = useLingui()
const {createAccount} = useSessionApi()
const onboardingDispatch = useOnboardingDispatch()
@@ -266,7 +267,7 @@ export function useSubmitSignup() {
dispatch({type: 'setStep', value: SignupStep.INFO})
return dispatch({
type: 'setError',
value: _(msg`Please enter your email.`),
value: l`Please enter your email.`,
field: 'email',
})
}
@@ -274,7 +275,7 @@ export function useSubmitSignup() {
dispatch({type: 'setStep', value: SignupStep.INFO})
return dispatch({
type: 'setError',
value: _(msg`Your email appears to be invalid.`),
value: l`Your email appears to be invalid.`,
field: 'email',
})
}
@@ -282,7 +283,7 @@ export function useSubmitSignup() {
dispatch({type: 'setStep', value: SignupStep.INFO})
return dispatch({
type: 'setError',
value: _(msg`Please choose your password.`),
value: l`Please choose your password.`,
field: 'password',
})
}
@@ -290,7 +291,7 @@ export function useSubmitSignup() {
dispatch({type: 'setStep', value: SignupStep.HANDLE})
return dispatch({
type: 'setError',
value: _(msg`Please choose your handle.`),
value: l`Please choose your handle.`,
field: 'handle',
})
}
@@ -305,7 +306,7 @@ export function useSubmitSignup() {
})
return dispatch({
type: 'setError',
value: _(msg`Please complete the verification captcha.`),
value: l`Please complete the verification captcha.`,
})
}
dispatch({type: 'setError', value: ''})
@@ -337,14 +338,13 @@ export function useSubmitSignup() {
* createAccount fails, one tab is not stuck in onboarding — Eric
*/
onboardingDispatch({type: 'start'})
} catch (e: any) {
} catch (err) {
const e = err as Error
let errMsg = e.toString()
if (e instanceof ComAtprotoServerCreateAccount.InvalidInviteCodeError) {
dispatch({
type: 'setError',
value: _(
msg`Invite code not accepted. Check that you input it correctly and try again.`,
),
value: l`Invite code not accepted. Check that you input it correctly and try again.`,
field: 'invite-code',
})
dispatch({type: 'setStep', value: SignupStep.INFO})
@@ -370,6 +370,6 @@ export function useSubmitSignup() {
dispatch({type: 'setIsLoading', value: false})
}
},
[_, onboardingDispatch, createAccount],
[l, ax.logger, createAccount, onboardingDispatch],
)
}