[Internal Rule]: no-unused-messageId
See original GitHub issuePlease describe what the rule should do: It should report whenever there is a message id defined in rule’s meta property but its not been used anywhere in the rule’s definition
What category of rule is this? (place an “X” next to just one item)
[ ] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [X] Enforces code style (layout) [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
function checkMetaMessages(context, exportsNode) {
if (!messages) {
context.report({
node: exportsNode,
messageId: "used"
});
}
}
module.exports = {
meta: {
docs: {
description: "",
category: "Internal",
recommended: false
},
schema: [],
type: "suggestion",
messages: {
used: "Expected `meta.messages` property.",
notUsed: "Expected `meta.messages` property."
// ^^^ report here that this message id is not being used
}
},
create(context) {
return {
"Program"(node) {
checkMetaMessages(context, node);
}
};
}
};
Why should this rule be included in ESLint (instead of a plugin)? Internal rule for eslint
Are you willing to submit a pull request to implement this rule? Yes, rough implementation
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
eslint-plugin-eslint-plugin/no-unused-message-ids.md at main
Disallow unused messageId s in meta.messages ( eslint-plugin/no-unused-message-ids ). This rule is enabled in the ✓ recommended config.
Read more >Targeting and Eliminating Unlawful Text Messages
In this document, the Federal Communications Commission (Commission) proposes to require mobile wireless providers to block texts, ...
Read more >IDE0060: Remove unused parameter - .NET - Microsoft Learn
Overview. This rule flags unused parameters. This rule does not flag parameters that are named with the discard symbol _ .
Read more >no-unused-vars - ESLint - Pluggable JavaScript Linter
This rule is aimed at eliminating unused variables, functions, and function parameters. A variable foo is considered to be used if any of...
Read more >Vue: disable no-unused-vars error: the simplest fix
You are using eslint, which add rules to your code, no unused vars is one of them, which means you aren't allowed to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it has been accepted in https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/57
PRs are welcome! 😄
yeah, this seems good as well 👍 .