diff --git a/lib/rules/no-extra-bind.js b/lib/rules/no-extra-bind.js index 5380cf217f4..cc0b1f84372 100644 --- a/lib/rules/no-extra-bind.js +++ b/lib/rules/no-extra-bind.js @@ -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" diff --git a/tests/lib/rules/no-extra-bind.js b/tests/lib/rules/no-extra-bind.js index e9c72bca61a..cc2b164e8ec 100644 --- a/tests/lib/rules/no-extra-bind.js +++ b/tests/lib/rules/no-extra-bind.js @@ -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)",