-
Notifications
You must be signed in to change notification settings - Fork 63
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
docs: update rules table during build #274
Conversation
It seems like we could do this via |
Updated in bf20bb2. I also tweaked the tool so it doesn't crash if someone forgets to add metadata to a rule. |
tools/update-rules-docs.js
Outdated
const docs = rule?.meta?.docs; | ||
const ruleLink = `[\`${ruleName}\`](./docs/rules/${ruleName}.md)`; | ||
const recommendedText = recommended ? "yes" : "no"; | ||
const description = docs?.description || "_no description_"; | ||
const recommendedText = docs?.recommended ? "yes" : "no"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will ensure that all rules have description
. Is there a reason you're validating whether it's present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I noticed that when a rule has no meta.docs
the build fails without indicating which rule is the culprit, so I added a fallback to avoid the error. But if all rules will have a description
there is no need for a fallback. I've reverted that change now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Added a tool that generates the rules table in
README.md
automatically from rules metadata. The rules table will be generated per npm script during the build.Maybe we will also want to make sure that the rules table is up-to-date each time a commit is merged into the main branch. I'm not sure what's the best way to achieve this.
Fixes #273