Replies: 3 comments 8 replies
-
Is this related to the RFC: eslint/rfcs#103? It is about adding support for testing invalid rule schemas and runtime exceptions. |
Beta Was this translation helpful? Give feedback.
-
Information about rule options can already be determined by a rule's I also built eslint-doc-generator which auto-generates part of the rule docs for plugins, enforces the presence of an options section and mention of named options when applicable, and I'm considering having it auto-generate the options section too. There's another tool called eslint-docgen which takes a different approach from my tool but uses test cases to generate examples in the rule doc. Just goes to show that a lot of data can be pulled automatically. |
Beta Was this translation helpful? Give feedback.
-
I am currently doing a deep dive on the documentation (New here and learning as much as possible). I'd be happy to review/test the new documentation once the project is underway. |
Beta Was this translation helpful? Give feedback.
-
This discussion is about standardizing the documentation for ESLint rules.
High Level Thoughts
I think the documentation show have the general structure:
Page-Level Outline
Every rule page should have:
Implementation Plan Options
A couple of proposals.
Option 1: More Structured Data in Frontmatter
One potential way would be to use as much structured data as possible, including stuff in the frontmatter and injecting in the template.
For example, you could add following fields to the frontmatter:
Update rules template to render content based on this structured data. To support incremental adoption of this, adding these frontmatter fields should be optional.
Then, the only free-form text would be the examples section and any additional info that writer wants to add.
Pros:
Cons:
Option 2: Convention-Based Page Structure
For this structure, there'd just be convention of adding the relevant data to the page in Markdown in a specified format.
Author and reviewer should be aware of the format that a rules page should be in, and ensure that the page adheres to that format.
Pros:
Cons:
...Other Options?
These are the two best approaches that I could think of, but I'm sure other approaches could work. Curious if the ESLint maintainers or community members have other thoughts here.
Final Thoughts
I'm partial to option 1, putting more content in the frontmatter. I think there'll be a bit more upfront work, but long-term will make the rules docs more maintainable and consistent.
Beta Was this translation helpful? Give feedback.
All reactions