eslint-plugin-react
eslint-plugin-react copied to clipboard
Update forbid-prop-types: handle prop-type functions with no args
This PR aims to fix #1673 by adding a new option to the forbid-prop-types rule: empty
.
This will catch prop types which are functions, such as shape()
or arrayOf()
, but are used with either no arguments, or empty arguments ({}
or []
). These prop types don't add a huge amount of value in those scenarios, and should be avoided if possible.
Feedback appreciated 🙂
I've added a lot of tests in this PR. Happy to cut them down if you think that would make it easier for other contributors to follow.
Just made a couple of small changes to make sure this is backwards-compatible 🙂
@jack-lewin ping, are you still interested in completing this PR?