Skip to content

Commit 095194c

Browse files
authored
Fix: add end location to reports in object-curly-newline (refs #12334) (#13460)
1 parent 10251bb commit 095194c

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

lib/rules/object-curly-newline.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ module.exports = {
224224
context.report({
225225
messageId: "expectedLinebreakAfterOpeningBrace",
226226
node,
227-
loc: openBrace.loc.start,
227+
loc: openBrace.loc,
228228
fix(fixer) {
229229
if (hasCommentsFirstToken) {
230230
return null;
@@ -238,7 +238,7 @@ module.exports = {
238238
context.report({
239239
messageId: "expectedLinebreakBeforeClosingBrace",
240240
node,
241-
loc: closeBrace.loc.start,
241+
loc: closeBrace.loc,
242242
fix(fixer) {
243243
if (hasCommentsLastToken) {
244244
return null;
@@ -260,7 +260,7 @@ module.exports = {
260260
context.report({
261261
messageId: "unexpectedLinebreakAfterOpeningBrace",
262262
node,
263-
loc: openBrace.loc.start,
263+
loc: openBrace.loc,
264264
fix(fixer) {
265265
if (hasCommentsFirstToken) {
266266
return null;
@@ -280,7 +280,7 @@ module.exports = {
280280
context.report({
281281
messageId: "unexpectedLinebreakBeforeClosingBrace",
282282
node,
283-
loc: closeBrace.loc.start,
283+
loc: closeBrace.loc,
284284
fix(fixer) {
285285
if (hasCommentsLastToken) {
286286
return null;

tests/lib/rules/object-curly-newline.js

+28-4
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,20 @@ ruleTester.run("object-curly-newline", rule, {
607607
].join("\n"),
608608
options: ["always"],
609609
errors: [
610-
{ line: 1, column: 9, messageId: "expectedLinebreakAfterOpeningBrace" },
611-
{ line: 1, column: 14, messageId: "expectedLinebreakBeforeClosingBrace" }
610+
{
611+
line: 1,
612+
column: 9,
613+
endLine: 1,
614+
endColumn: 10,
615+
messageId: "expectedLinebreakAfterOpeningBrace"
616+
},
617+
{
618+
line: 1,
619+
column: 14,
620+
endLine: 1,
621+
endColumn: 15,
622+
messageId: "expectedLinebreakBeforeClosingBrace"
623+
}
612624
]
613625
},
614626
{
@@ -717,8 +729,20 @@ ruleTester.run("object-curly-newline", rule, {
717729
].join("\n"),
718730
options: ["never"],
719731
errors: [
720-
{ line: 1, column: 9, messageId: "unexpectedLinebreakAfterOpeningBrace" },
721-
{ line: 3, column: 1, messageId: "unexpectedLinebreakBeforeClosingBrace" }
732+
{
733+
line: 1,
734+
column: 9,
735+
endLine: 1,
736+
endColumn: 10,
737+
messageId: "unexpectedLinebreakAfterOpeningBrace"
738+
},
739+
{
740+
line: 3,
741+
column: 1,
742+
endLine: 3,
743+
endColumn: 2,
744+
messageId: "unexpectedLinebreakBeforeClosingBrace"
745+
}
722746
]
723747
},
724748
{

0 commit comments

Comments
 (0)