From 4157db94c439148109c8bc407365371f7babae7e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 30 Oct 2024 12:50:33 -0400 Subject: [PATCH] fix: correct typo in compiler error messages (#14044) --- .changeset/beige-stingrays-sip.md | 5 +++++ .../docs/98-reference/.generated/compile-errors.md | 2 +- packages/svelte/messages/compile-errors/template.md | 2 +- packages/svelte/src/compiler/errors.js | 4 ++-- .../src/compiler/phases/3-transform/css/index.js | 10 +++++----- .../samples/catch-without-await/_config.js | 2 +- .../samples/else-before-closing-3/_config.js | 2 +- .../samples/else-before-closing/_config.js | 2 +- .../samples/else-if-before-closing-2/_config.js | 2 +- .../samples/then-before-closing/_config.js | 2 +- .../samples/then-without-await/_config.js | 2 +- .../tests/migrate/samples/derivations/input.svelte | 2 +- .../tests/migrate/samples/derivations/output.svelte | 4 ++-- 13 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 .changeset/beige-stingrays-sip.md diff --git a/.changeset/beige-stingrays-sip.md b/.changeset/beige-stingrays-sip.md new file mode 100644 index 0000000000..408d91d403 --- /dev/null +++ b/.changeset/beige-stingrays-sip.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: replace typo in compiler error messages diff --git a/documentation/docs/98-reference/.generated/compile-errors.md b/documentation/docs/98-reference/.generated/compile-errors.md index 1b8511a6f6..3981822d84 100644 --- a/documentation/docs/98-reference/.generated/compile-errors.md +++ b/documentation/docs/98-reference/.generated/compile-errors.md @@ -119,7 +119,7 @@ Can only bind to state or props ### block_invalid_continuation_placement ``` -{:...} block is invalid at this position (did you forget to close the preceeding element or block?) +{:...} block is invalid at this position (did you forget to close the preceding element or block?) ``` ### block_invalid_elseif diff --git a/packages/svelte/messages/compile-errors/template.md b/packages/svelte/messages/compile-errors/template.md index d606e4fd84..cddca87d9c 100644 --- a/packages/svelte/messages/compile-errors/template.md +++ b/packages/svelte/messages/compile-errors/template.md @@ -74,7 +74,7 @@ ## block_invalid_continuation_placement -> {:...} block is invalid at this position (did you forget to close the preceeding element or block?) +> {:...} block is invalid at this position (did you forget to close the preceding element or block?) ## block_invalid_elseif diff --git a/packages/svelte/src/compiler/errors.js b/packages/svelte/src/compiler/errors.js index 8f1dae98b1..00e2246ccf 100644 --- a/packages/svelte/src/compiler/errors.js +++ b/packages/svelte/src/compiler/errors.js @@ -747,12 +747,12 @@ export function block_duplicate_clause(node, name) { } /** - * {:...} block is invalid at this position (did you forget to close the preceeding element or block?) + * {:...} block is invalid at this position (did you forget to close the preceding element or block?) * @param {null | number | NodeLike} node * @returns {never} */ export function block_invalid_continuation_placement(node) { - e(node, "block_invalid_continuation_placement", "{:...} block is invalid at this position (did you forget to close the preceeding element or block?)"); + e(node, "block_invalid_continuation_placement", "{:...} block is invalid at this position (did you forget to close the preceding element or block?)"); } /** diff --git a/packages/svelte/src/compiler/phases/3-transform/css/index.js b/packages/svelte/src/compiler/phases/3-transform/css/index.js index ce682edd52..62c520e994 100644 --- a/packages/svelte/src/compiler/phases/3-transform/css/index.js +++ b/packages/svelte/src/compiler/phases/3-transform/css/index.js @@ -48,7 +48,7 @@ export function render_stylesheet(source, analysis, options) { code.remove(0, ast.content.start); code.remove(/** @type {number} */ (ast.content.end), source.length); if (state.minify) { - remove_preceeding_whitespace(ast.content.end, state); + remove_preceding_whitespace(ast.content.end, state); } const css = { @@ -122,7 +122,7 @@ const visitors = { index++; } } else if (state.minify) { - remove_preceeding_whitespace(node.start, state); + remove_preceding_whitespace(node.start, state); // Don't minify whitespace in custom properties, since some browsers (Chromium < 99) // treat --foo: ; and --foo:; differently @@ -136,8 +136,8 @@ const visitors = { }, Rule(node, { state, next, visit }) { if (state.minify) { - remove_preceeding_whitespace(node.start, state); - remove_preceeding_whitespace(node.block.end - 1, state); + remove_preceding_whitespace(node.start, state); + remove_preceding_whitespace(node.block.end - 1, state); } // keep empty rules in dev, because it's convenient to @@ -385,7 +385,7 @@ const visitors = { * @param {number} end * @param {State} state */ -function remove_preceeding_whitespace(end, state) { +function remove_preceding_whitespace(end, state) { let start = end; while (/\s/.test(state.code.original[start - 1])) start--; if (start < end) state.code.remove(start, end); diff --git a/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js b/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js index eaca30bd34..b8fca63f8c 100644 --- a/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/catch-without-await/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [1, 1] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/else-before-closing-3/_config.js b/packages/svelte/tests/compiler-errors/samples/else-before-closing-3/_config.js index daf005c900..050f58aa96 100644 --- a/packages/svelte/tests/compiler-errors/samples/else-before-closing-3/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/else-before-closing-3/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [6, 6] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/else-before-closing/_config.js b/packages/svelte/tests/compiler-errors/samples/else-before-closing/_config.js index 5053be23bd..4e66c92c65 100644 --- a/packages/svelte/tests/compiler-errors/samples/else-before-closing/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/else-before-closing/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [18, 18] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/else-if-before-closing-2/_config.js b/packages/svelte/tests/compiler-errors/samples/else-if-before-closing-2/_config.js index 43839b6723..4a440af93e 100644 --- a/packages/svelte/tests/compiler-errors/samples/else-if-before-closing-2/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/else-if-before-closing-2/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [17, 17] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/then-before-closing/_config.js b/packages/svelte/tests/compiler-errors/samples/then-before-closing/_config.js index 23c71262d2..03a5996737 100644 --- a/packages/svelte/tests/compiler-errors/samples/then-before-closing/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/then-before-closing/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [21, 21] } }); diff --git a/packages/svelte/tests/compiler-errors/samples/then-without-await/_config.js b/packages/svelte/tests/compiler-errors/samples/then-without-await/_config.js index eaca30bd34..b8fca63f8c 100644 --- a/packages/svelte/tests/compiler-errors/samples/then-without-await/_config.js +++ b/packages/svelte/tests/compiler-errors/samples/then-without-await/_config.js @@ -4,7 +4,7 @@ export default test({ error: { code: 'block_invalid_continuation_placement', message: - '{:...} block is invalid at this position (did you forget to close the preceeding element or block?)', + '{:...} block is invalid at this position (did you forget to close the preceding element or block?)', position: [1, 1] } }); diff --git a/packages/svelte/tests/migrate/samples/derivations/input.svelte b/packages/svelte/tests/migrate/samples/derivations/input.svelte index 8f89a59385..a120bbe7ee 100644 --- a/packages/svelte/tests/migrate/samples/derivations/input.svelte +++ b/packages/svelte/tests/migrate/samples/derivations/input.svelte @@ -6,7 +6,7 @@ // no semicolon at the end $: time_8 = count * 8 $: ({ time_16 } = { time_16: count * 16 }) - // preceeding let that doesn't do anything + // preceding let that doesn't do anything let time_32; $: time_32 = count * doubled; let very_high; diff --git a/packages/svelte/tests/migrate/samples/derivations/output.svelte b/packages/svelte/tests/migrate/samples/derivations/output.svelte index 23bac4ccaf..79ff089018 100644 --- a/packages/svelte/tests/migrate/samples/derivations/output.svelte +++ b/packages/svelte/tests/migrate/samples/derivations/output.svelte @@ -6,11 +6,11 @@ // no semicolon at the end let time_8 = $derived(count * 8) let { time_16 } = $derived({ time_16: count * 16 }) - // preceeding let that doesn't do anything + // preceding let that doesn't do anything let time_32 = $derived(count * doubled); let very_high = $derived(time_32 * count); -{count} / {doubled} / {quadrupled} / {time_8} / {time_16} \ No newline at end of file +{count} / {doubled} / {quadrupled} / {time_8} / {time_16}