💼 This rule is enabled in the ✅ recommended
config.
When using meta.messages
and messageId
to report rule violations, it's possible to mistakenly leave a message in meta.messages
that is never used.
Examples of incorrect code for this rule:
/* eslint eslint-plugin/no-unused-message-ids: error */
module.exports = {
meta: {
messages: {
foo: 'hello world',
bar: 'lorem ipsum', // this message is never used
},
},
create(context) {
return {
CallExpression(node) {
context.report({
node,
messageId: 'foo',
});
},
};
},
};
Examples of correct code for this rule:
/* eslint eslint-plugin/no-unused-message-ids: error */
module.exports = {
meta: {
messages: {
foo: 'hello world',
},
},
create(context) {
return {
CallExpression(node) {
context.report({
node,
messageId: 'foo',
});
},
};
},
};