# svelte/no-trailing-spaces
disallow trailing whitespace at the end of lines
- 🔧 The
--fix
option on thecommand line can automatically fix some of the problems reported by this rule.
# 📖 Rule Details
This rule extends the base ESLint’sno-trailing-spaces rule. Theno-trailing-spaces rule does not understand HTML comments and will report trailing whitespace in HTML comments when usingignoreComments
option.This rule supports HTML comments generated bysvelte-eslint-parser.
<script> /* eslint svelte/no-trailing-spaces: "error" */ /* ✓ GOOD */ var foo =0; /* ✗ BAD */ var foo =0;Trailing spaces not allowed. (svelte/no-trailing-spaces)</script><!-- ✓ GOOD --><div> Text</div><!-- ✗ BAD --><div>Trailing spaces not allowed. (svelte/no-trailing-spaces) TextTrailing spaces not allowed. (svelte/no-trailing-spaces)</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 asno-trailing-spaces rule option. Seehere for details.
# 👫 Related rules
# 🚀 Version
This rule was introduced in eslint-plugin-svelte v2.7.0
# 🔍 Implementation
Taken with ❤️from ESLint core