diff --git a/documentation/docs/98-reference/.generated/compile-warnings.md b/documentation/docs/98-reference/.generated/compile-warnings.md index 8d0aedbc07..d37d297526 100644 --- a/documentation/docs/98-reference/.generated/compile-warnings.md +++ b/documentation/docs/98-reference/.generated/compile-warnings.md @@ -703,7 +703,7 @@ 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 +### unexpected_head ``` Using `` (%location%) will likely lead to runtime errors. Use [``](https://svelte.dev/docs/svelte/svelte-head) instead diff --git a/packages/svelte/messages/compile-warnings/template.md b/packages/svelte/messages/compile-warnings/template.md index 1241b58d08..cae0f1c38c 100644 --- a/packages/svelte/messages/compile-warnings/template.md +++ b/packages/svelte/messages/compile-warnings/template.md @@ -83,7 +83,7 @@ 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 +## unexpected_head > Using `` (%location%) will likely lead to runtime errors. Use [``](https://svelte.dev/docs/svelte/svelte-head) instead diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js index bf65b106eb..d213f5e43a 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js +++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js @@ -127,7 +127,7 @@ export function RegularElement(node, context) { } if (node.name === 'head' && !context.state.parent_element) { - w.head_in_component(node, locate_node(node)); + w.unexpected_head(node, locate_node(node)); } node.metadata.has_spread = node.attributes.some( diff --git a/packages/svelte/src/compiler/warnings.js b/packages/svelte/src/compiler/warnings.js index c916d34d1a..7959b7d211 100644 --- a/packages/svelte/src/compiler/warnings.js +++ b/packages/svelte/src/compiler/warnings.js @@ -113,7 +113,7 @@ export const codes = [ 'element_implicitly_closed', 'element_invalid_self_closing_tag', 'event_directive_deprecated', - 'head_in_component', + 'unexpected_head', 'node_invalid_placement_ssr', 'script_context_deprecated', 'script_unknown_attribute', @@ -791,8 +791,8 @@ export function event_directive_deprecated(node, name) { * @param {null | NodeLike} node * @param {string} location */ -export function head_in_component(node, location) { - w(node, 'head_in_component', `Using \`\` (${location}) will likely lead to runtime errors. Use [\`\`](https://svelte.dev/docs/svelte/svelte-head) instead\nhttps://svelte.dev/e/head_in_component`); +export function unexpected_head(node, location) { + w(node, 'unexpected_head', `Using \`\` (${location}) will likely lead to runtime errors. Use [\`\`](https://svelte.dev/docs/svelte/svelte-head) instead\nhttps://svelte.dev/e/unexpected_head`); } /** @@ -852,4 +852,4 @@ export function svelte_element_invalid_this(node) { */ export function svelte_self_deprecated(node, name, basename) { w(node, 'svelte_self_deprecated', `\`\` is deprecated — use self-imports (e.g. \`import ${name} from './${basename}'\`) instead\nhttps://svelte.dev/e/svelte_self_deprecated`); -} \ No newline at end of file +} diff --git a/packages/svelte/tests/validator/samples/naked-head/warnings.json b/packages/svelte/tests/validator/samples/naked-head/warnings.json index bfbd5ce0f8..9820233a88 100644 --- a/packages/svelte/tests/validator/samples/naked-head/warnings.json +++ b/packages/svelte/tests/validator/samples/naked-head/warnings.json @@ -1,6 +1,6 @@ [ { - "code": "head_in_component", + "code": "unexpected_head", "message": "Using `` ((unknown):1:0) will likely lead to runtime errors. Use [``](https://svelte.dev/docs/svelte/svelte-head) instead", "start": { "line": 1,