Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding meta properties #151

Open
jfmengels opened this issue Oct 17, 2016 · 0 comments
Open

Adding meta properties #151

jfmengels opened this issue Oct 17, 2016 · 0 comments

Comments

@jfmengels
Copy link
Contributor

ESLint has, since v3 changed the format of its rules and those of its plugins. When we now export a rule, we can also export a meta property, in which we can put anything we want. At the moment, this is not used very much, but I have started using it in some of my other plugins, like eslint-plugin-lodash-fp and eslint-plugin-fp.

The meta property looks like this:

{
  meta: {
    docs: {
      description: 'Forbid the use of `class`.',
      recommended: 'error'
    }
  }
}

The core ESLint rules are usually structured like the previous example (with a docs property inside the meta object), so I just copied the structure.

I currently use this to do two things:

In eslint-find-rules, a tool that tells you whether you configured every ESLint rule from the core rules and the imported plugins, there is an issue about reading the value of the deprecated field (available already in core rules) to avoid suggesting deprecated rules, and it's being proposed in plugins with deprecated rules (including import and react). And AVA will have one soon too.

There might be pretty other nifty things to do with this that I haven't yet thought of. Anyway, if you're interested in having semi-automatic README updates, we could discuss that here. Not sure what I'm proposing either, but at least, now you know that this exists and could have a use :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant