You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues and my issue is unique
My issue appears in the command-line and not only in the text editor
Description Overview
Lint returns errors for types from react-hook-form
Example of problematic code
importReactfrom'react'import{Controller,useForm}from'react-hook-form'import{TextField}from'@mui/material'interfaceIFormTestProps{number: number}constFormTest=()=>{const{ control, register }=useForm<IFormTestProps>({})return(<form><Controllername="number"control={control}render={(props)=>{console.log(props.field.ref)return(<TextFieldlabel="Number"type="number"{...register('number')}onChange={(e)=>{// This is what we want to doprops.field.onChange(parseInt(e.target.value,10))}}/>)}}/></form>)}exportdefaultFormTest
Lint error
> npm run lint
...
c:\...\FormTest.tsx
17:39 error 'field' is missing in props validation react/prop-types
17:45 error 'field.ref' is missing in props validation react/prop-types
25:39 error 'field' is missing in props validation react/prop-types
25:45 error 'field.onChange' is missing in props validation react/prop-types
Is there an existing issue for this?
Description Overview
Lint returns errors for types from react-hook-form
Example of problematic code
Lint error
I believe these are the relevant dependencies
Expected Behavior
I expected that eslint-plugin-react would detect imported types correctly and not report these errors.
eslint-plugin-react version
v7.34.1
eslint version
v8.57.0
node version
v20.10.0
The text was updated successfully, but these errors were encountered: