Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/mdn-type-link-locale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@node-core/doc-kit': patch
---

Pin the `en-US` locale on builtin MDN type links that carry a hash fragment
(e.g. `number`, `string`, `any`). Locale-less MDN URLs redirect to the
visitor's preferred language, where heading anchor IDs are translated, so the
original fragment (e.g. `#number_type`) no longer matches any anchor on the
redirected page and the link fails to jump to the target section.
20 changes: 10 additions & 10 deletions packages/core/src/generators/metadata/maps/builtin.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"asynciterable": "https://tc39.github.io/ecma262/#sec-asynciterable-interface",
"iterable": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol",
"iterable": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol",
"void": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/void",
"module namespace object": "https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects",
"null": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#null_type",
"undefined": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#undefined_type",
"boolean": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#boolean_type",
"number": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type",
"bigint": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#bigint_type",
"string": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type",
"symbol": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#symbol_type",
"integer": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#number_type",
"any": "https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#Data_types",
"null": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#null_type",
"undefined": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type",
"boolean": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type",
"number": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type",
"bigint": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type",
"string": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type",
"symbol": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#symbol_type",
"integer": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type",
"any": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types",
Comment thread
cursor[bot] marked this conversation as resolved.
"this": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/this"
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('resolveTypeAnnotations', () => {
],
[
'string',
'https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type',
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type',
],
['Buffer', 'buffer.html#buffer'],
]
Expand All @@ -135,7 +135,7 @@ describe('resolveTypeAnnotations', () => {

it('resolves every annotation in a nested tree', () => {
const STRING_URL =
'https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type';
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type';

// Two per paragraph: a visitor that skips siblings still reaches the first
const nodes = ['string', 'HTTP/2 Headers Object', 'string', 'string'].map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('lookupTypeName', () => {
it('resolves JavaScript primitives from the built-in map', () => {
strictEqual(
lookupTypeName('string'),
'https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type'
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type'
);
});

Expand Down
Loading