Skip to content

Commit

Permalink
Fix prop validation in constructor (fixes #259)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed Oct 19, 2015
1 parent 77459ec commit 4d6e050
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rules/prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,11 @@ module.exports = function(context) {
* @return {string} the name of the property or undefined if not found
*/
function getPropertyName(node) {
if (componentUtil.getNode(context, node) && !inConstructor()) {
if (node.object.name === 'props') {
return void 0;
}
var directProp = /^props\./.test(context.getSource(node));
if (directProp && componentUtil.getNode(context, node) && !inConstructor(node)) {
return void 0;
}
if (!directProp) {
node = node.parent;
}
var property = node.property;
Expand Down

0 comments on commit 4d6e050

Please sign in to comment.