fix message

pull/18151/head
Rich Harris 2 weeks ago
parent 2df832d4c7
commit dae91eb65a

@ -703,6 +703,12 @@ See [the migration guide](v5-migration-guide#Event-changes) for more info.
Component has unused export property '%name%'. If it is for external reference only, please consider using `export const %name%`
```
### head_in_component
```
Using `<head>` (%location%) will likely lead to runtime errors. Use [`<svelte:head>`](https://svelte.dev/e/head_in_component) instead
```
### legacy_code
```

@ -83,6 +83,10 @@ In a future version of Svelte, self-closing tags may be upgraded from a warning
See [the migration guide](v5-migration-guide#Event-changes) for more info.
## head_in_component
> Using `<head>` (%location%) will likely lead to runtime errors. Use [`<svelte:head>`](https://svelte.dev/e/head_in_component) instead
## node_invalid_placement_ssr
> %message%. When rendering this component on the server, the resulting HTML will be modified by the browser (by moving, removing, or inserting elements), likely resulting in a `hydration_mismatch` warning

@ -17,7 +17,7 @@ import { check_element } from './shared/a11y/index.js';
import { validate_element } from './shared/element.js';
import { mark_subtree_dynamic } from './shared/fragment.js';
import { object } from '../../../utils/ast.js';
import { component_name, filename, locator, runes } from '../../../state.js';
import { component_name, filename, locate_node, locator, runes } from '../../../state.js';
/**
* @param {AST.RegularElement} node
@ -127,7 +127,7 @@ export function RegularElement(node, context) {
}
if (node.name === 'head' && !context.state.parent_element) {
w.head_in_component(node, filename, component_name, `${locator(node.start).line}`);
w.head_in_component(node, locate_node(node));
}
node.metadata.has_spread = node.attributes.some(

@ -787,14 +787,12 @@ export function event_directive_deprecated(node, name) {
}
/**
* A `<head>` tag was detected in file `%filename%`, component `%component%`, at line %line%. This can lead to runtime errors. Did you mean to use `<svelte:head>`?
* Using `<head>` (%location%) will likely lead to runtime errors. Use [`<svelte:head>`](https://svelte.dev/e/head_in_component) instead
* @param {null | NodeLike} node
* @param {string} filename
* @param {string} component
* @param {string} line
* @param {string} location
*/
export function head_in_component(node, filename, component, line) {
w(node, 'head_in_component', `A \`<head>\` tag was detected in file \`${filename}\`, component \`${component}\`, at line ${line}. This can lead to runtime errors. Did you mean to use \`<svelte:head>\`?\nhttps://svelte.dev/e/head_in_component`);
export function head_in_component(node, location) {
w(node, 'head_in_component', `Using \`<head>\` (${location}) will likely lead to runtime errors. Use [\`<svelte:head>\`](https://svelte.dev/e/head_in_component) instead\nhttps://svelte.dev/e/head_in_component`);
}
/**

Loading…
Cancel
Save