run codemod on every file

This commit is contained in:
Samuel Newman
2026-07-24 13:58:08 +03:00
parent 82c505f286
commit 91a87536de
289 changed files with 2468 additions and 3422 deletions
+7 -14
View File
@@ -1,8 +1,7 @@
import {memo} from 'react'
import {type Insets} from 'react-native'
import {type AppBskyFeedDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
import {Trans} from '@lingui/react/macro'
import {useCleanError} from '#/lib/hooks/useCleanError'
@@ -30,7 +29,7 @@ export const BookmarkButton = memo(function BookmarkButton({
}): React.ReactNode {
const t = useTheme()
const ax = useAnalytics()
const {_} = useLingui()
const {t: l} = useLingui()
const {mutateAsync: bookmark} = useBookmarkMutation()
const cleanError = useCleanError()
const requireAuth = useRequireAuth()
@@ -39,12 +38,10 @@ export const BookmarkButton = memo(function BookmarkButton({
const {viewer} = post
const isBookmarked = !!viewer?.bookmarked
const undoLabel = _(
msg({
message: `Undo`,
context: `Button label to undo saving/removing a post from saved posts.`,
}),
)
const undoLabel = l({
message: `Undo`,
context: `Button label to undo saving/removing a post from saved posts.`,
})
const save = async () => {
try {
@@ -115,11 +112,7 @@ export const BookmarkButton = memo(function BookmarkButton({
big={big}
active={isBookmarked}
activeColor={t.palette.primary_500}
label={
isBookmarked
? _(msg`Remove from saved posts`)
: _(msg`Add to saved posts`)
}
label={isBookmarked ? l`Remove from saved posts` : l`Add to saved posts`}
onPress={onHandlePress}
hitSlop={hitSlop}>
<PostControlButtonIcon icon={isBookmarked ? BookmarkFilled : Bookmark} />
+25 -33
View File
@@ -1,7 +1,7 @@
import {memo, useCallback} from 'react'
import {View} from 'react-native'
import {msg, plural} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {plural} from '@lingui/core/macro'
import {useLingui} from '@lingui/react/macro'
import {Trans} from '@lingui/react/macro'
import {useHaptics} from '#/lib/haptics'
@@ -37,7 +37,7 @@ let RepostButton = ({
embeddingDisabled,
}: Props): React.ReactNode => {
const t = useTheme()
const {_} = useLingui()
const {t: l} = useLingui()
const requireAuth = useRequireAuth()
const dialogControl = Dialog.useDialogControl()
const formatPostStatCount = useFormatPostStatCount()
@@ -64,26 +64,22 @@ let RepostButton = ({
onLongPress={onLongPress}
label={
isReposted
? _(
msg({
message: `Undo repost (${plural(repostCount || 0, {
one: '# repost',
other: '# reposts',
})})`,
comment:
'Accessibility label for the repost button when the post has been reposted, verb followed by number of reposts and noun',
}),
)
: _(
msg({
message: `Repost (${plural(repostCount || 0, {
one: '# repost',
other: '# reposts',
})})`,
comment:
'Accessibility label for the repost button when the post has not been reposted, verb form followed by number of reposts and noun form',
}),
)
? l({
message: `Undo repost (${plural(repostCount || 0, {
one: '# repost',
other: '# reposts',
})})`,
comment:
'Accessibility label for the repost button when the post has been reposted, verb followed by number of reposts and noun',
})
: l({
message: `Repost (${plural(repostCount || 0, {
one: '# repost',
other: '# reposts',
})})`,
comment:
'Accessibility label for the repost button when the post has not been reposted, verb form followed by number of reposts and noun form',
})
}>
<PostControlButtonIcon icon={RepostIcon} />
{typeof repostCount !== 'undefined' && repostCount > 0 && (
@@ -121,7 +117,7 @@ let RepostButtonDialogInner = ({
embeddingDisabled: boolean
}): React.ReactNode => {
const t = useTheme()
const {_} = useLingui()
const {t: l} = useLingui()
const playHaptic = useHaptics()
const control = Dialog.useDialogContext()
@@ -143,15 +139,15 @@ let RepostButtonDialogInner = ({
const onPressClose = useCallback(() => control.close(), [control])
return (
<Dialog.ScrollableInner label={_(msg`Repost or quote post`)}>
<Dialog.ScrollableInner label={l`Repost or quote post`}>
<View style={a.gap_xl}>
<View style={a.gap_xs}>
<Button
style={[a.justify_start, a.px_md, a.gap_sm]}
label={
isReposted
? _(msg`Remove repost`)
: _(msg({message: `Repost`, context: 'action'}))
? l`Remove repost`
: l({message: `Repost`, context: 'action'})
}
onPress={onPressRepost}
size="large"
@@ -170,11 +166,7 @@ let RepostButtonDialogInner = ({
disabled={embeddingDisabled}
testID="quoteBtn"
style={[a.justify_start, a.px_md, a.gap_sm]}
label={
embeddingDisabled
? _(msg`Quote posts disabled`)
: _(msg`Quote post`)
}
label={embeddingDisabled ? l`Quote posts disabled` : l`Quote post`}
onPress={onPressQuote}
size="large"
variant="ghost"
@@ -202,7 +194,7 @@ let RepostButtonDialogInner = ({
</Button>
</View>
<Button
label={_(msg`Cancel quote post`)}
label={l`Cancel quote post`}
onPress={onPressClose}
size="large"
color="secondary">
@@ -1,5 +1,4 @@
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
import {useRequireAuth, useSession} from '#/state/session'
import {EventStopper} from '#/view/com/util/EventStopper'
@@ -32,7 +31,7 @@ export const RepostButton = ({
embeddingDisabled,
}: Props) => {
const t = useTheme()
const {_} = useLingui()
const {t: l} = useLingui()
const {hasSession} = useSession()
const requireAuth = useRequireAuth()
const formatPostStatCount = useFormatPostStatCount()
@@ -40,7 +39,7 @@ export const RepostButton = ({
return hasSession ? (
<EventStopper onKeyDown={false}>
<Menu.Root>
<Menu.Trigger label={_(msg`Repost or quote post`)}>
<Menu.Trigger label={l`Repost or quote post`}>
{({props}) => {
return (
<PostControlButton
@@ -64,31 +63,25 @@ export const RepostButton = ({
<Menu.Item
label={
isReposted
? _(msg`Undo repost`)
: _(msg({message: `Repost`, context: `action`}))
? l`Undo repost`
: l({message: `Repost`, context: `action`})
}
testID="repostDropdownRepostBtn"
onPress={onRepost}>
<Menu.ItemText>
{isReposted
? _(msg`Undo repost`)
: _(msg({message: `Repost`, context: `action`}))}
? l`Undo repost`
: l({message: `Repost`, context: `action`})}
</Menu.ItemText>
<Menu.ItemIcon icon={Repost} position="right" />
</Menu.Item>
<Menu.Item
disabled={embeddingDisabled}
label={
embeddingDisabled
? _(msg`Quote posts disabled`)
: _(msg`Quote post`)
}
label={embeddingDisabled ? l`Quote posts disabled` : l`Quote post`}
testID="repostDropdownQuoteBtn"
onPress={onQuote}>
<Menu.ItemText>
{embeddingDisabled
? _(msg`Quote posts disabled`)
: _(msg`Quote post`)}
{embeddingDisabled ? l`Quote posts disabled` : l`Quote post`}
</Menu.ItemText>
<Menu.ItemIcon icon={Quote} position="right" />
</Menu.Item>
@@ -100,7 +93,7 @@ export const RepostButton = ({
onPress={() => requireAuth(() => {})}
active={isReposted}
activeColor={t.palette.positive_500}
label={_(msg`Repost or quote post`)}
label={l`Repost or quote post`}
big={big}>
<PostControlButtonIcon icon={Repost} />
{typeof repostCount !== 'undefined' && repostCount > 0 && (
@@ -4,8 +4,7 @@ import {
moderateProfile,
type ModerationOpts,
} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
import {Trans} from '@lingui/react/macro'
import {useNavigation} from '@react-navigation/native'
@@ -118,7 +117,7 @@ function RecentChatItem({
convo: ConvoWithDetails
primaryMember: ChatBskyActorDefs.ProfileViewBasic
}) {
const {_} = useLingui()
const {t: l} = useLingui()
const t = useTheme()
const primaryProfile = useProfileShadow(primaryMember)
@@ -143,7 +142,7 @@ function RecentChatItem({
return (
<Button
onPress={onPress}
label={_(msg`Send post to ${name}`)}
label={l`Send post to ${name}`}
style={[
a.flex_col,
{width: WIDTH},
@@ -7,8 +7,7 @@ import {
AtUri,
type RichText as RichTextAPI,
} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
import {makeProfileLink} from '#/lib/routes/links'
import {shareUrl} from '#/lib/sharing'
@@ -48,7 +47,7 @@ let ShareMenuButton = ({
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
}): React.ReactNode => {
const ax = useAnalytics()
const {_} = useLingui()
const {t: l} = useLingui()
const {feedDescriptor} = useFeedFeedbackContext()
const menuControl = useMenuControl()
@@ -95,7 +94,7 @@ let ShareMenuButton = ({
return (
<EventStopper onKeyDown={false}>
<Menu.Root control={lazyMenuControl}>
<Menu.Trigger label={_(msg`Open share menu`)}>
<Menu.Trigger label={l`Open share menu`}>
{({props}) => {
return (
<PostControlButton
+1 -1
View File
@@ -1,5 +1,5 @@
import {useCallback} from 'react'
import {useLingui} from '@lingui/react'
import {useLingui} from '@lingui/react/macro'
/**
* This matches `formatCount` from `view/com/util/numeric/format.ts`, but has