Skip to content

Commit

Permalink
fix: resolve formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
caiquetorres committed Dec 5, 2024
1 parent a8e585d commit 1123629
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
12 changes: 6 additions & 6 deletions documentation/docs/98-reference/.generated/compile-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,6 @@ Expected token %token%
Expected whitespace
```

### unterminated_string_constant

```
Unterminated string constant
```

### export_undefined

```
Expand Down Expand Up @@ -994,6 +988,12 @@ Unexpected end of input
'%word%' is a reserved word in JavaScript and cannot be used here
```

### unterminated_string_constant

```
Unterminated string constant
```

### void_element_invalid_content

```
Expand Down
8 changes: 4 additions & 4 deletions packages/svelte/messages/compile-errors/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@

> Expected whitespace
## unterminated_string_constant

> Unterminated string constant
## illegal_element_attribute

> `<%name%>` does not support non-event attributes or spread attributes
Expand Down Expand Up @@ -414,6 +410,10 @@ See https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-ele

> '%word%' is a reserved word in JavaScript and cannot be used here
## unterminated_string_constant

> Unterminated string constant
## void_element_invalid_content

> Void elements cannot have children or closing tags
20 changes: 10 additions & 10 deletions packages/svelte/src/compiler/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,15 +1003,6 @@ export function expected_whitespace(node) {
e(node, "expected_whitespace", "Expected whitespace");
}

/**
* Unterminated string constant
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function unterminated_string_constant(node) {
e(node, "unterminated_string_constant", "Unterminated string constant");
}

/**
* `<%name%>` does not support non-event attributes or spread attributes
* @param {null | number | NodeLike} node
Expand Down Expand Up @@ -1546,11 +1537,20 @@ export function unexpected_reserved_word(node, word) {
e(node, "unexpected_reserved_word", `'${word}' is a reserved word in JavaScript and cannot be used here`);
}

/**
* Unterminated string constant
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function unterminated_string_constant(node) {
e(node, "unterminated_string_constant", "Unterminated string constant");
}

/**
* Void elements cannot have children or closing tags
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function void_element_invalid_content(node) {
e(node, "void_element_invalid_content", "Void elements cannot have children or closing tags");
}
}
10 changes: 7 additions & 3 deletions packages/svelte/src/compiler/phases/1-parse/read/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ function read_expression_length(parser, start) {
} else if (is_bracket_close(code)) {
const popped = /** @type {number} */ (bracket_stack.pop());
if (!is_bracket_pair(popped, code)) {
e.expected_token(i, String.fromCharCode(/** @type {number} */(get_bracket_close(popped))));
e.expected_token(
i,
String.fromCharCode(/** @type {number} */ (get_bracket_close(popped)))
);
}
if (bracket_stack.length === 0) {
i += code <= 0xffff ? 1 : 2;
Expand Down Expand Up @@ -145,10 +148,11 @@ function read_string_length(parser, start, quote) {
if (
i < parser.template.length - 1 &&
is_back_quote(quote) &&
code === DOLAR && full_char_code_at(parser.template, i + 1) === LEFT_BRACKET
code === DOLAR &&
full_char_code_at(parser.template, i + 1) === LEFT_BRACKET
) {
i++;
i = read_expression_length(parser, i)
i = read_expression_length(parser, i);
} else {
i += code <= 0xffff ? 1 : 2;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/phases/1-parse/utils/quote.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SINGLE_QUOTE = '\''.charCodeAt(0);
const SINGLE_QUOTE = "'".charCodeAt(0);
const DOUBLE_QUOTE = '"'.charCodeAt(0);
const BACK_QUOTE = '`'.charCodeAt(0);

Expand Down

0 comments on commit 1123629

Please sign in to comment.