Pattern: Trailing whitespace at the end of line
Issue: -
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>
{
"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.
This rule was introduced in eslint-plugin-svelte v2.7.0
Taken with ❤️ from ESLint core