fix(linter): Improve config option docs rendering for rules with enum configs#20018
Merged
connorshea merged 4 commits intooxc-project:mainfrom Mar 6, 2026
Merged
Conversation
…enum variants Schemars' draft-07 `RemoveRefSiblings` visitor moves `$ref` into an `allOf` wrapper when the schema has sibling properties (e.g. description from doc comments on enum variants). The doc generation code only handled nested `anyOf` when flattening schemas, missing these `allOf`-wrapped refs. This caused rules like `forbid-dom-props` to show only `string` instead of `object | string` with the full object properties. https://claude.ai/code/session_01SqwraaYKmCViWS6wotj8ce
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the website schema-to-markdown renderer so rule/config docs render correctly when schemars (draft-07) wraps $ref+siblings into allOf, fixing missing/incorrect docs for enum-based configs and similar patterns.
Changes:
- Update
schema_markdown.rsto unwrap/resolveallOfwrappers while flatteninganyOfschemas. - Refresh formatter schema markdown snapshots to reflect the improved rendering (e.g., marker-object option now appears as
object | array | stringwith expanded fields). - Expand linter rule docs snapshots and the snapshot test selection to include
react/forbid-dom-props.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/website_common/src/schema_markdown.rs | Unwraps allOf wrappers during anyOf flattening to correctly resolve referenced schemas for markdown docs. |
| tasks/website_formatter/src/snapshots/schema_markdown.snap | Snapshot updates reflecting improved schema markdown rendering (new object variant expansion). |
| tasks/website_linter/src/rules/mod.rs | Adds react/forbid-dom-props to the small set of rule pages included in the docs snapshot test. |
| tasks/website_linter/src/rules/snapshots/docs_rule_pages.snap | Snapshot updates for improved config docs output and inclusion of the new rule page. |
camc314
approved these changes
Mar 5, 2026
Contributor
Merge activity
|
Member
Author
|
I think it wouldn't auto-merge because I put it in my fork (since Claude isn't allowed to write to the oxc repo directly)? |
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.
Claude's summary:
schema_markdown.rsto properly handleallOfschemas created by theRemoveRefSiblingsvisitor$refhas sibling properties (likedescription), schemars' draft-07 visitor wraps it in anallOfallOfstructures to find the actual referenced schemaThis fixes the problem discovered in #19387 (comment).
This actually improves the generated docs for a few rules:
typescript/no-deprecatedno-floating-promisesreact/forbid-dom-propstypescript/no-misused-spreadtypescript/only-throw-errortypescript/prefer-readonly-parameter-typestypescript/prefer-nullish-coalescingtypescript/restrict-template-expressionsBasically, any rule that has a struct nested inside an array has better docs now, as the docs generator actually handles their schema correctly now.
AI Disclosure: Generated by Claude Code.
Examples:
no-deprecated
react/forbid-dom-props