Skip to content

Svelte: HTML comment inside a tag is accepted, but the file cannot compile #11542

Description

@ToP29

Environment information

Biome 2.5.10
Windows 11, Node 22.14.0
Svelte 5.57.0

Description

Biome accepts an HTML comment placed inside a Svelte tag, between attributes. Svelte rejects that markup outright, so biome check reports a clean file that cannot compile.

Since Svelte 5.53 a comment between attributes is valid — but only as a JS-style comment (// or /* */), which Biome already parses. The HTML form is not valid in any Svelte version.

This matters for suppression comments in particular. When a lint diagnostic points at an attribute inside a multi-line tag, <!-- biome-ignore ... --> looks like the natural place to put it, Biome silently accepts it, and the file only breaks later at build time.

Steps to reproduce

B.svelte:

<input
	type="text"
	<!-- a comment -->
	disabled
>

Run biome check B.svelte.

Expected result

A parse error, the same way the Svelte compiler reports one:

expected_token — Expected token >

Actual result

Checked 1 file in 1988µs. No fixes applied.

No diagnostic at all. biome format also reports nothing.

For comparison, svelte.compile() on the same source throws expected_token. The JS-style form in the same position compiles fine and Biome honours it as a suppression:

<input
	type="text"
	// biome-ignore lint/a11y/noAutofocus: reason
	{autofocus}
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-ParserArea: parserL-HTMLLanguage: HTML and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions