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
+5 -5
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useEffect, useRef, useState} from 'react'
import {View} from 'react-native'
import Animated, {
Easing,
@@ -105,14 +105,14 @@ export function CountWheel({
// animation
// The initial entering/exiting animations will get skipped, since these will happen on screen mounts and would
// be unnecessary
const [key, setKey] = React.useState(0)
const [prevCount, setPrevCount] = React.useState(likeCount)
const prevIsLiked = React.useRef(isLiked)
const [key, setKey] = useState(0)
const [prevCount, setPrevCount] = useState(likeCount)
const prevIsLiked = useRef(isLiked)
const formatPostStatCount = useFormatPostStatCount()
const formattedCount = formatPostStatCount(likeCount)
const formattedPrevCount = formatPostStatCount(prevCount)
React.useEffect(() => {
useEffect(() => {
if (isLiked === prevIsLiked.current) {
return
}
+6 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useEffect, useRef, useState} from 'react'
import {View} from 'react-native'
import {useReducedMotion} from 'react-native-reanimated'
@@ -49,16 +49,16 @@ export function CountWheel({
const shouldAnimate = !useReducedMotion() && hasBeenToggled
const shouldRoll = decideShouldRoll(isLiked, likeCount)
const countView = React.useRef<HTMLDivElement>(null)
const prevCountView = React.useRef<HTMLDivElement>(null)
const countView = useRef<HTMLDivElement>(null)
const prevCountView = useRef<HTMLDivElement>(null)
const [prevCount, setPrevCount] = React.useState(likeCount)
const prevIsLiked = React.useRef(isLiked)
const [prevCount, setPrevCount] = useState(likeCount)
const prevIsLiked = useRef(isLiked)
const formatPostStatCount = useFormatPostStatCount()
const formattedCount = formatPostStatCount(likeCount)
const formattedPrevCount = formatPostStatCount(prevCount)
React.useEffect(() => {
useEffect(() => {
if (isLiked === prevIsLiked.current) {
return
}
@@ -1,4 +1,4 @@
import React from 'react'
import {useMemo, useState} from 'react'
import {type ColorValue, Dimensions, StyleSheet, View} from 'react-native'
import {Gesture, GestureDetector} from 'react-native-gesture-handler'
import Animated, {
@@ -50,7 +50,7 @@ export function GestureActionView({
)
}
const [activeAction, setActiveAction] = React.useState<
const [activeAction, setActiveAction] = useState<
'leftFirst' | 'leftSecond' | 'rightFirst' | 'rightSecond' | null
>(null)
@@ -231,7 +231,7 @@ export function GestureActionView({
}
})
const leftSideInterpolation = React.useMemo(() => {
const leftSideInterpolation = useMemo(() => {
return createInterpolation({
firstColor: actions.leftFirst?.color,
secondColor: actions.leftSecond?.color,
@@ -241,7 +241,7 @@ export function GestureActionView({
})
}, [actions.leftFirst, actions.leftSecond])
const rightSideInterpolation = React.useMemo(() => {
const rightSideInterpolation = useMemo(() => {
return createInterpolation({
firstColor: actions.rightFirst?.color,
secondColor: actions.rightSecond?.color,
@@ -251,14 +251,14 @@ export function GestureActionView({
})
}, [actions.rightFirst, actions.rightSecond])
const interpolation = React.useMemo<{
const interpolation = useMemo<{
inputRange: number[]
outputRange: ColorValue[]
}>(() => {
if (!actions.leftFirst) {
return rightSideInterpolation!
return rightSideInterpolation
} else if (!actions.rightFirst) {
return leftSideInterpolation!
return leftSideInterpolation
} else {
return {
inputRange: [
@@ -1,5 +1,3 @@
import type React from 'react'
export function GestureActionView({children}: {children: React.ReactNode}) {
return children
}
+6 -6
View File
@@ -1,4 +1,4 @@
import React from 'react'
import {useEffect, useRef} from 'react'
import {View} from 'react-native'
import {useReducedMotion} from 'react-native-reanimated'
@@ -50,13 +50,13 @@ export function AnimatedLikeIcon({
const t = useTheme()
const size = big ? 22 : 18
const shouldAnimate = !useReducedMotion() && hasBeenToggled
const prevIsLiked = React.useRef(isLiked)
const prevIsLiked = useRef(isLiked)
const likeIconRef = React.useRef<HTMLDivElement>(null)
const circle1Ref = React.useRef<HTMLDivElement>(null)
const circle2Ref = React.useRef<HTMLDivElement>(null)
const likeIconRef = useRef<HTMLDivElement>(null)
const circle1Ref = useRef<HTMLDivElement>(null)
const circle2Ref = useRef<HTMLDivElement>(null)
React.useEffect(() => {
useEffect(() => {
if (prevIsLiked.current === isLiked) {
return
}