# 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 … If true, allows trailing whitespace on empty lines.
  • ignoreComments … If true, allows trailing whitespace in comments.

Same as no-trailing-spaces rule option. See here for details.

# πŸš€ Version

This rule was introduced in eslint-plugin-svelte v2.7.0

# πŸ” Implementation

Taken with ❀️ from ESLint core