Skip to content

Commit

Permalink
Fix: Allow bind call with a single spread element in no-extra-bind (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic authored and kaicataldo committed Aug 16, 2019
1 parent bfdb0c9 commit 92ec2cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rules/no-extra-bind.js
Expand Up @@ -98,6 +98,7 @@ module.exports = {
grandparent.type === "CallExpression" &&
grandparent.callee === parent &&
grandparent.arguments.length === 1 &&
grandparent.arguments[0].type !== "SpreadElement" &&
parent.type === "MemberExpression" &&
parent.object === node &&
astUtils.getStaticPropertyName(parent) === "bind"
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-extra-bind.js
Expand Up @@ -21,6 +21,7 @@ const errors = [{ messageId: "unexpected", type: "CallExpression" }];
ruleTester.run("no-extra-bind", rule, {
valid: [
"var a = function(b) { return b }.bind(c, d)",
{ code: "var a = function(b) { return b }.bind(...c)", parserOptions: { ecmaVersion: 6 } },
"var a = function() { this.b }()",
"var a = function() { this.b }.foo()",
"var a = f.bind(a)",
Expand Down

0 comments on commit 92ec2cb

Please sign in to comment.