diff --git a/CHANGELOG.md b/CHANGELOG.md index a6971a072f..56a0c34334 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange ### Fixed * [`boolean-prop-naming`]: avoid a crash with a non-TSTypeReference type ([#3718][] @developer-bandi) * [`jsx-no-leaked-render`]: invalid report if left side is boolean ([#3746][] @akulsr0) +* [`jsx-closing-bracket-location`]: message shows `{{details}}` when there are no details ([#3759][] @mdjermanovic) +[#3759]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3759 [#3746]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3746 [#3718]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3718 diff --git a/lib/rules/jsx-closing-bracket-location.js b/lib/rules/jsx-closing-bracket-location.js index 9b79223088..26556d6117 100644 --- a/lib/rules/jsx-closing-bracket-location.js +++ b/lib/rules/jsx-closing-bracket-location.js @@ -267,7 +267,10 @@ module.exports = { return; } - const data = { location: MESSAGE_LOCATION[expectedLocation] }; + const data = { + location: MESSAGE_LOCATION[expectedLocation], + details: '', + }; const correctColumn = getCorrectColumn(tokens, expectedLocation); if (correctColumn !== null) { diff --git a/tests/lib/rules/jsx-closing-bracket-location.js b/tests/lib/rules/jsx-closing-bracket-location.js index c23ec1943a..120f1e3638 100644 --- a/tests/lib/rules/jsx-closing-bracket-location.js +++ b/tests/lib/rules/jsx-closing-bracket-location.js @@ -419,7 +419,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_TAG }, + data: { + location: MESSAGE_AFTER_TAG, + details: '', + }, }, ], }, @@ -434,7 +437,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -449,7 +455,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -536,7 +545,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -578,7 +590,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -644,7 +659,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -686,7 +704,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -1098,7 +1119,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_TAG }, + data: { + location: MESSAGE_AFTER_TAG, + details: '', + }, }, ], }, @@ -1216,7 +1240,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -1258,7 +1285,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -1324,7 +1354,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -1366,7 +1399,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_PROPS }, + data: { + location: MESSAGE_AFTER_PROPS, + details: '', + }, }, ], }, @@ -1778,7 +1814,10 @@ ruleTester.run('jsx-closing-bracket-location', rule, { errors: [ { messageId: 'bracketLocation', - data: { location: MESSAGE_AFTER_TAG }, + data: { + location: MESSAGE_AFTER_TAG, + details: '', + }, }, ], },