Skip to content

Commit de6d0c6

Browse files
authored
Add a more descriptive message for the error generated by an empty shorthand attribute (#6217)
Added error message "empty-attribute-shorthand" for when the shorthand attribute is empty, giving a more explicit error for #6086
1 parent 17c5402 commit de6d0c6

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/compiler/parse/state/tag.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
330330
parser.allow_whitespace();
331331
parser.eat('}', true);
332332

333+
if (name === null) {
334+
parser.error({
335+
code: 'empty-attribute-shorthand',
336+
message: 'Attribute shorthand cannot be empty'
337+
}, start);
338+
}
339+
333340
check_unique(name);
334341

335342
return {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"code": "empty-attribute-shorthand",
3+
"message": "Attribute shorthand cannot be empty",
4+
"start": {
5+
"line": 1,
6+
"column": 6,
7+
"character": 6
8+
},
9+
"pos": 6
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span {}></span>

0 commit comments

Comments
 (0)