Create codemod for addressing ESLint warnings (#10032)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, {useEffect} from 'react'
|
||||
import {useCallback, useEffect, useRef} from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {
|
||||
FontAwesomeIcon,
|
||||
@@ -23,7 +23,7 @@ export function CustomFeedEmptyState() {
|
||||
const ax = useAnalytics()
|
||||
const feedFeedback = useFeedFeedbackContext()
|
||||
const {currentAccount} = useSession()
|
||||
const hasLoggedDiscoverEmptyErrorRef = React.useRef(false)
|
||||
const hasLoggedDiscoverEmptyErrorRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
// Log the empty feed error event
|
||||
@@ -44,7 +44,7 @@ export function CustomFeedEmptyState() {
|
||||
const palInverted = usePalette('inverted')
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
const onPressFindAccounts = React.useCallback(() => {
|
||||
const onPressFindAccounts = useCallback(() => {
|
||||
if (IS_WEB) {
|
||||
navigation.navigate('Search', {})
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useCallback} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -38,7 +38,7 @@ export function FeedShutdownMsg({feedUri}: {feedUri: string}) {
|
||||
const hasFeedPinned = Boolean(feedConfig)
|
||||
const hasDiscoverPinned = Boolean(discoverFeedConfig?.pinned)
|
||||
|
||||
const onRemoveFeed = React.useCallback(async () => {
|
||||
const onRemoveFeed = useCallback(async () => {
|
||||
try {
|
||||
if (feedConfig) {
|
||||
await removeFeed(feedConfig)
|
||||
@@ -58,7 +58,7 @@ export function FeedShutdownMsg({feedUri}: {feedUri: string}) {
|
||||
}
|
||||
}, [removeFeed, feedConfig, _, hasDiscoverPinned, setSelectedFeed])
|
||||
|
||||
const onReplaceFeed = React.useCallback(async () => {
|
||||
const onReplaceFeed = useCallback(async () => {
|
||||
try {
|
||||
await replaceFeedWithDiscover({
|
||||
forYouFeedConfig: feedConfig,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useCallback} from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import {
|
||||
FontAwesomeIcon,
|
||||
@@ -20,7 +20,7 @@ export function FollowingEmptyState() {
|
||||
const palInverted = usePalette('inverted')
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
const onPressFindAccounts = React.useCallback(() => {
|
||||
const onPressFindAccounts = useCallback(() => {
|
||||
if (IS_WEB) {
|
||||
navigation.navigate('Search', {})
|
||||
} else {
|
||||
@@ -29,7 +29,7 @@ export function FollowingEmptyState() {
|
||||
}
|
||||
}, [navigation])
|
||||
|
||||
const onPressDiscoverFeeds = React.useCallback(() => {
|
||||
const onPressDiscoverFeeds = useCallback(() => {
|
||||
navigation.navigate('Feeds')
|
||||
}, [navigation])
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useCallback} from 'react'
|
||||
import {Dimensions, StyleSheet, View} from 'react-native'
|
||||
import {
|
||||
FontAwesomeIcon,
|
||||
@@ -19,7 +19,7 @@ export function FollowingEndOfFeed() {
|
||||
const palInverted = usePalette('inverted')
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
const onPressFindAccounts = React.useCallback(() => {
|
||||
const onPressFindAccounts = useCallback(() => {
|
||||
if (IS_WEB) {
|
||||
navigation.navigate('Search', {})
|
||||
} else {
|
||||
@@ -28,7 +28,7 @@ export function FollowingEndOfFeed() {
|
||||
}
|
||||
}, [navigation])
|
||||
|
||||
const onPressDiscoverFeeds = React.useCallback(() => {
|
||||
const onPressDiscoverFeeds = useCallback(() => {
|
||||
navigation.navigate('Feeds')
|
||||
}, [navigation])
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useCallback, useMemo} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {
|
||||
type AppBskyActorDefs,
|
||||
@@ -48,7 +48,7 @@ export function PostFeedErrorMessage({
|
||||
savedFeedConfig?: AppBskyActorDefs.SavedFeed
|
||||
}) {
|
||||
const {_: _l} = useLingui()
|
||||
const knownError = React.useMemo(
|
||||
const knownError = useMemo(
|
||||
() => detectKnownError(feedDesc, error),
|
||||
[feedDesc, error],
|
||||
)
|
||||
@@ -101,7 +101,7 @@ function FeedgenErrorMessage({
|
||||
const pal = usePalette('default')
|
||||
const {_: _l} = useLingui()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
const msg = React.useMemo(
|
||||
const msg = useMemo(
|
||||
() =>
|
||||
({
|
||||
[KnownError.Unknown]: '',
|
||||
@@ -135,15 +135,15 @@ function FeedgenErrorMessage({
|
||||
const removePromptControl = Prompt.usePromptControl()
|
||||
const {mutateAsync: removeFeed} = useRemoveFeedMutation()
|
||||
|
||||
const onViewProfile = React.useCallback(() => {
|
||||
const onViewProfile = useCallback(() => {
|
||||
navigation.navigate('Profile', {name: ownerDid})
|
||||
}, [navigation, ownerDid])
|
||||
|
||||
const onPressRemoveFeed = React.useCallback(() => {
|
||||
const onPressRemoveFeed = useCallback(() => {
|
||||
removePromptControl.open()
|
||||
}, [removePromptControl])
|
||||
|
||||
const onRemoveFeed = React.useCallback(async () => {
|
||||
const onRemoveFeed = useCallback(async () => {
|
||||
try {
|
||||
if (!savedFeedConfig) return
|
||||
await removeFeed(savedFeedConfig)
|
||||
@@ -158,7 +158,7 @@ function FeedgenErrorMessage({
|
||||
}
|
||||
}, [removeFeed, _l, savedFeedConfig])
|
||||
|
||||
const cta = React.useMemo(() => {
|
||||
const cta = useMemo(() => {
|
||||
switch (knownError) {
|
||||
case KnownError.FeedSignedInOnly: {
|
||||
return null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import {useMemo} from 'react'
|
||||
import {StyleSheet, View} from 'react-native'
|
||||
import Svg, {Circle, Line} from 'react-native-svg'
|
||||
import {AtUri} from '@atproto/api'
|
||||
@@ -19,7 +19,7 @@ export function ViewFullThread({uri}: {uri: string}) {
|
||||
onOut: onHoverOut,
|
||||
} = useInteractionState()
|
||||
const pal = usePalette('default')
|
||||
const itemHref = React.useMemo(() => {
|
||||
const itemHref = useMemo(() => {
|
||||
const urip = new AtUri(uri)
|
||||
return makeProfileLink({did: urip.hostname, handle: ''}, 'post', urip.rkey)
|
||||
}, [uri])
|
||||
|
||||
Reference in New Issue
Block a user