eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

Update forbid-prop-types: handle prop-type functions with no args

Open jack-lewin opened this issue 6 years ago • 3 comments

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 🙂

jack-lewin avatar Feb 13 '19 15:02 jack-lewin

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.

jack-lewin avatar Feb 20 '19 21:02 jack-lewin

Just made a couple of small changes to make sure this is backwards-compatible 🙂

jack-lewin avatar Mar 01 '19 12:03 jack-lewin

@jack-lewin ping, are you still interested in completing this PR?

ljharb avatar Dec 13 '19 00:12 ljharb