Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: add end location to reports in object-curly-newline (refs #12334) (
  • Loading branch information
mdjermanovic committed Jul 7, 2020
1 parent 10251bb commit 095194c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/rules/object-curly-newline.js
Expand Up @@ -224,7 +224,7 @@ module.exports = {
context.report({
messageId: "expectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc.start,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) {
return null;
Expand All @@ -238,7 +238,7 @@ module.exports = {
context.report({
messageId: "expectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc.start,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) {
return null;
Expand All @@ -260,7 +260,7 @@ module.exports = {
context.report({
messageId: "unexpectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc.start,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) {
return null;
Expand All @@ -280,7 +280,7 @@ module.exports = {
context.report({
messageId: "unexpectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc.start,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) {
return null;
Expand Down
32 changes: 28 additions & 4 deletions tests/lib/rules/object-curly-newline.js
Expand Up @@ -607,8 +607,20 @@ ruleTester.run("object-curly-newline", rule, {
].join("\n"),
options: ["always"],
errors: [
{ line: 1, column: 9, messageId: "expectedLinebreakAfterOpeningBrace" },
{ line: 1, column: 14, messageId: "expectedLinebreakBeforeClosingBrace" }
{
line: 1,
column: 9,
endLine: 1,
endColumn: 10,
messageId: "expectedLinebreakAfterOpeningBrace"
},
{
line: 1,
column: 14,
endLine: 1,
endColumn: 15,
messageId: "expectedLinebreakBeforeClosingBrace"
}
]
},
{
Expand Down Expand Up @@ -717,8 +729,20 @@ ruleTester.run("object-curly-newline", rule, {
].join("\n"),
options: ["never"],
errors: [
{ line: 1, column: 9, messageId: "unexpectedLinebreakAfterOpeningBrace" },
{ line: 3, column: 1, messageId: "unexpectedLinebreakBeforeClosingBrace" }
{
line: 1,
column: 9,
endLine: 1,
endColumn: 10,
messageId: "unexpectedLinebreakAfterOpeningBrace"
},
{
line: 3,
column: 1,
endLine: 3,
endColumn: 2,
messageId: "unexpectedLinebreakBeforeClosingBrace"
}
]
},
{
Expand Down

0 comments on commit 095194c

Please sign in to comment.