Skip to content

Commit

Permalink
Fix jsx-sort-prop-types issue with custom propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
alitaheri committed Jan 24, 2016
1 parent d7c3ad2 commit eede741
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/jsx-sort-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function(context) {
}

function getValueName(node) {
return node.value.property.name;
return node.value.property && node.value.property.name;
}

function isCallbackPropName(propName) {
Expand Down
15 changes: 15 additions & 0 deletions tests/lib/rules/jsx-sort-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ ruleTester.run('jsx-sort-prop-types', rule, {
requiredFirst: true
}],
parserOptions: parserOptions
}, {
code: [
'class First extends React.Component {',
' render() {',
' return <div />;',
' }',
'}',
'First.propTypes = {',
' fooRequired: MyPropType,',
'};'
].join('\n'),
options: [{
requiredFirst: true
}],
parserOptions: parserOptions
}, {
code: [
'class First extends React.Component {',
Expand Down

0 comments on commit eede741

Please sign in to comment.