-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
feat(rules_check): validate the option examples for rules #4542
feat(rules_check): validate the option examples for rules #4542
Conversation
CodSpeed Performance ReportMerging #4542 will not alter performanceComparing Summary
|
4fbc10a
to
0c177cf
Compare
Note: This PR would (partially) break the generated documentation until biomejs/website#1442 is merged. I would therefore recommend reviewing this PR here first, then reviewing & merging biomejs/website#1442, and then merging this PR (as outlined in this issue comment). |
As it turns out, I actually uncovered a bug where implementation & documentation differs for a rule when I un-ignored one of the examples for the
This is not actually related to the feature of validating options in the docs, so I have created issue #4545, referenced that issue in the documentation & ignored the offending doctest for 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.
Great addition :)
Few questions:
- how would that work if there are multiple options for a rule, and we want to show multiple examples with different options?
- is it possible to have multiple option blocks?
A
A more complete example of a sequence of code blocks (within a single documentation comment):
This works great for most examples, and encourages the style of Further notes:
Footnotes
|
356e590
to
26d7cdf
Compare
…via resolve_analyzer_options
…ules documentation
26d7cdf
to
d5c0c1f
Compare
Thank you, @cr7pt0gr4ph7, for the thorough explanation! Let's make sure to have such an explanation in the contribution guide because that's where the majority of our contributors learn how to contribute to our linter :) |
Already done :) See the updated CONTRIBUTING.md. I also gave it a bit of additional polish (grammar, spelling, wording) and tried to make it better navigable for people new to Biome (like me). Is the updated contribution guide complete enough, or should I be even more explicit there? And also, thank you @arendjr and @ematipico for the quick reactions! It's way more rewarding (and efficient) to contribute to projects where your PRs don't get stalled for 2 months... 👍 |
Thank you, @cr7pt0gr4ph7 ! This is a great improvement. |
Thanks! This is a nice addition! :) |
Summary
Extend the
rules_check
to:(1) Ensure that configuration fragments are actually valid (and do not contain syntax or schema errors):
(2) Validate rule examples that use a non-default configuration:
(3) Allow hiding lines from the output like
rustdoc
does by prefixing them with#
.The corrresponding PR for
biomejs/website
is biomejs/website#1442.Test Plan
cargo run -p rules_check