Skip to content

Files

Latest commit

 

History

History
66 lines (47 loc) · 1.63 KB

no-trailing-spaces.md

File metadata and controls

66 lines (47 loc) · 1.63 KB

Pattern: Trailing whitespace at the end of line

Issue: -

Description

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.

👫 Related rules

🚀 Version

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

🔍 Implementation

Taken with ❤️ from ESLint core