Skip to content

fix: pin en-US locale in builtin MDN type links - #997

Open
btea wants to merge 3 commits into
nodejs:mainfrom
btea:fix/mdn-type-link-locale
Open

fix: pin en-US locale in builtin MDN type links#997
btea wants to merge 3 commits into
nodejs:mainfrom
btea:fix/mdn-type-link-locale

Conversation

@btea

@btea btea commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

MDN URLs without a locale prefix get redirected to the visitor's preferred language, where heading anchor IDs are translated (e.g. #number_type becomes #number_类型). The original hash fragment no longer matches any anchor after the redirect, so type links fail to jump to the target section.

Pin the en-US locale on all MDN links that carry a hash fragment in the builtin type map, so the anchors resolve consistently.

Validation

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format:check & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI lite review requested due to automatic review settings August 4, 2026 04:17
@btea
btea requested a review from a team as a code owner August 4, 2026 04:17
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Aug 4, 2026 4:26am

Request Review

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation URL map and test expectation updates only; no runtime logic or security-sensitive code changes.

Overview
Fixes broken deep links for primitive and related builtin types (number, string, null, any, etc.) in generated docs.

builtin.json now uses https://developer.mozilla.org/en-US/docs/... for MDN entries that include a hash fragment (including iterable). Locale-less MDN URLs redirect to the visitor’s language, where heading anchor IDs differ, so fragments like #number_type no longer match and the link does not jump to the right section.

MDN URLs without a fragment (e.g. void, this) are unchanged. Unit tests in resolveTypes.test.mjs and transformers.test.mjs expect the updated URLs. A patch changeset records the @node-core/doc-kit release note.

Reviewed by Cursor Bugbot for commit 81a7c16. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 55c8508. Configure here.

Comment thread packages/core/src/generators/metadata/maps/builtin.json

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

Pins the en-US locale for MDN URLs in the builtin type link map when those URLs include hash fragments, avoiding locale-based redirects that can translate heading IDs and break in-page anchor navigation.

Changes:

  • Updated builtin MDN type links with hash fragments to use https://developer.mozilla.org/en-US/... URLs.
  • Added a changeset describing the user-facing fix and rationale.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/generators/metadata/maps/builtin.json Pins en-US on MDN URLs with fragments so anchor hashes remain stable across locales.
.changeset/mdn-type-link-locale.md Adds release notes for the locale-pinning fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .changeset/mdn-type-link-locale.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 4, 2026 04:20
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.60%. Comparing base (e46e3cf) to head (81a7c16).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #997   +/-   ##
=======================================
  Coverage   89.60%   89.60%           
=======================================
  Files         197      197           
  Lines       18418    18418           
  Branches     1724     1724           
=======================================
  Hits        16503    16503           
  Misses       1908     1908           
  Partials        7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 2 out of 2 changed files in this pull request and generated no new comments.

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 4 out of 4 changed files in this pull request and generated no new comments.

@AugustinMauroy AugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGMT !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants