Skip to content

Commit

Permalink
fix: correct typo in compiler error messages (#14044)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Oct 30, 2024
1 parent 224fcde commit 4157db9
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-stingrays-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: replace typo in compiler error messages
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/messages/compile-errors/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/src/compiler/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?)");
}

/**
Expand Down
10 changes: 5 additions & 5 deletions packages/svelte/src/compiler/phases/3-transform/css/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
</script>

{count} / {doubled} / {quadrupled} / {time_8} / {time_16}
{count} / {doubled} / {quadrupled} / {time_8} / {time_16}

0 comments on commit 4157db9

Please sign in to comment.