Skip to content

Commit

Permalink
Fix propTypes wrapper crash in boolean-prop-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Masters committed Aug 11, 2017
1 parent dae6574 commit 99fd813
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module.exports = {
return;
}
const component = utils.getRelatedComponent(node);
if (!component) {
if (!component || !node.parent.right.properties) {
return;
}
validatePropNaming(component.node, node.parent.right.properties);
Expand Down
10 changes: 10 additions & 0 deletions tests/lib/rules/boolean-prop-naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ ruleTester.run('boolean-prop-naming', rule, {
options: [{
rule: '^is[A-Z]([A-Za-z0-9]?)+'
}]
}, {
code: [
'class Hello extends React.Component {',
' render () { return <div />; }',
'}',
'Hello.propTypes = wrap({ a: PropTypes.bool })'
].join('\n'),
options: [{
rule: '^is[A-Z]([A-Za-z0-9]?)+'
}]
}, {
// ES6 components as React.Component with non-boolean PropTypes
code: [
Expand Down

0 comments on commit 99fd813

Please sign in to comment.