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

Consider adding meta.schema #7608

Open
MrHBS opened this issue Apr 13, 2024 · 7 comments
Open

Consider adding meta.schema #7608

MrHBS opened this issue Apr 13, 2024 · 7 comments
Labels
status: needs discussion triage needs further discussion

Comments

@MrHBS
Copy link

MrHBS commented Apr 13, 2024

It would be equivalent to ESLint’s meta.schema. This can be used for generating plugin/rule documentation websites and typegens.

@ybiquitous
Copy link
Member

Sounds good 👍🏼

Maybe one downside is increasing a dependency that processes the JSON schema, right?

@MrHBS
Copy link
Author

MrHBS commented Apr 17, 2024

Yeah, I believe ESLint uses Ajv JSON schema validator for this.

@ybiquitous
Copy link
Member

Great. ajv is already included in our runtime dependency tree (stylelint depends on table).

$ npm ls ajv
stylelint@16.3.1 /Users/masafumi.koba/git/stylelint/stylelint
├─┬ eslint@8.57.0
│ ├─┬ @eslint/eslintrc@2.1.4
│ │ └── ajv@6.12.6 deduped
│ └── ajv@6.12.6
└─┬ table@6.8.2
  └── ajv@8.12.0

@ybiquitous
Copy link
Member

@MrHBS If you're interested, could you please show more specific idea to implement this feature so that others could image it easily?

@MrHBS
Copy link
Author

MrHBS commented Apr 18, 2024

Sure. Here is an example of the schema of the accessor-pairs rule:

https://github.com/eslint/eslint/blob/1cbe1f6d38272784307c260f2375ab30e68716e8/lib/rules/accessor-pairs.js#L148-L165

And you can see here how ESLint validates the rule based on its schema.

Finally, an example of tools that utilize this schema: eslint-doc-generator and eslint-typegen.

@ybiquitous
Copy link
Member

@MrHBS Thanks for the helpful info.

@ota-meshi Do you have any ideas to bring this feature from ESLint?

@Mouvedia
Copy link
Contributor

Here's another use case for autocompletion: knowing the message arguments' names and positions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

3 participants