Skip to content

spaced-html-comment

Reports an HTML comment with no space after <!-- or before --> (<!--text-->).

A space keeps the text apart from the marker and reads as text, not as commented-out code.

To fix, write <!-- text -->.

Reported
...
<!--bad--> <!-- ok --> <!---->
...
<a href="https://x.org" target="_blank" rel="noopener noreferrer">x</a>
...
After the fix
...
<!--bad--> <!-- ok --> <!---->
...
<a href="https://x.org" target="_blank" rel="noopener noreferrer">x</a>
...
angular:
lint:
rules:
spaced-html-comment: warn # off (default), warn, error
html:
lint:
rules:
spaced-html-comment: warn # off (default), warn, error
svelte:
lint:
rules:
spaced-html-comment: warn # off (default), warn, error
vue:
lint:
rules:
spaced-html-comment: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line spaced-html-comment in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-svelte spaced-html-comment full