Skip to content

Commit f5a5c24

Browse files
authored
fix: clarify report messages for no-missing-placeholders and no-unused-placeholders (#278)
1 parent 5bf0648 commit f5a5c24

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Diff for: lib/rules/no-missing-placeholders.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
schema: [],
2727
messages: {
2828
placeholderDoesNotExist:
29-
'The placeholder {{{{missingKey}}}} does not exist.',
29+
"The placeholder {{{{missingKey}}}} is missing (must provide it in the report's `data` object).",
3030
},
3131
},
3232

Diff for: lib/rules/no-unused-placeholders.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module.exports = {
2525
fixable: null,
2626
schema: [],
2727
messages: {
28-
placeholderUnused: 'The placeholder {{{{unusedKey}}}} is unused.',
28+
placeholderUnused:
29+
'The placeholder {{{{unusedKey}}}} is unused (does not exist in the actual message).',
2930
},
3031
},
3132

Diff for: tests/lib/rules/no-missing-placeholders.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const RuleTester = require('eslint').RuleTester;
1818
* @returns {object} An expected error
1919
*/
2020
function error(missingKey, type = 'Literal') {
21-
return { type, message: `The placeholder {{${missingKey}}} does not exist.` };
21+
return {
22+
type,
23+
message: `The placeholder {{${missingKey}}} is missing (must provide it in the report's \`data\` object).`,
24+
};
2225
}
2326

2427
// ------------------------------------------------------------------------------

Diff for: tests/lib/rules/no-unused-placeholders.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const RuleTester = require('eslint').RuleTester;
1818
* @returns {object} An expected error
1919
*/
2020
function error(unusedKey, type = 'Literal') {
21-
return { type, message: `The placeholder {{${unusedKey}}} is unused.` };
21+
return {
22+
type,
23+
message: `The placeholder {{${unusedKey}}} is unused (does not exist in the actual message).`,
24+
};
2225
}
2326

2427
// ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)