Create codemod for addressing ESLint warnings (#10032)

This commit is contained in:
DS Boyce
2026-03-11 15:51:31 -07:00
committed by GitHub
parent 80429ec902
commit 1db01a09a8
240 changed files with 1560 additions and 1347 deletions
@@ -1,4 +1,11 @@
import React from 'react'
import {
useCallback,
useEffect,
useMemo,
useReducer,
useRef,
useState,
} from 'react'
import {Pressable, type ScrollView, View} from 'react-native'
import {type AppBskyLabelerDefs, BSKY_LABELER_DID} from '@atproto/api'
import {msg} from '@lingui/core/macro'
@@ -66,11 +73,11 @@ export function ReportDialog(
},
) {
const ax = useAnalytics()
const subject = React.useMemo(
const subject = useMemo(
() => (props.subject ? parseReportSubject(props.subject) : undefined),
[props.subject],
)
const onClose = React.useCallback(() => {
const onClose = useCallback(() => {
ax.metric('reportDialog:close', {})
}, [ax])
return (
@@ -108,7 +115,7 @@ function Inner(props: ReportDialogProps) {
const logger = ax.logger.useChild(ax.logger.Context.ReportDialog)
const t = useTheme()
const {_} = useLingui()
const ref = React.useRef<ScrollView>(null)
const ref = useRef<ScrollView>(null)
const {
data: allLabelers,
isLoading: isLabelerLoading,
@@ -118,14 +125,14 @@ function Inner(props: ReportDialogProps) {
const isLoading = useDelayedLoading(500, isLabelerLoading)
const copy = useCopyForSubject(props.subject)
const {categories, getCategory} = useReportOptions()
const [state, dispatch] = React.useReducer(reducer, initialState)
const [state, dispatch] = useReducer(reducer, initialState)
/**
* Submission handling
*/
const {mutateAsync: submitReport} = useSubmitReportMutation()
const [isPending, setPending] = React.useState(false)
const [isSuccess, setSuccess] = React.useState(false)
const [isPending, setPending] = useState(false)
const [isSuccess, setSuccess] = useState(false)
// some reasons ONLY go to Bluesky
const isBskyOnlyReason = state?.selectedOption?.reason
@@ -139,7 +146,7 @@ function Inner(props: ReportDialogProps) {
/**
* Labelers that support this `subject` and its NSID collection
*/
const supportedLabelers = React.useMemo(() => {
const supportedLabelers = useMemo(() => {
if (!allLabelers) return []
return allLabelers
.filter(l => {
@@ -169,7 +176,8 @@ function Inner(props: ReportDialogProps) {
if (supportedReasonTypes === undefined) return true
return (
// supports new reason type
supportedReasonTypes.includes(state.selectedOption.reason) || // supports old reason type (backwards compat)
// supports old reason type (backwards compat)
supportedReasonTypes.includes(state.selectedOption.reason) ||
supportedReasonTypes.includes(
NEW_TO_OLD_REASONS_MAP[state.selectedOption.reason],
)
@@ -194,7 +202,7 @@ function Inner(props: ReportDialogProps) {
const isAlwaysBskyLabeler =
hasSingleSupportedLabeler && (isBskyOnlyReason || isBskyOnlySubject)
const onSubmit = React.useCallback(async () => {
const onSubmit = useCallback(async () => {
dispatch({type: 'clearError'})
logger.info('submitting')
@@ -587,7 +595,7 @@ function ActionOnce({
check: () => boolean
callback: () => void
}) {
React.useEffect(() => {
useEffect(() => {
if (check()) {
callback()
}
@@ -686,7 +694,7 @@ function CategoryCard({
const t = useTheme()
const {_} = useLingui()
const gutters = useGutters(['compact'])
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
onSelect?.(option)
}, [onSelect, option])
return (
@@ -731,7 +739,7 @@ function OptionCard({
const t = useTheme()
const {_} = useLingui()
const gutters = useGutters(['compact'])
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
onSelect?.(option)
}, [onSelect, option])
return (
@@ -793,7 +801,7 @@ function LabelerCard({
}) {
const t = useTheme()
const {_} = useLingui()
const onPress = React.useCallback(() => {
const onPress = useCallback(() => {
onSelect?.(labeler)
}, [onSelect, labeler])
const title = getLabelingServiceTitle({