Skip to content

Commit 1b1545e

Browse files
committed
chore: update messages
1 parent b1c663a commit 1b1545e

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

packages/svelte/messages/compile-errors/template.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@
240240

241241
> snippets do not support rest parameters; use an array instead
242242
243+
## snippet_shadowing_children_prop
244+
245+
> The component content is implicitly passed as a `children` snippet which conflicts with the `children` prop set as an attribute.
246+
243247
## snippet_shadowing_prop
244248

245-
> This snippet is shadowing the prop `%prop%` with the same name
249+
> This snippet is conflicting with the prop `%prop%` with the same name
246250
247251
## style_directive_invalid_modifier
248252

packages/svelte/src/compiler/errors.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,13 +1077,13 @@ export function snippet_invalid_rest_parameter(node) {
10771077
}
10781078

10791079
/**
1080-
* This snippet is shadowing the prop `%prop%` with the same name
1080+
* This snippet is conflicting with the prop `%prop%` with the same name
10811081
* @param {null | number | NodeLike} node
10821082
* @param {string} prop
10831083
* @returns {never}
10841084
*/
10851085
export function snippet_shadowing_prop(node, prop) {
1086-
e(node, "snippet_shadowing_prop", `This snippet is shadowing the prop \`${prop}\` with the same name`);
1086+
e(node, "snippet_shadowing_prop", `This snippet is conflicting with the prop \`${prop}\` with the same name`);
10871087
}
10881088

10891089
/**
@@ -1384,4 +1384,13 @@ export function unexpected_reserved_word(node, word) {
13841384
*/
13851385
export function void_element_invalid_content(node) {
13861386
e(node, "void_element_invalid_content", "Void elements cannot have children or closing tags");
1387+
}
1388+
1389+
/**
1390+
* The component content is implicitly passed as a `children` snippet which conflicts with the `children` prop set as an attribute.
1391+
* @param {null | number | NodeLike} node
1392+
* @returns {never}
1393+
*/
1394+
export function snippet_shadowing_children_prop(node) {
1395+
e(node, "snippet_shadowing_children_prop", "The component content is implicitly passed as a `children` snippet which conflicts with the `children` prop set as an attribute.");
13871396
}

packages/svelte/src/compiler/phases/2-analyze/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function validate_component(node, context) {
4848
attribute.name === 'children'
4949
)
5050
) {
51-
e.snippet_shadowing_prop(node, 'children');
51+
e.snippet_shadowing_children_prop(node);
5252
}
5353
for (const attribute of node.attributes) {
5454
if (

packages/svelte/tests/validator/samples/snippet-shadowing-prop-implicit-children/errors.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
3-
"code": "snippet_shadowing_prop",
4-
"message": "This snippet is shadowing the prop `children` with the same name",
3+
"code": "snippet_shadowing_children_prop",
4+
"message": "The component content is implicitly passed as a `children` snippet which conflicts with the `children` prop set as an attribute.",
55
"start": {
66
"column": 0,
77
"line": 5

packages/svelte/tests/validator/samples/snippet-shadowing-prop/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "snippet_shadowing_prop",
4-
"message": "This snippet is shadowing the prop `title` with the same name",
4+
"message": "This snippet is conflicting with the prop `title` with the same name",
55
"start": {
66
"column": 1,
77
"line": 6

0 commit comments

Comments
 (0)