Create codemod for addressing ESLint warnings (#10032)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import React from 'react'
|
||||
import {createContext, useContext} from 'react'
|
||||
|
||||
import {type ContextType, type ItemContextType} from '#/components/Menu/types'
|
||||
|
||||
export const Context = React.createContext<ContextType | null>(null)
|
||||
export const Context = createContext<ContextType | null>(null)
|
||||
Context.displayName = 'MenuContext'
|
||||
|
||||
export const ItemContext = React.createContext<ItemContextType | null>(null)
|
||||
export const ItemContext = createContext<ItemContextType | null>(null)
|
||||
ItemContext.displayName = 'MenuItemContext'
|
||||
|
||||
export function useMenuContext() {
|
||||
const context = React.useContext(Context)
|
||||
const context = useContext(Context)
|
||||
|
||||
if (!context) {
|
||||
throw new Error('useMenuContext must be used within a Context.Provider')
|
||||
@@ -19,7 +19,7 @@ export function useMenuContext() {
|
||||
}
|
||||
|
||||
export function useMenuItemContext() {
|
||||
const context = React.useContext(ItemContext)
|
||||
const context = useContext(ItemContext)
|
||||
|
||||
if (!context) {
|
||||
throw new Error('useMenuItemContext must be used within a Context.Provider')
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
type GestureResponderEvent,
|
||||
type PressableProps,
|
||||
} from 'react-native'
|
||||
import type React from 'react'
|
||||
|
||||
import {type TextStyleProp, type ViewStyleProp} from '#/alf'
|
||||
import type * as Dialog from '#/components/Dialog'
|
||||
|
||||
Reference in New Issue
Block a user