Skip to content

feat: add normalize-see-links rule - #1725

Merged
brettz9 merged 2 commits into
gajus:mainfrom
morgan-coded:normalize-see-links
Jul 18, 2026
Merged

feat: add normalize-see-links rule#1725
brettz9 merged 2 commits into
gajus:mainfrom
morgan-coded:normalize-see-links

Conversation

@morgan-coded

Copy link
Copy Markdown
Contributor

Closes #1631 by adding a fixable normalize-see-links rule for labeled links in @see tags. It converts Markdown [label](url) and prefix [label]{@link url} links to {@link url|label} and leaves that pipe form unchanged. Malformed or delimiter-colliding links, empty labels, code-span content, and scoped-package targets report without a fix. Bare URLs, namepaths, prose, and non-@see tags remain no-ops, with bare-URL wrapping deferred as an opt-in because it is "fine as an option if people want it." The default canonical form is pipe, while the canonicalForm option also allows prefix if that form is preferred.

Copilot AI review requested due to automatic review settings July 18, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@brettz9 brettz9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking good to me. If you could just address the comments. I'd hope we can avoid unresolveable errors.

Comment thread test/rules/assertions/normalizeSeeLinks.js
Comment thread test/rules/assertions/normalizeSeeLinks.js
Comment thread src/rules/normalizeSeeLinks.js Outdated
@morgan-coded

Copy link
Copy Markdown
Contributor Author

Addressed all three. URL-side delimiter collisions now autofix through encodeURI (existing %HH escapes are preserved so they aren't double-encoded), and the canonicalForm option now shows a sample of each form.

On the label side, when I tried the \} escape from the spec I found {@link https://example.com|a\}b} came back with the label truncated to a\, and I couldn't get [a\]b]{@link ...} to parse at all (jsdoccomment 0.88.0). So rather than emit a fix that doesn't round-trip, I left those two report-only for now. The safe label cases do autofix: extra | in the text, a literal } in a prefix label, and a bare { in a pipe label all parse back cleanly. Happy to enable \}/\] if those become parseable later. Empty labels stay report-only since there's nothing to normalize.

@brettz9

brettz9 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

LGTM, thanks for the PR!

@brettz9
brettz9 merged commit c03dd66 into gajus:main Jul 18, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 63.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule suggestion: enforce proper @see + @link syntax for hyperlinks

3 participants