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
+14 -10
View File
@@ -1,25 +1,29 @@
import React from 'react'
import {
createContext,
useCallback,
useContext,
useEffect,
useState,
} from 'react'
import * as persisted from '#/state/persisted'
type StateContext = persisted.Schema['largeAltBadgeEnabled']
type SetContext = (v: persisted.Schema['largeAltBadgeEnabled']) => void
const stateContext = React.createContext<StateContext>(
const stateContext = createContext<StateContext>(
persisted.defaults.largeAltBadgeEnabled,
)
stateContext.displayName = 'LargeAltBadgeStateContext'
const setContext = React.createContext<SetContext>(
const setContext = createContext<SetContext>(
(_: persisted.Schema['largeAltBadgeEnabled']) => {},
)
setContext.displayName = 'LargeAltBadgeSetContext'
export function Provider({children}: React.PropsWithChildren<{}>) {
const [state, setState] = React.useState(
persisted.get('largeAltBadgeEnabled'),
)
const [state, setState] = useState(persisted.get('largeAltBadgeEnabled'))
const setStateWrapped = React.useCallback(
const setStateWrapped = useCallback(
(largeAltBadgeEnabled: persisted.Schema['largeAltBadgeEnabled']) => {
setState(largeAltBadgeEnabled)
persisted.write('largeAltBadgeEnabled', largeAltBadgeEnabled)
@@ -27,7 +31,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
[setState],
)
React.useEffect(() => {
useEffect(() => {
return persisted.onUpdate(
'largeAltBadgeEnabled',
nextLargeAltBadgeEnabled => {
@@ -46,9 +50,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
}
export function useLargeAltBadgeEnabled() {
return React.useContext(stateContext)
return useContext(stateContext)
}
export function useSetLargeAltBadgeEnabled() {
return React.useContext(setContext)
return useContext(setContext)
}