feat(lint): replace HTML code tags and links in descriptions + notes#29508
Draft
caugner wants to merge 12 commits into
Draft
feat(lint): replace HTML code tags and links in descriptions + notes#29508caugner wants to merge 12 commits into
caugner wants to merge 12 commits into
Conversation
Contributor
|
Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs). |
Contributor
|
This pull request has merge conflicts that must be resolved before it can be merged. |
When a description triggers both `no_code_tag_in_description` and a canonical-form rule (`constructor`, `event`, …), the fixer applies errors in array order with last write winning. Pushing the code-tag error last overwrote the canonical expectation, so a single `fix` pass produced a non-canonical result that only converged on a second pass. Push the code-tag check first so canonical rules win in one pass.
Every consumer imports the helper directly from `lint/utils.js`; the re-export from `test-descriptions.js` was never used.
The existing tests exercised only the pure `fixNotes` helper. Add round-trip tests for the default export covering string and array notes, array-valued support statements, and the `/browsers/` skip.
Guard the `fixNotesFixer` walk against `"mirror"` support statements, which lack a `notes` property, and replace the nonexistent `CompatStatement` import (from `../../types/types.js`) with `InternalCompatStatement` from `../../types/index.js` in the notes and descriptions tests.
Add a `replaceLinkTagsWithMarkdown` helper and wire it into the descriptions and notes linters/fixers alongside the existing code-tag conversion, via a new `no_link_tag_in_description` rule and a matching notes check. Convert code tags before links so an anchor wrapping a `<code>` tag is unwrapped first, and push the link rule ahead of the canonical-description rules so those still win in a single fix pass.
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.
Summary
Extend the linter to replace raw HTML in
descriptionandnotesfields with Markdown, with auto-fix support:<code>…</code>→ backtick-quoted code (`…`)<a href='…'>text</a>→ Markdown links ([text](…))Code tags are unwrapped before links, so an anchor wrapping a
<code>tag converts correctly in a single pass. In descriptions, both rules run before the canonical-description rules (constructor,event, …) so those still win.Scope: only
descriptionandnotesare covered, since those are the fields the build converts from Markdown to HTML. Somevalue_to_setfields (inapi/PaymentRequest.json,api/PaymentResponse.json,api/PaymentMethodChangeEvent.json,api/PaymentRequestUpdateEvent.json,api/MerchantValidationEvent.json) still contain<code>HTML, but they are intentionally out of scope:value_to_setis not Markdown-rendered, and arguably should contain neither HTML nor Markdown at all.Test results and supporting details
replaceCodeTagsWithBackticks/replaceLinkTagsWithMarkdownhelpers, theno_code_tag_in_description/no_link_tag_in_descriptionrules, the notes checks, and the walk-based notes fixer (including the nested-<code>-in-link case).Notification.json,ResizeObserverEntry.json,ServiceWorkerRegistration.json). The bug links previously used HTML<a>and escaped the links linter; as Markdown they now conform to it unchanged.Related issues