Skip to content

Commit 281faf0

Browse files
committed
Fix jsx-no-bind crash (fixes #641)
1 parent d6d0d8a commit 281faf0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/rules/jsx-no-bind.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ module.exports = function(context) {
1919
var callee = node.callee;
2020
if (
2121
!configuration.allowBind &&
22-
callee.type !== 'MemberExpression' ||
23-
callee.property.name !== 'bind'
22+
(callee.type !== 'MemberExpression' || callee.property.name !== 'bind')
2423
) {
2524
return;
2625
}

tests/lib/rules/jsx-no-bind.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ ruleTester.run('jsx-no-bind', rule, {
5858
code: '<div onClick={() => alert("1337")}></div>',
5959
options: [{allowArrowFunctions: true}],
6060
parser: 'babel-eslint'
61+
},
62+
63+
// Redux connect
64+
{
65+
code: [
66+
'class Hello extends Component {',
67+
' render() {',
68+
' return <div>Hello</div>;',
69+
' }',
70+
'}',
71+
'export default connect()(Hello);'
72+
].join('\n'),
73+
options: [{allowBind: true}],
74+
parser: 'babel-eslint'
6175
}
6276
],
6377

0 commit comments

Comments
 (0)