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
After upgrading from 5.0.1 to 5.1.1 I noticed a bug with the prop-types rule. It now incorrectly detects destructured method params as missing props. See example below:
Will result in an incorrect failure of: react/prop-types: 'width' is missing in props validation.
What's strange is that all of the examples below do NOT fail:
// Removed destructured function paramexportdefault(ComposedComponent)=>classSomethingextendsSomeOtherComponent{someMethod=(width)=>{this.setState({width});}}// Kept destructured function param but extend the class via `Component` insteadexportdefault(ComposedComponent)=>classSomethingextendsComponent{someMethod=({width})=>{this.setState({width});}}// Kept destructured function param, and the custom class extend,// but removed the composed function wrapperexportdefaultclassSomethingextendsSomeOtherComponent{someMethod=({width})=>{this.setState({width});}}
Seems like the combination of a destructured function param, a HOC composed function wrapper and extending from a non-Component class causes a failure of the rule.
The text was updated successfully, but these errors were encountered:
EvHaus
changed the title
Regression in prop-types rules in v5.1.1
Regression in prop-types rule in v5.1.1
May 10, 2016
Not sure if this is the same issue, but I've been having a similar issue with decorators and destructured params when wrapped with an array and/or object.
The following results in error 'store' is missing in props validation react/prop-types.
// No error if function isn't wrapped by an object and/or array
@asyncConnect(({store: { dispatch }})=>{returndispatch(fetchUsers());})// No error after moving destructuring into function body
@asyncConnect([{promise: (params)=>{const{store: { dispatch }}=params;returndispatch(fetchUsers());},}])
After upgrading from 5.0.1 to 5.1.1 I noticed a bug with the
prop-types
rule. It now incorrectly detects destructured method params as missing props. See example below:Will result in an incorrect failure of:
react/prop-types: 'width' is missing in props validation
.What's strange is that all of the examples below do NOT fail:
Seems like the combination of a destructured function param, a HOC composed function wrapper and extending from a non-
Component
class causes a failure of the rule.The text was updated successfully, but these errors were encountered: