# svelte/html-closing-bracket-spacing
require or disallow a space before tag’s closing brackets
- 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
# 📖 Rule Details
You can choose either two styles for spacing before closing bracket
- always:
<div />
- never:
<div/>
<script>
/* eslint svelte/html-closing-bracket-spacing: "error" */
</script>
<!-- ✓ GOOD -->
<div />
<p>Hello</p>
<div
>
</div>
<!-- ✗ BAD -->
<divExpected space before '>', but not found. (svelte/html-closing-bracket-spacing)/>
<pExpected no space before '>', but found. (svelte/html-closing-bracket-spacing) >Expected no space before '>', but found. (svelte/html-closing-bracket-spacing)Hello</p >
<divExpected no space before '>', but found. (svelte/html-closing-bracket-spacing) >
</divExpected no space before '>', but found. (svelte/html-closing-bracket-spacing) >
# 🔧 Options
{
"svelte/html-closing-bracket-spacing": [
"error",
{
"startTag": "never", // or "always" or "ignore"
"endTag": "never", // or "always" or "ignore"
"selfClosingTag": "always" // or "never" or "ignore"
}
]
}
startTag
("never"
by default)… Spacing in start tagsendTag
("never"
by default)… Spacing in end tagsselfClosingTag
("always"
by default)… Spacing in self closing tags
Every option can be set to
- “always” (
<div />
) - “never” (
<div/>
) - “ignore” (either
<div />
or<div/>
)
# 🚀 Version
This rule was introduced in eslint-plugin-svelte v2.3.0