Skip to content

Commit

Permalink
Fix related components detection in prop-types (fixes #735)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed Aug 21, 2016
1 parent 4be546a commit 8ea2d0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/util/variable.js
Expand Up @@ -81,6 +81,7 @@ function variablesInScope(context) {
variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
}
}
variables.reverse();

return variables;
}
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/prop-types.js
Expand Up @@ -1294,6 +1294,17 @@ ruleTester.run('prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
code: [
'class Hello extends Component {}',
'Hello.Foo = ({foo}) => (',
' <div>Hello {foo}</div>',
')',
'Hello.Foo.propTypes = {',
' foo: PropTypes.node',
'}'
].join('\n'),
parser: 'babel-eslint'
}
],

Expand Down

0 comments on commit 8ea2d0e

Please sign in to comment.