Skip to content

Commit 23b0a49

Browse files
mdjermanovicljharb
authored andcommitted
[Fix] jsx-closing-bracket-location: message shows {{details}} when there are no details
1 parent fbb1e0f commit 23b0a49

File tree

3 files changed

+58
-14
lines changed

3 files changed

+58
-14
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
88
### Fixed
99
* [`boolean-prop-naming`]: avoid a crash with a non-TSTypeReference type ([#3718][] @developer-bandi)
1010
* [`jsx-no-leaked-render`]: invalid report if left side is boolean ([#3746][] @akulsr0)
11+
* [`jsx-closing-bracket-location`]: message shows `{{details}}` when there are no details ([#3759][] @mdjermanovic)
1112

13+
[#3759]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3759
1214
[#3746]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3746
1315
[#3718]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3718
1416

lib/rules/jsx-closing-bracket-location.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ module.exports = {
267267
return;
268268
}
269269

270-
const data = { location: MESSAGE_LOCATION[expectedLocation] };
270+
const data = {
271+
location: MESSAGE_LOCATION[expectedLocation],
272+
details: '',
273+
};
271274
const correctColumn = getCorrectColumn(tokens, expectedLocation);
272275

273276
if (correctColumn !== null) {

tests/lib/rules/jsx-closing-bracket-location.js

+52-13
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
419419
errors: [
420420
{
421421
messageId: 'bracketLocation',
422-
data: { location: MESSAGE_AFTER_TAG },
422+
data: {
423+
location: MESSAGE_AFTER_TAG,
424+
details: '',
425+
},
423426
},
424427
],
425428
},
@@ -434,7 +437,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
434437
errors: [
435438
{
436439
messageId: 'bracketLocation',
437-
data: { location: MESSAGE_AFTER_PROPS },
440+
data: {
441+
location: MESSAGE_AFTER_PROPS,
442+
details: '',
443+
},
438444
},
439445
],
440446
},
@@ -449,7 +455,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
449455
errors: [
450456
{
451457
messageId: 'bracketLocation',
452-
data: { location: MESSAGE_AFTER_PROPS },
458+
data: {
459+
location: MESSAGE_AFTER_PROPS,
460+
details: '',
461+
},
453462
},
454463
],
455464
},
@@ -536,7 +545,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
536545
errors: [
537546
{
538547
messageId: 'bracketLocation',
539-
data: { location: MESSAGE_AFTER_PROPS },
548+
data: {
549+
location: MESSAGE_AFTER_PROPS,
550+
details: '',
551+
},
540552
},
541553
],
542554
},
@@ -578,7 +590,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
578590
errors: [
579591
{
580592
messageId: 'bracketLocation',
581-
data: { location: MESSAGE_AFTER_PROPS },
593+
data: {
594+
location: MESSAGE_AFTER_PROPS,
595+
details: '',
596+
},
582597
},
583598
],
584599
},
@@ -644,7 +659,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
644659
errors: [
645660
{
646661
messageId: 'bracketLocation',
647-
data: { location: MESSAGE_AFTER_PROPS },
662+
data: {
663+
location: MESSAGE_AFTER_PROPS,
664+
details: '',
665+
},
648666
},
649667
],
650668
},
@@ -686,7 +704,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
686704
errors: [
687705
{
688706
messageId: 'bracketLocation',
689-
data: { location: MESSAGE_AFTER_PROPS },
707+
data: {
708+
location: MESSAGE_AFTER_PROPS,
709+
details: '',
710+
},
690711
},
691712
],
692713
},
@@ -1098,7 +1119,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
10981119
errors: [
10991120
{
11001121
messageId: 'bracketLocation',
1101-
data: { location: MESSAGE_AFTER_TAG },
1122+
data: {
1123+
location: MESSAGE_AFTER_TAG,
1124+
details: '',
1125+
},
11021126
},
11031127
],
11041128
},
@@ -1216,7 +1240,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
12161240
errors: [
12171241
{
12181242
messageId: 'bracketLocation',
1219-
data: { location: MESSAGE_AFTER_PROPS },
1243+
data: {
1244+
location: MESSAGE_AFTER_PROPS,
1245+
details: '',
1246+
},
12201247
},
12211248
],
12221249
},
@@ -1258,7 +1285,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
12581285
errors: [
12591286
{
12601287
messageId: 'bracketLocation',
1261-
data: { location: MESSAGE_AFTER_PROPS },
1288+
data: {
1289+
location: MESSAGE_AFTER_PROPS,
1290+
details: '',
1291+
},
12621292
},
12631293
],
12641294
},
@@ -1324,7 +1354,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
13241354
errors: [
13251355
{
13261356
messageId: 'bracketLocation',
1327-
data: { location: MESSAGE_AFTER_PROPS },
1357+
data: {
1358+
location: MESSAGE_AFTER_PROPS,
1359+
details: '',
1360+
},
13281361
},
13291362
],
13301363
},
@@ -1366,7 +1399,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
13661399
errors: [
13671400
{
13681401
messageId: 'bracketLocation',
1369-
data: { location: MESSAGE_AFTER_PROPS },
1402+
data: {
1403+
location: MESSAGE_AFTER_PROPS,
1404+
details: '',
1405+
},
13701406
},
13711407
],
13721408
},
@@ -1778,7 +1814,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, {
17781814
errors: [
17791815
{
17801816
messageId: 'bracketLocation',
1781-
data: { location: MESSAGE_AFTER_TAG },
1817+
data: {
1818+
location: MESSAGE_AFTER_TAG,
1819+
details: '',
1820+
},
17821821
},
17831822
],
17841823
},

0 commit comments

Comments
 (0)