Skip to content

Commit 2cc2510

Browse files
authored
fix: make inline doc links valid (#10366)
* fix: make inline doc links valid * real glad you caught that one eslint. how would we ever cope without you --------- Co-authored-by: Rich Harris <[email protected]>
1 parent f2c2490 commit 2cc2510

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

.changeset/silver-guests-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: make inline doc links valid

packages/svelte/scripts/generate-dts.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ await createBundle({
3535

3636
// There's no way to tell in JS that a class can have arbitrary properties, so we need to add that manually
3737
const types = fs.readFileSync('types/index.d.ts', 'utf-8');
38+
39+
const bad_links = [...types.matchAll(/\]\((\/[^)]+)\)/g)];
40+
if (bad_links.length > 0) {
41+
console.error(
42+
'The following links in JSDoc annotations should be prefixed with https://svelte.dev:'
43+
);
44+
45+
for (const [, link] of bad_links) {
46+
console.error(`- ${link}`);
47+
}
48+
49+
process.exit(1);
50+
}
51+
3852
fs.writeFileSync(
3953
'types/index.d.ts',
4054
// same line to not affect source map

packages/svelte/src/runtime/internal/lifecycle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function beforeUpdate(fn) {
3232
*
3333
* If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.
3434
*
35-
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
35+
* `onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).
3636
*
3737
* https://svelte.dev/docs/svelte#onmount
3838
* @template T
@@ -71,7 +71,7 @@ export function onDestroy(fn) {
7171
}
7272

7373
/**
74-
* Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
74+
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname).
7575
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
7676
*
7777
* Component events created with `createEventDispatcher` create a

packages/svelte/src/runtime/transition/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function draw(node, { delay = 0, speed, duration, easing = cubicInOut } =
179179
}
180180

181181
/**
182-
* The `crossfade` function creates a pair of [transitions](/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
182+
* The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
183183
*
184184
* https://svelte.dev/docs/svelte-transition#crossfade
185185
* @param {import('./public').CrossfadeParams & {

packages/svelte/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ declare module 'svelte' {
189189
*
190190
* If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted.
191191
*
192-
* `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).
192+
* `onMount` does not run inside a [server-side component](https://svelte.dev/docs#run-time-server-side-component-api).
193193
*
194194
* https://svelte.dev/docs/svelte#onmount
195195
* */
@@ -212,7 +212,7 @@ declare module 'svelte' {
212212
* */
213213
export function onDestroy(fn: () => any): void;
214214
/**
215-
* Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
215+
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs#template-syntax-component-directives-on-eventname).
216216
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
217217
*
218218
* Component events created with `createEventDispatcher` create a
@@ -1789,7 +1789,7 @@ declare module 'svelte/transition' {
17891789
getTotalLength(): number;
17901790
}, { delay, speed, duration, easing }?: DrawParams | undefined): TransitionConfig;
17911791
/**
1792-
* The `crossfade` function creates a pair of [transitions](/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
1792+
* The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs#template-syntax-element-directives-transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
17931793
*
17941794
* https://svelte.dev/docs/svelte-transition#crossfade
17951795
* */

0 commit comments

Comments
 (0)