Eslint-plugin-react: propTypes wrapped with PropTypes.exact triggers react/prop-types rule

Created on 29 Nov 2017  路  5Comments  路  Source: yannickcr/eslint-plugin-react

As PropTypes.exact was added https://github.com/facebook/prop-types/commit/9057907cae241b78faaa8048d6c04d60b14a4b91 it would be great if plugin support it as well.

enhancement help wanted

Most helpful comment

I can take a stab at implementing this one

All 5 comments

You can specify PropTypes.exact in propWrapperFunctions, but we should handle this by default.

I can take a stab at implementing this one

I'm running into an issue testing this - PropTypes.exact does not seem to work as expected when wrapping the proptypes object, like forbidExtraProps does. Still investigating, but here's a repro.

https://codepen.io/dustinsoftware/pen/BmGWXM

@ljharb can you take a look at the pen I linked to? I see you've commented on a few related issues in the prop-types repo, it appears that PropTypes.exact currently can't be used as a wrapper for the whole props object.

@dustinsoftware Sorry for the delayed response. I think the current implementation in this plugin only allows a single identifier to be used; however, I would expect it to be enhanced to also support { property: "exact", object: "PropTypes" }.

Was this page helpful?
0 / 5 - 0 ratings