Skip to content

Commit 79063bd

Browse files
Conduitrytanhauhau
authored andcommitted
update some compiler error messages
1 parent eab815d commit 79063bd

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/compiler/compile/compiler_errors.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export default {
212212
},
213213
invalid_attribute_value: (name: string) => ({
214214
code: `invalid-${name}-value`,
215-
message: `${name} attribute must be true or false`
215+
message: `${name} attribute must be true or false`
216216
}),
217217
invalid_options_attribute_unknown: {
218218
code: 'invalid-options-attribute',
@@ -248,18 +248,18 @@ export default {
248248
},
249249
invalid_const_placement: {
250250
code: 'invalid-const-placement',
251-
message: '{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> and <Component>'
251+
message: '{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>'
252252
},
253253
invalid_const_declaration: (name: string) => ({
254254
code: 'invalid-const-declaration',
255255
message: `'${name}' has already been declared`
256256
}),
257257
invalid_const_update: (name: string) => ({
258258
code: 'invalid-const-update',
259-
message: `'${name}' is declared using {@const ...} and it is read-only`
259+
message: `'${name}' is declared using {@const ...} and is read-only`
260260
}),
261-
cyclical_constant_tags: (cycle: string[]) => ({
262-
code: 'cyclical-constant-tags',
261+
cyclical_const_tags: (cycle: string[]) => ({
262+
code: 'cyclical-const-tags',
263263
message: `Cyclical dependency detected: ${cycle.join(' → ')}`
264264
})
265265
};

src/compiler/compile/nodes/shared/get_const_tags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function sort_consts_nodes(consts_nodes: ConstTag[], component: Component) {
6868
if (cycle && cycle.length) {
6969
const nodeList = lookup.get(cycle[0]);
7070
const node = nodeList[0];
71-
component.error(node.node, compiler_errors.cyclical_constant_tags(cycle));
71+
component.error(node.node, compiler_errors.cyclical_const_tags(cycle));
7272
}
7373

7474
const add_node = (node: ConstNode) => {

test/validator/samples/const-tag-cyclical/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"code": "cyclical-constant-tags",
3+
"code": "cyclical-const-tags",
44
"message": "Cyclical dependency detected: b → c → b",
55
"start": { "line": 6, "column": 2, "character": 61 },
66
"end": { "line": 6, "column": 20, "character": 79 },

test/validator/samples/const-tag-placement-1/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "invalid-const-placement",
4-
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> and <Component>",
4+
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>",
55
"start": { "line": 5, "column": 0, "character": 36 },
66
"end": { "line": 5, "column": 18, "character": 54 },
77
"pos": 36

test/validator/samples/const-tag-placement-2/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "invalid-const-placement",
4-
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> and <Component>",
4+
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>",
55
"start": { "line": 6, "column": 2, "character": 46 },
66
"end": { "line": 6, "column": 20, "character": 64 },
77
"pos": 46

test/validator/samples/const-tag-placement-3/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "invalid-const-placement",
4-
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> and <Component>",
4+
"message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, <svelte:fragment> or <Component>",
55
"start": { "line": 7, "column": 4, "character": 63 },
66
"end": { "line": 7, "column": 18, "character": 77 },
77
"pos": 63

test/validator/samples/const-tag-readonly-1/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"code": "invalid-const-update",
4-
"message": "'b' is declared using {@const ...} and it is read-only",
4+
"message": "'b' is declared using {@const ...} and is read-only",
55
"start": { "line": 7, "column": 26, "character": 106 },
66
"end": { "line": 7, "column": 30, "character": 110 },
77
"pos": 106

0 commit comments

Comments
 (0)