question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Internal Rule]: no-unused-messageId

See original GitHub issue

Please 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
aladdin-addcommented, May 5, 2020
0reactions
anikethsahacommented, Apr 26, 2020

Another suggestion: implement this rule into eslint-plugin-eslint-plugin.

yeah, this seems good as well 👍 .

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found