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
+17 -15
View File
@@ -1,4 +1,6 @@
import React, {
import {
Fragment,
memo,
useCallback,
useEffect,
useImperativeHandle,
@@ -299,7 +301,7 @@ export const ComposePost = ({
[activePost.id],
)
const selectVideo = React.useCallback(
const selectVideo = useCallback(
(postId: string, asset: ImagePickerAsset) => {
const abortController = new AbortController()
composerDispatch({
@@ -485,7 +487,7 @@ export const ComposePost = ({
[_, agent, currentDid, composerDispatch],
)
const handleSelectDraft = React.useCallback(
const handleSelectDraft = useCallback(
async (draftSummary: DraftSummary) => {
logger.debug('loading draft for editing', {
draftId: draftSummary.id,
@@ -553,7 +555,7 @@ export const ComposePost = ({
revokeAllMediaUrls()
}, [closeComposer, queryClient])
const getDraftSaveError = React.useCallback(
const getDraftSaveError = useCallback(
(e: unknown): string => {
if (e instanceof AppBskyDraftCreateDraft.DraftLimitReachedError) {
return _(msg`You've reached the maximum number of drafts`)
@@ -563,7 +565,7 @@ export const ComposePost = ({
[_],
)
const validateDraftTextOrError = React.useCallback((): boolean => {
const validateDraftTextOrError = useCallback((): boolean => {
const tooLong = composerState.thread.posts.some(
post => post.richtext.graphemeLength > MAX_DRAFT_GRAPHEME_LENGTH,
)
@@ -578,7 +580,7 @@ export const ComposePost = ({
return true
}, [composerState.thread.posts, _])
const handleSaveDraft = React.useCallback(async () => {
const handleSaveDraft = useCallback(async () => {
setError('')
if (!validateDraftTextOrError()) {
return
@@ -621,7 +623,7 @@ export const ComposePost = ({
])
// Save without closing - for use by DraftsButton
const saveCurrentDraft = React.useCallback(async (): Promise<{
const saveCurrentDraft = useCallback(async (): Promise<{
success: boolean
}> => {
setError('')
@@ -648,7 +650,7 @@ export const ComposePost = ({
])
// Handle discard action - fires metric and closes composer
const handleDiscard = React.useCallback(() => {
const handleDiscard = useCallback(() => {
const posts = thread.posts
const hasContent = posts.some(
post =>
@@ -665,7 +667,7 @@ export const ComposePost = ({
}, [thread.posts, ax, onClose])
// Check if composer is empty (no content to save)
const isComposerEmpty = React.useMemo(() => {
const isComposerEmpty = useMemo(() => {
// Has multiple posts means it's not empty
if (thread.posts.length > 1) return false
@@ -683,7 +685,7 @@ export const ComposePost = ({
}, [thread.posts])
// Clear the composer (discard current content)
const handleClearComposer = React.useCallback(() => {
const handleClearComposer = useCallback(() => {
composerDispatch({
type: 'clear',
initInteractionSettings: preferences?.postInteractionSettings,
@@ -794,7 +796,7 @@ export const ComposePost = ({
),
)
const onPressPublish = React.useCallback(async () => {
const onPressPublish = useCallback(async () => {
if (isPublishing) {
return
}
@@ -1015,7 +1017,7 @@ export const ComposePost = ({
onPressPublish()
})
React.useEffect(() => {
useEffect(() => {
if (publishOnUpload) {
let erroredVideos = 0
let uploadingVideos = 0
@@ -1181,7 +1183,7 @@ export const ComposePost = ({
onLayout={onScrollViewLayout}>
{replyTo ? <ComposerReplyTo replyTo={replyTo} /> : undefined}
{thread.posts.map((post, index) => (
<React.Fragment key={post.id + (composerState.draftId ?? '')}>
<Fragment key={post.id + (composerState.draftId ?? '')}>
<ComposerPost
post={post}
dispatch={composerDispatch}
@@ -1201,7 +1203,7 @@ export const ComposePost = ({
{IS_WEBFooterSticky && post.id === activePost.id && (
<View style={styles.stickyFooterWeb}>{footer}</View>
)}
</React.Fragment>
</Fragment>
))}
</Animated.ScrollView>
{!IS_WEBFooterSticky && footer}
@@ -1273,7 +1275,7 @@ export const ComposePost = ({
)
}
let ComposerPost = React.memo(function ComposerPost({
let ComposerPost = memo(function ComposerPost({
post,
dispatch,
textInput,