fix(mdn): improve key-not-found error hint#5137
Open
marcoscaceres wants to merge 3 commits intomainfrom
Open
Conversation
Previous hint sent users to a raw JSON URL (non-clickable, hard to read). New hint: - Uses docLink so [shortName] and [mdn] are clickable links to the docs - Explains that mdn: true uses shortName as the key (common confusion) - Links to GitHub-rendered SPECMAP.json (syntax highlighted, searchable with Ctrl+F) instead of the raw URL - Removes the duplicate of the error message from inside the hint
daca208 to
5b0b118
Compare
There was a problem hiding this comment.
Pull request overview
Improves the developer-facing hint shown when an MDN annotation key can’t be found, making it more actionable and adding clickable documentation links.
Changes:
- Uses
docLinkso references to[shortName]and[mdn]render as clickable links to ReSpec docs. - Expands the 404 “key not found” hint to explain the common
mdn: true/shortNamedefault behavior. - Links to the GitHub-rendered
SPECMAP.jsoninstead of a raw JSON URL.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sidvishnoi
reviewed
Apr 1, 2026
| if (res.status === 404) { | ||
| const msg = `Could not find MDN data associated with key "${key}".`; | ||
| const hint = "Please add a valid key to `respecConfig.mdn`"; | ||
| const hint = docLink`If using \`mdn: true\`, check that ${"[shortName]"} is set correctly — the MDN key defaults to the spec's shortName. Otherwise, search for your spec's URL in the [MDN spec links map](https://github.com/w3c/mdn-spec-links/blob/main/SPECMAP.json) to find the correct key, then set ${"[mdn]"} to it.`; |
Member
There was a problem hiding this comment.
We can check mdn === true and provide a more specific message?
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.
The hint for a missing MDN key sent users to a raw JSON URL (unreadable) and wasn't using
docLinkso nothing was clickable.Changes
docLinkso[shortName]and[mdn]link to their documentation pagesmdn: trueusesshortNameas the key automatically — the most common fixBefore
After
(with
shortName,MDN spec links map, andmdnas clickable links)🤖 Generated with Claude Code