Skip to content

Commit 0655f66

Browse files
authored
Update: improve report location in arrow-body-style (refs #12334) (#13424)
1 parent d53d69a commit 0655f66

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/rules/arrow-body-style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136

137137
context.report({
138138
node,
139-
loc: arrowBody.loc.start,
139+
loc: arrowBody.loc,
140140
messageId,
141141
fix(fixer) {
142142
const fixes = [];
@@ -201,7 +201,7 @@ module.exports = {
201201
if (always || (asNeeded && requireReturnForObjectLiteral && arrowBody.type === "ObjectExpression")) {
202202
context.report({
203203
node,
204-
loc: arrowBody.loc.start,
204+
loc: arrowBody.loc,
205205
messageId: "expectedBlock",
206206
fix(fixer) {
207207
const fixes = [];

tests/lib/rules/arrow-body-style.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ ruleTester.run("arrow-body-style", rule, {
5353
{
5454
line: 1,
5555
column: 17,
56+
endLine: 1,
57+
endColumn: 18,
5658
type: "ArrowFunctionExpression",
5759
messageId: "expectedBlock"
5860
}
@@ -440,6 +442,8 @@ ruleTester.run("arrow-body-style", rule, {
440442
{
441443
line: 1,
442444
column: 17,
445+
endLine: 3,
446+
endColumn: 2,
443447
type: "ArrowFunctionExpression",
444448
messageId: "unexpectedSingleBlock"
445449
}
@@ -452,6 +456,8 @@ ruleTester.run("arrow-body-style", rule, {
452456
{
453457
line: 1,
454458
column: 17,
459+
endLine: 2,
460+
endColumn: 13,
455461
type: "ArrowFunctionExpression",
456462
messageId: "unexpectedSingleBlock"
457463
}
@@ -464,6 +470,8 @@ ruleTester.run("arrow-body-style", rule, {
464470
{
465471
line: 1,
466472
column: 17,
473+
endLine: 2,
474+
endColumn: 2,
467475
type: "ArrowFunctionExpression",
468476
messageId: "unexpectedSingleBlock"
469477
}
@@ -508,6 +516,8 @@ ruleTester.run("arrow-body-style", rule, {
508516
{
509517
line: 2,
510518
column: 31,
519+
endLine: 7,
520+
endColumn: 16,
511521
type: "ArrowFunctionExpression",
512522
messageId: "unexpectedObjectBlock"
513523
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy