Skip to content
Permalink
Browse files

Fix: add end location to reports in object-curly-newline (refs #12334) (

  • Loading branch information
mdjermanovic committed Jul 7, 2020
1 parent 10251bb commit 095194c0fc0eb02aa69fde6b4280696e0e4de214
Showing with 32 additions and 8 deletions.
  1. +4 −4 lib/rules/object-curly-newline.js
  2. +28 −4 tests/lib/rules/object-curly-newline.js
@@ -224,7 +224,7 @@ module.exports = {
context.report({
messageId: "expectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc.start,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) {
return null;
@@ -238,7 +238,7 @@ module.exports = {
context.report({
messageId: "expectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc.start,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) {
return null;
@@ -260,7 +260,7 @@ module.exports = {
context.report({
messageId: "unexpectedLinebreakAfterOpeningBrace",
node,
loc: openBrace.loc.start,
loc: openBrace.loc,
fix(fixer) {
if (hasCommentsFirstToken) {
return null;
@@ -280,7 +280,7 @@ module.exports = {
context.report({
messageId: "unexpectedLinebreakBeforeClosingBrace",
node,
loc: closeBrace.loc.start,
loc: closeBrace.loc,
fix(fixer) {
if (hasCommentsLastToken) {
return null;
@@ -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"
}
]
},
{
@@ -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"
}
]
},
{

0 comments on commit 095194c

Please sign in to comment.
You can’t perform that action at this time.