Skip to content

Commit

Permalink
fix: clarify report messages for no-missing-placeholders and no-unuse…
Browse files Browse the repository at this point in the history
…d-placeholders (#278)
  • Loading branch information
bmish committed Aug 4, 2022
1 parent 5bf0648 commit f5a5c24
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-missing-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
schema: [],
messages: {
placeholderDoesNotExist:
'The placeholder {{{{missingKey}}}} does not exist.',
"The placeholder {{{{missingKey}}}} is missing (must provide it in the report's `data` object).",
},
},

Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-unused-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = {
fixable: null,
schema: [],
messages: {
placeholderUnused: 'The placeholder {{{{unusedKey}}}} is unused.',
placeholderUnused:
'The placeholder {{{{unusedKey}}}} is unused (does not exist in the actual message).',
},
},

Expand Down
5 changes: 4 additions & 1 deletion tests/lib/rules/no-missing-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ const RuleTester = require('eslint').RuleTester;
* @returns {object} An expected error
*/
function error(missingKey, type = 'Literal') {
return { type, message: `The placeholder {{${missingKey}}} does not exist.` };
return {
type,
message: `The placeholder {{${missingKey}}} is missing (must provide it in the report's \`data\` object).`,
};
}

// ------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion tests/lib/rules/no-unused-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ const RuleTester = require('eslint').RuleTester;
* @returns {object} An expected error
*/
function error(unusedKey, type = 'Literal') {
return { type, message: `The placeholder {{${unusedKey}}} is unused.` };
return {
type,
message: `The placeholder {{${unusedKey}}} is unused (does not exist in the actual message).`,
};
}

// ------------------------------------------------------------------------------
Expand Down

0 comments on commit f5a5c24

Please sign in to comment.