Skip to content

{} in an attribute list causes the compiler/linter to crash instead of producing a meaningful error #6086

@CherryDT

Description

@CherryDT

Describe the bug
{} in an attribute list causes the compiler/linter to crash instead of producing a meaningful error.

To Reproduce

<span {}></span>

https://svelte.dev/repl/e8b23903c76b4e9daf28185841799a87?version=3.35.0

The result is an exception TypeError: Cannot read property 'length' of null which doesn't really indicate what happened and where (in VSCode this shows at (1, 1)).

Expected behavior
A meaningful error like Variable name or spread operator expected.

Stacktraces

Stack trace

bundler.js:11 TypeError: Cannot read property 'length' of null
at read_attribute (compiler.js:16002)
at tag (compiler.js:15862)
at new Parser$1 (compiler.js:16787)
at parse$3 (compiler.js:16919)
at Object.compile (compiler.js:29918)
at Object.transform (bundler.js:11)
at bundler.js:11

  • Svelte version: 3.35.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions