Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update: improve report location in arrow-body-style (refs #12334) (#1…
  • Loading branch information
yeonjuan committed Jun 25, 2020
1 parent d53d69a commit 0655f66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/arrow-body-style.js
Expand Up @@ -136,7 +136,7 @@ module.exports = {

context.report({
node,
loc: arrowBody.loc.start,
loc: arrowBody.loc,
messageId,
fix(fixer) {
const fixes = [];
Expand Down Expand Up @@ -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 = [];
Expand Down
10 changes: 10 additions & 0 deletions tests/lib/rules/arrow-body-style.js
Expand Up @@ -53,6 +53,8 @@ ruleTester.run("arrow-body-style", rule, {
{
line: 1,
column: 17,
endLine: 1,
endColumn: 18,
type: "ArrowFunctionExpression",
messageId: "expectedBlock"
}
Expand Down Expand Up @@ -440,6 +442,8 @@ ruleTester.run("arrow-body-style", rule, {
{
line: 1,
column: 17,
endLine: 3,
endColumn: 2,
type: "ArrowFunctionExpression",
messageId: "unexpectedSingleBlock"
}
Expand All @@ -452,6 +456,8 @@ ruleTester.run("arrow-body-style", rule, {
{
line: 1,
column: 17,
endLine: 2,
endColumn: 13,
type: "ArrowFunctionExpression",
messageId: "unexpectedSingleBlock"
}
Expand All @@ -464,6 +470,8 @@ ruleTester.run("arrow-body-style", rule, {
{
line: 1,
column: 17,
endLine: 2,
endColumn: 2,
type: "ArrowFunctionExpression",
messageId: "unexpectedSingleBlock"
}
Expand Down Expand Up @@ -508,6 +516,8 @@ ruleTester.run("arrow-body-style", rule, {
{
line: 2,
column: 31,
endLine: 7,
endColumn: 16,
type: "ArrowFunctionExpression",
messageId: "unexpectedObjectBlock"
}
Expand Down

0 comments on commit 0655f66

Please sign in to comment.