From 72a548950c3355f242dae3627645febce1275be7 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 27 Sep 2021 10:02:18 -0400 Subject: [PATCH] update some compiler error messages --- src/compiler/compile/compiler_errors.ts | 10 +++++----- src/compiler/compile/nodes/shared/get_const_tags.ts | 2 +- test/validator/samples/const-tag-cyclical/errors.json | 2 +- .../samples/const-tag-placement-1/errors.json | 2 +- .../samples/const-tag-placement-2/errors.json | 2 +- .../samples/const-tag-placement-3/errors.json | 2 +- .../validator/samples/const-tag-readonly-1/errors.json | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compiler/compile/compiler_errors.ts b/src/compiler/compile/compiler_errors.ts index 4ae66602d1..f6e9d17ea3 100644 --- a/src/compiler/compile/compiler_errors.ts +++ b/src/compiler/compile/compiler_errors.ts @@ -212,7 +212,7 @@ export default { }, invalid_attribute_value: (name: string) => ({ code: `invalid-${name}-value`, - message: `${name} attribute must be true or false` + message: `${name} attribute must be true or false` }), invalid_options_attribute_unknown: { code: 'invalid-options-attribute', @@ -248,7 +248,7 @@ export default { }, invalid_const_placement: { code: 'invalid-const-placement', - message: '{@const} must be the immediate child of {#each}, {:then}, {:catch}, and ' + message: '{@const} must be the immediate child of {#each}, {:then}, {:catch}, or ' }, invalid_const_declaration: (name: string) => ({ code: 'invalid-const-declaration', @@ -256,10 +256,10 @@ export default { }), invalid_const_update: (name: string) => ({ code: 'invalid-const-update', - message: `'${name}' is declared using {@const ...} and it is read-only` + message: `'${name}' is declared using {@const ...} and is read-only` }), - cyclical_constant_tags: (cycle: string[]) => ({ - code: 'cyclical-constant-tags', + cyclical_const_tags: (cycle: string[]) => ({ + code: 'cyclical-const-tags', message: `Cyclical dependency detected: ${cycle.join(' → ')}` }) }; diff --git a/src/compiler/compile/nodes/shared/get_const_tags.ts b/src/compiler/compile/nodes/shared/get_const_tags.ts index 0bdf6e2a70..77bc26fe9c 100644 --- a/src/compiler/compile/nodes/shared/get_const_tags.ts +++ b/src/compiler/compile/nodes/shared/get_const_tags.ts @@ -68,7 +68,7 @@ function sort_consts_nodes(consts_nodes: ConstTag[], component: Component) { if (cycle && cycle.length) { const nodeList = lookup.get(cycle[0]); const node = nodeList[0]; - component.error(node.node, compiler_errors.cyclical_constant_tags(cycle)); + component.error(node.node, compiler_errors.cyclical_const_tags(cycle)); } const add_node = (node: ConstNode) => { diff --git a/test/validator/samples/const-tag-cyclical/errors.json b/test/validator/samples/const-tag-cyclical/errors.json index ed15a7f95a..1436747798 100644 --- a/test/validator/samples/const-tag-cyclical/errors.json +++ b/test/validator/samples/const-tag-cyclical/errors.json @@ -1,6 +1,6 @@ [ { - "code": "cyclical-constant-tags", + "code": "cyclical-const-tags", "message": "Cyclical dependency detected: b → c → b", "start": { "line": 6, "column": 2, "character": 61 }, "end": { "line": 6, "column": 20, "character": 79 }, diff --git a/test/validator/samples/const-tag-placement-1/errors.json b/test/validator/samples/const-tag-placement-1/errors.json index 96c661cae3..52de84e2be 100644 --- a/test/validator/samples/const-tag-placement-1/errors.json +++ b/test/validator/samples/const-tag-placement-1/errors.json @@ -1,7 +1,7 @@ [ { "code": "invalid-const-placement", - "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, and ", + "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, or ", "start": { "line": 5, "column": 0, "character": 36 }, "end": { "line": 5, "column": 18, "character": 54 }, "pos": 36 diff --git a/test/validator/samples/const-tag-placement-2/errors.json b/test/validator/samples/const-tag-placement-2/errors.json index 89d3cce341..005b3ff8b7 100644 --- a/test/validator/samples/const-tag-placement-2/errors.json +++ b/test/validator/samples/const-tag-placement-2/errors.json @@ -1,7 +1,7 @@ [ { "code": "invalid-const-placement", - "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, and ", + "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, or ", "start": { "line": 6, "column": 2, "character": 46 }, "end": { "line": 6, "column": 20, "character": 64 }, "pos": 46 diff --git a/test/validator/samples/const-tag-placement-3/errors.json b/test/validator/samples/const-tag-placement-3/errors.json index 332d21c131..cc0ba4d74d 100644 --- a/test/validator/samples/const-tag-placement-3/errors.json +++ b/test/validator/samples/const-tag-placement-3/errors.json @@ -1,7 +1,7 @@ [ { "code": "invalid-const-placement", - "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, and ", + "message": "{@const} must be the immediate child of {#each}, {:then}, {:catch}, or ", "start": { "line": 7, "column": 4, "character": 63 }, "end": { "line": 7, "column": 18, "character": 77 }, "pos": 63 diff --git a/test/validator/samples/const-tag-readonly-1/errors.json b/test/validator/samples/const-tag-readonly-1/errors.json index 8a9e125206..ed60c529fd 100644 --- a/test/validator/samples/const-tag-readonly-1/errors.json +++ b/test/validator/samples/const-tag-readonly-1/errors.json @@ -1,7 +1,7 @@ [ { "code": "invalid-const-update", - "message": "'b' is declared using {@const ...} and it is read-only", + "message": "'b' is declared using {@const ...} and is read-only", "start": { "line": 7, "column": 26, "character": 106 }, "end": { "line": 7, "column": 30, "character": 110 }, "pos": 106