diff --git a/lib/rules/no-extra-bind.js b/lib/rules/no-extra-bind.js index d938c0f51b0..df695924ab5 100644 --- a/lib/rules/no-extra-bind.js +++ b/lib/rules/no-extra-bind.js @@ -64,7 +64,7 @@ module.exports = { context.report({ node: node.parent.parent, messageId: "unexpected", - loc: node.parent.property.loc.start, + loc: node.parent.property.loc, fix(fixer) { if (node.parent.parent.arguments.length && !isSideEffectFree(node.parent.parent.arguments[0])) { return null; diff --git a/tests/lib/rules/no-extra-bind.js b/tests/lib/rules/no-extra-bind.js index 3bfcda8c5d0..12197967176 100644 --- a/tests/lib/rules/no-extra-bind.js +++ b/tests/lib/rules/no-extra-bind.js @@ -36,18 +36,39 @@ ruleTester.run("no-extra-bind", rule, { { code: "var a = function() { return 1; }.bind(b)", output: "var a = function() { return 1; }", - errors + errors: [{ + messageId: "unexpected", + type: "CallExpression", + line: 1, + column: 34, + endLine: 1, + endColumn: 38 + }] }, { code: "var a = function() { return 1; }['bind'](b)", output: "var a = function() { return 1; }", - errors + errors: [{ + messageId: "unexpected", + type: "CallExpression", + line: 1, + column: 34, + endLine: 1, + endColumn: 40 + }] }, { code: "var a = function() { return 1; }[`bind`](b)", output: "var a = function() { return 1; }", parserOptions: { ecmaVersion: 6 }, - errors + errors: [{ + messageId: "unexpected", + type: "CallExpression", + line: 1, + column: 34, + endLine: 1, + endColumn: 40 + }] }, { code: "var a = (() => { return 1; }).bind(b)",