Skip to content

lodash-template/no-irregular-whitespace

disallow irregular whitespace outside the template tags.

  • ⚙️ This rule is included in all of "plugin:lodash-template/recommended", "plugin:lodash-template/recommended-with-html", "plugin:lodash-template/recommended-with-script" and "plugin:lodash-template/all".
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule Details

This rule disallows the irregular whitespaces.

html
<% /* eslint "lodash-template/no-irregular-whitespace": "error" */ %>
<!-- ✓ GOOD -->
<div id="item-id" class="item-content">
</div >

<!-- ✗ BAD -->
<div
 
id="item-id"
 
class="item-content">
</div
 
>

Options

json
{
  "lodash-template/no-irregular-whitespace": ["error", {
    "skipComments": false,
    "skipAttrValues": false,
    "skipText": false
  }]
}

This rule has an object option for exceptions:

  • "skipComments": true allows any whitespace characters in HTML comments
  • "skipAttrValues": true allows any whitespace characters in HTML attribute values
  • "skipText": true allows any whitespace characters in HTML texts

Further Reading

Implementation