pageClass | sidebarDepth | title | description |
---|---|---|---|
rule-details |
0 |
svelte/html-self-closing |
enforce self-closing style |
enforce self-closing style
- ❗ This rule has not been released yet.
- 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
You can choose either two styles for elements without content
- always:
<div />
- never:
<div></div>
<script>
/* eslint svelte/html-self-closing: "error" */
</script>
<!-- ✓ GOOD -->
<div />
<p>Hello</p>
<div><div /></div>
<img />
<svelte:head />
<!-- ✗ BAD -->
<div></div>
<p> </p>
<div><div></div></div>
<img>
<svelte:head></svelte:head>
void
("always"
by default)... Style of HTML void elementscomponent
("always"
by default)... Style of svelte componentssvelte
("always"
by default)... Style of svelte special elements (<svelte:head>
,<svelte:self>
)normal
("always"
by default)... Style of other elements
Every option can be set to
- "always" (
<div />
) - "never" (
<div></div>
) - "ignore" (either
<div />
or<div></div>
)