fix(error-messages): improve hints in xref and link-to-dfn#5170
Open
marcoscaceres wants to merge 3 commits intomainfrom
Open
fix(error-messages): improve hints in xref and link-to-dfn#5170marcoscaceres wants to merge 3 commits intomainfrom
marcoscaceres wants to merge 3 commits intomainfrom
Conversation
xref.js: invalid xref config value had no hint. Now explains the four valid forms and links to docs. link-to-dfn.js: linkless <a> warning had no hint. Now suggests adding a <dfn>, using data-cite, or enabling xref. Also detects when the link is inside a data-link-for section and warns about scoping.
Contributor
There was a problem hiding this comment.
Pull request overview
Improves ReSpec’s author-facing diagnostics by adding actionable hint text (with documentation links) to previously under-explained xref and definition-linking warnings/errors.
Changes:
- Add a
docLink-based hint for invalidrespecConfig.xrefvalues incore/xref. - Add a detailed hint for linkless
<a>elements with no matching<dfn>incore/link-to-dfn, including guidance arounddata-link-forscoping. - Import and use
docLinkinlink-to-dfnto make hint references clickable.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/core/xref.js | Adds a new linked hint explaining valid xref config shapes when the value is invalid. |
| src/core/link-to-dfn.js | Adds a new warning hint (with doc links) and a data-link-for scoping note for linkless anchors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
xrefconfig value had no hint. Now explains the four valid forms (boolean, profile name, array, object) and links to docs viadocLink.<a>warning had no hint. Now suggests adding a<dfn>, usingdata-cite, or enablingxref. Also detects when the link is inside adata-link-forsection and warns about scoping.Split from #5135; MDN hint improvement is in #5137.
Test plan
pnpm start --browser ChromeHeadless --grep="link-to-dfn"— existing tests passpnpm start --browser ChromeHeadless --grep="xref"— existing tests pass