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'm running into some unexpected behavior with the forbid-prop-types rule and nested prop types (e.g. arrayOf(object)). It looks like there's either a bug that manifests differently depending on how prop types are imported or there are two different bugs. Similar issues have been reported (#2657, #2662), but I'm re-reporting this because they're marked as fixed by 997a99f and this is still happening.
I'm including two examples along with my configuration below. The version of eslint is 7.20.0 and the version of eslint-plugin-react is 7.22.0.
Example 1
importReactfrom'./React';import{arrayOf,object}from'prop-types';constApp=({ foo })=>(<div>
Hello world {foo}</div>);App.propTypes={foo: arrayOf(object)}exportdefaultApp;
/tmp/test/src/App.js
13:3 error Prop type `undefined` is forbidden react/forbid-prop-types
✖ 1 problem (1 error, 0 warnings)
Here, eslint is correctly returning an error, but the description should say "Prop type `object`", not "Prop type `undefined`".
Example 2
importReactfrom'./React';importPropTypes,{arrayOf}from'prop-types';constApp=({ foo })=>(<div>
Hello world {foo}</div>);App.propTypes={foo: arrayOf(PropTypes.object)}exportdefaultApp;
✨ Done in 0.77s.
In this case, eslint is incorrectly returning no errors.
I'm running into some unexpected behavior with the
forbid-prop-types
rule and nested prop types (e.g.arrayOf(object)
). It looks like there's either a bug that manifests differently depending on how prop types are imported or there are two different bugs. Similar issues have been reported (#2657, #2662), but I'm re-reporting this because they're marked as fixed by 997a99f and this is still happening.I'm including two examples along with my configuration below. The version of
eslint
is7.20.0
and the version ofeslint-plugin-react
is7.22.0
.Example 1
Here,
eslint
is correctly returning an error, but the description should say"Prop type `object`"
, not"Prop type `undefined`"
.Example 2
In this case,
eslint
is incorrectly returning no errors.Configuration
The text was updated successfully, but these errors were encountered: