# svelte/no-trailing-spaces
disallow trailing whitespace at the end of lines
- π§ The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
# π Rule Details
This rule extends the base ESLintβs no-trailing-spaces rule. The no-trailing-spaces rule does not understand HTML comments and will report trailing whitespace in HTML comments when using ignoreComments
option.
This rule supports HTML comments generated by svelte-eslint-parser.
<script>
/* eslint svelte/no-trailing-spaces: "error" */
/* β GOOD */
var foo = 0;
/* β BAD */
var foo = 0;
</script>
<!-- β GOOD -->
<div>
Text
</div>
<!-- β BAD -->
<div>
Text
</div>
# π§ Options
{
"no-trailing-spaces": "off", // Don't need ESLint's no-trailing-spaces rule, so turn it off.
"svelte/no-trailing-spaces": [
"error",
{
"skipBlankLines": false,
"ignoreComments": false
}
]
}
skipBlankLines
β¦ Iftrue
, allows trailing whitespace on empty lines.ignoreComments
β¦ Iftrue
, allows trailing whitespace in comments.
Same as no-trailing-spaces rule option. See here for details.
# π« Related rules
# π Version
This rule was introduced in eslint-plugin-svelte v2.7.0
# π Implementation
Taken with β€οΈ from ESLint core