Skip to content

Commit 0e14ff3

Browse files
committed
Merge pull request #283 from Daniel15/bind-fix
Fix jsx-no-bind crash on function calls
2 parents 8ac35f5 + 70d72dc commit 0e14ff3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/rules/jsx-no-bind.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = function(context) {
2121
if (
2222
!configuration.allowBind &&
2323
valueNode.type === 'CallExpression' &&
24+
valueNode.callee.type === 'MemberExpression' &&
2425
valueNode.callee.property.name === 'bind'
2526
) {
2627
context.report(node, 'JSX props should not use .bind()');

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ ruleTester.run('jsx-no-bind', rule, {
2929
code: '<div meaningOfLife={42}></div>',
3030
parser: 'babel-eslint'
3131
},
32+
{
33+
code: '<div onClick={getHandler()}></div>',
34+
parser: 'babel-eslint'
35+
},
3236

3337
// bind() explicitly allowed
3438
{

0 commit comments

Comments
 (0)