-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: markdown runtime errors/warnings (#11304)
* chore: markdown runtime warnings * on second thoughts * start adding errors too * lint * centralise
- Loading branch information
1 parent
8808860
commit 94b4268
Showing
27 changed files
with
243 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## effect_update_depth_exceeded | ||
|
||
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## lifecycle_outside_component | ||
|
||
`%name%(...)` can only be used during component initialisation | ||
|
||
## lifecycle_legacy_only | ||
|
||
`%name%(...)` cannot be used in runes mode |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## lifecycle_double_unmount | ||
|
||
Tried to unmount a component that was not mounted | ||
|
||
## ownership_invalid_binding | ||
|
||
%parent% passed a value to %child% with `bind:`, but the value is owned by %owner%. Consider creating a binding between %owner% and %parent% |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## dynamic_void_element_content | ||
|
||
`<svelte:element this="%tag%">` is a void element — it cannot have content |
This file contains 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
17 changes: 17 additions & 0 deletions
17
packages/svelte/scripts/process-messages/templates/client-errors.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DEV } from 'esm-env'; | ||
|
||
/** | ||
* MESSAGE | ||
* @param {string} PARAMETER | ||
* @returns {never} | ||
*/ | ||
export function CODE(PARAMETER) { | ||
if (DEV) { | ||
const error = new Error(`${'CODE'}\n${MESSAGE}`); | ||
error.name = 'Svelte error'; | ||
throw error; | ||
} else { | ||
// TODO print a link to the documentation | ||
throw new Error('CODE'); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/svelte/scripts/process-messages/templates/client-warnings.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DEV } from 'esm-env'; | ||
|
||
var bold = 'font-weight: bold'; | ||
var normal = 'font-weight: normal'; | ||
|
||
/** | ||
* MESSAGE | ||
* @param {string} PARAMETER | ||
*/ | ||
export function CODE(PARAMETER) { | ||
if (DEV) { | ||
console.warn(`%c[svelte] ${'CODE'}\n%c${MESSAGE}`, bold, normal); | ||
} else { | ||
// TODO print a link to the documentation | ||
console.warn('CODE'); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/svelte/scripts/process-messages/templates/shared-warnings.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DEV } from 'esm-env'; | ||
|
||
var bold = 'font-weight: bold'; | ||
var normal = 'font-weight: normal'; | ||
|
||
/** | ||
* MESSAGE | ||
* @param {boolean} trace | ||
* @param {string} PARAMETER | ||
*/ | ||
export function CODE(trace, PARAMETER) { | ||
if (DEV) { | ||
console.warn(`%c[svelte] ${'CODE'}\n%c${MESSAGE}`, bold, normal); | ||
if (trace) console.trace('stack trace'); | ||
} else { | ||
// TODO print a link to the documentation | ||
console.warn('CODE'); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* This file is generated by scripts/process-messages.js. Do not edit! */ | ||
|
||
import { DEV } from 'esm-env'; | ||
|
||
/** | ||
* Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops | ||
* @returns {never} | ||
*/ | ||
export function effect_update_depth_exceeded() { | ||
if (DEV) { | ||
const error = new Error(`${"effect_update_depth_exceeded"}\n${"Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops"}`); | ||
|
||
error.name = 'Svelte error'; | ||
throw error; | ||
} else { | ||
// TODO print a link to the documentation | ||
throw new Error("effect_update_depth_exceeded"); | ||
} | ||
} | ||
|
||
/** | ||
* `%name%(...)` can only be used during component initialisation | ||
* @param {string} name | ||
* @returns {never} | ||
*/ | ||
export function lifecycle_outside_component(name) { | ||
if (DEV) { | ||
const error = new Error(`${"lifecycle_outside_component"}\n${`\`${name}(...)\` can only be used during component initialisation`}`); | ||
|
||
error.name = 'Svelte error'; | ||
throw error; | ||
} else { | ||
// TODO print a link to the documentation | ||
throw new Error("lifecycle_outside_component"); | ||
} | ||
} | ||
|
||
/** | ||
* `%name%(...)` cannot be used in runes mode | ||
* @param {string} name | ||
* @returns {never} | ||
*/ | ||
export function lifecycle_legacy_only(name) { | ||
if (DEV) { | ||
const error = new Error(`${"lifecycle_legacy_only"}\n${`\`${name}(...)\` cannot be used in runes mode`}`); | ||
|
||
error.name = 'Svelte error'; | ||
throw error; | ||
} else { | ||
// TODO print a link to the documentation | ||
throw new Error("lifecycle_legacy_only"); | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.