Create codemod for addressing ESLint warnings (#10032)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useCallback, useEffect} from 'react'
|
||||
import {StyleSheet} from 'react-native'
|
||||
|
||||
// @ts-ignore web only, we will always redirect to the app on web (CORS)
|
||||
@@ -15,7 +15,7 @@ export function CaptchaWebView({
|
||||
onSuccess: (code: string) => void
|
||||
onError: (error: unknown) => void
|
||||
}) {
|
||||
React.useEffect(() => {
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
onError({
|
||||
errorMessage: 'User did not complete the captcha within 30 seconds',
|
||||
@@ -27,7 +27,7 @@ export function CaptchaWebView({
|
||||
}
|
||||
}, [onError])
|
||||
|
||||
const onLoad = React.useCallback(() => {
|
||||
const onLoad = useCallback(() => {
|
||||
// @ts-ignore web
|
||||
const frame: HTMLIFrameElement = document.getElementById(
|
||||
'captcha-iframe',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {useEffect, useState} from 'react'
|
||||
import {useCallback, useEffect, useMemo, useState} from 'react'
|
||||
import {ActivityIndicator, Platform, View} from 'react-native'
|
||||
import ReactNativeDeviceAttest from 'react-native-device-attest'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
@@ -75,10 +75,10 @@ function StepCaptchaInner({
|
||||
const theme = useTheme()
|
||||
const {state, dispatch} = useSignupContext()
|
||||
|
||||
const [completed, setCompleted] = React.useState(false)
|
||||
const [completed, setCompleted] = useState(false)
|
||||
|
||||
const stateParam = React.useMemo(() => nanoid(15), [])
|
||||
const url = React.useMemo(() => {
|
||||
const stateParam = useMemo(() => nanoid(15), [])
|
||||
const url = useMemo(() => {
|
||||
const newUrl = new URL(state.serviceUrl)
|
||||
newUrl.pathname = CAPTCHA_PATH
|
||||
newUrl.searchParams.set(
|
||||
@@ -107,7 +107,7 @@ function StepCaptchaInner({
|
||||
payload,
|
||||
])
|
||||
|
||||
const onSuccess = React.useCallback(
|
||||
const onSuccess = useCallback(
|
||||
(code: string) => {
|
||||
setCompleted(true)
|
||||
ax.metric('signup:captchaSuccess', {})
|
||||
@@ -119,7 +119,7 @@ function StepCaptchaInner({
|
||||
[ax, dispatch],
|
||||
)
|
||||
|
||||
const onError = React.useCallback(
|
||||
const onError = useCallback(
|
||||
(error?: unknown) => {
|
||||
dispatch({
|
||||
type: 'setError',
|
||||
@@ -134,7 +134,7 @@ function StepCaptchaInner({
|
||||
[_, ax, dispatch, state.handle],
|
||||
)
|
||||
|
||||
const onBackPress = React.useCallback(() => {
|
||||
const onBackPress = useCallback(() => {
|
||||
logger.error('Signup Flow Error', {
|
||||
errorMessage:
|
||||
'User went back from captcha step. Possibly encountered an error.',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {useRef} from 'react'
|
||||
import {useEffect, useRef, useState} from 'react'
|
||||
import {type TextInput, View} from 'react-native'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -89,10 +89,10 @@ export function StepInfo({
|
||||
: true
|
||||
const isDeviceGeolocationGranted = useIsDeviceGeolocationGranted()
|
||||
|
||||
const [hasWarnedEmail, setHasWarnedEmail] = React.useState<boolean>(false)
|
||||
const [hasWarnedEmail, setHasWarnedEmail] = useState<boolean>(false)
|
||||
|
||||
const tldtsRef = React.useRef<typeof tldts>(undefined)
|
||||
React.useEffect(() => {
|
||||
const tldtsRef = useRef<typeof tldts>(undefined)
|
||||
useEffect(() => {
|
||||
// @ts-expect-error - valid path
|
||||
import('tldts/dist/index.cjs.min.js').then(tldts => {
|
||||
tldtsRef.current = tldts
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {useCallback} from 'react'
|
||||
import {createContext, useCallback, useContext} from 'react'
|
||||
import {LayoutAnimation} from 'react-native'
|
||||
import {
|
||||
ComAtprotoServerCreateAccount,
|
||||
@@ -250,9 +250,9 @@ interface IContext {
|
||||
state: SignupState
|
||||
dispatch: React.Dispatch<SignupAction>
|
||||
}
|
||||
export const SignupContext = React.createContext<IContext>({} as IContext)
|
||||
export const SignupContext = createContext<IContext>({} as IContext)
|
||||
SignupContext.displayName = 'SignupContext'
|
||||
export const useSignupContext = () => React.useContext(SignupContext)
|
||||
export const useSignupContext = () => useContext(SignupContext)
|
||||
|
||||
export function useSubmitSignup() {
|
||||
const ax = useAnalytics()
|
||||
|
||||
Reference in New Issue
Block a user