diff --git a/.changeset/sharp-guests-sniff.md b/.changeset/sharp-guests-sniff.md new file mode 100644 index 00000000..1ae5f1aa --- /dev/null +++ b/.changeset/sharp-guests-sniff.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +fix: prevent errors when ``} diff --git a/tests/fixtures/parser/ast/at-html01-output.json b/tests/fixtures/parser/ast/at-html01-output.json new file mode 100644 index 00000000..dd9485df --- /dev/null +++ b/tests/fixtures/parser/ast/at-html01-output.json @@ -0,0 +1,233 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteMustacheTag", + "kind": "raw", + "expression": { + "type": "TemplateLiteral", + "expressions": [ + { + "type": "Literal", + "raw": "50", + "value": 50, + "range": [ + 26, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "quasis": [ + { + "type": "TemplateElement", + "tail": false, + "value": { + "cooked": "", + "raw": "" + }, + "range": [ + 28, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 7, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "@html", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Template", + "value": "``", + "range": [ + 28, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/at-html01-scope-output.json b/tests/fixtures/parser/ast/at-html01-scope-output.json new file mode 100644 index 00000000..d392ca4b --- /dev/null +++ b/tests/fixtures/parser/ast/at-html01-scope-output.json @@ -0,0 +1,34 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] +} \ No newline at end of file