docs(linter): Raise error if rule docs contain unclosed markdown codeblocks.#17889
Merged
graphite-app[bot] merged 1 commit intomainfrom Jan 11, 2026
Merged
docs(linter): Raise error if rule docs contain unclosed markdown codeblocks.#17889graphite-app[bot] merged 1 commit intomainfrom
graphite-app[bot] merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds validation to the declare_oxc_lint! macro to detect unclosed markdown code fences (triple backticks) in rule documentation. This helps prevent common documentation errors where code blocks are accidentally left unclosed.
Changes:
- Added tracking of triple backtick occurrences in rule documentation comments
- Added validation to ensure code fences are properly paired (even count)
- Generates compile-time error with helpful message when unclosed code blocks are detected
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merging this PR will not alter performance
Comparing Footnotes
|
camc314
approved these changes
Jan 11, 2026
Contributor
Merge activity
|
…blocks. (#17889) AI Disclosure: Used GitHub Copilot + Raptor mini for help with this, have code reviewed and confirmed the behavior is correct after adding an invalid codeblock. The implementation is a bit naive (markdown technically allows 4 backticks in some situations, for example, and this doesn't technically catch whether that is closed properly), but I think it should be fine if it works fine with all 650 rules we already have. This will prevent a somewhat-common mistake in the rule documentation where we unintentionally have invalid markdown. Now, the rule will fail if the docs are invalid in this way. e.g. see #17888. We should maybe consider updating the macro to also error on certain missing headers, but that's a future concern.
18b0028 to
2b11d4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI Disclosure: Used GitHub Copilot + Raptor mini for help with this, have code reviewed and confirmed the behavior is correct after adding an invalid codeblock. The implementation is a bit naive (markdown technically allows 4 backticks in some situations, for example, and this doesn't technically catch whether that is closed properly), but I think it should be fine if it works fine with all 650 rules we already have.
This will prevent a somewhat-common mistake in the rule documentation where we unintentionally have invalid markdown. Now, the rule will fail if the docs are invalid in this way. e.g. see #17888.
We should maybe consider updating the macro to also error on certain missing headers, but that's a future concern.