diff --git a/lib/rules/arrow-body-style.js b/lib/rules/arrow-body-style.js index 9d5c77d8573..5954cf4a18d 100644 --- a/lib/rules/arrow-body-style.js +++ b/lib/rules/arrow-body-style.js @@ -136,7 +136,7 @@ module.exports = { context.report({ node, - loc: arrowBody.loc.start, + loc: arrowBody.loc, messageId, fix(fixer) { const fixes = []; @@ -201,7 +201,7 @@ module.exports = { if (always || (asNeeded && requireReturnForObjectLiteral && arrowBody.type === "ObjectExpression")) { context.report({ node, - loc: arrowBody.loc.start, + loc: arrowBody.loc, messageId: "expectedBlock", fix(fixer) { const fixes = []; diff --git a/tests/lib/rules/arrow-body-style.js b/tests/lib/rules/arrow-body-style.js index 7c1bea64ef8..c624a847c6a 100644 --- a/tests/lib/rules/arrow-body-style.js +++ b/tests/lib/rules/arrow-body-style.js @@ -53,6 +53,8 @@ ruleTester.run("arrow-body-style", rule, { { line: 1, column: 17, + endLine: 1, + endColumn: 18, type: "ArrowFunctionExpression", messageId: "expectedBlock" } @@ -440,6 +442,8 @@ ruleTester.run("arrow-body-style", rule, { { line: 1, column: 17, + endLine: 3, + endColumn: 2, type: "ArrowFunctionExpression", messageId: "unexpectedSingleBlock" } @@ -452,6 +456,8 @@ ruleTester.run("arrow-body-style", rule, { { line: 1, column: 17, + endLine: 2, + endColumn: 13, type: "ArrowFunctionExpression", messageId: "unexpectedSingleBlock" } @@ -464,6 +470,8 @@ ruleTester.run("arrow-body-style", rule, { { line: 1, column: 17, + endLine: 2, + endColumn: 2, type: "ArrowFunctionExpression", messageId: "unexpectedSingleBlock" } @@ -508,6 +516,8 @@ ruleTester.run("arrow-body-style", rule, { { line: 2, column: 31, + endLine: 7, + endColumn: 16, type: "ArrowFunctionExpression", messageId: "unexpectedObjectBlock" }