From 7756f4b9b2868ac0a0459d5ebd2822019e958fd6 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Tue, 3 Aug 2021 15:05:43 +0800 Subject: [PATCH] throw error for missing attribute value --- src/compiler/parse/errors.ts | 4 + src/compiler/parse/state/tag.ts | 4 + .../samples/attribute-empty-error/error.json | 10 ++ .../attribute-empty-error/input.svelte | 1 + .../samples/attribute-empty/input.svelte | 1 + .../samples/attribute-empty/output.json | 108 ++++++++++++++++++ 6 files changed, 128 insertions(+) create mode 100644 test/parser/samples/attribute-empty-error/error.json create mode 100644 test/parser/samples/attribute-empty-error/input.svelte create mode 100644 test/parser/samples/attribute-empty/input.svelte create mode 100644 test/parser/samples/attribute-empty/output.json diff --git a/src/compiler/parse/errors.ts b/src/compiler/parse/errors.ts index b2fc5b72a4..ef1f72a8be 100644 --- a/src/compiler/parse/errors.ts +++ b/src/compiler/parse/errors.ts @@ -157,6 +157,10 @@ export default { code: 'missing-component-definition', message: ' must have a \'this\' attribute' }, + missing_attribute_value: { + code: 'missing-attribute-value', + message: 'Expected value for the attribute' + }, unclosed_script: { code: 'unclosed-script', message: '