lodash-template/template-tag-spacing
enforce unified spacing in micro-template tag. (ex. 🆗
<%= prop %>, 🆖<%=prop%>)
- ⚙️ 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
--fixoption on the command line can automatically fix some of the problems reported by this rule.
Rule Details
This rule aims to enforce unified spacing in micro-template interpolate/evaluate.
html
<% /* eslint "lodash-template/template-tag-spacing": "error" */ %>
<!-- ✓ GOOD -->
<div><%= text %></div>
<!-- ✗ BAD -->
<div><%= text %></div>
<div><%=text%></div>Options
Default spacing is set to always
json
{
"lodash-template/micro-template-interpolation-spacing": ["error", "always" | "never"]
}"always" - Expect one space between expression and curly brackets.
html
<% /* eslint "lodash-template/template-tag-spacing": ["error", "always"] */ %>
<!-- ✓ GOOD -->
<div><%= text %></div>
<!-- ✗ BAD -->
<div><%= text %></div>
<div><%=text%></div>"never" - Expect no spaces between expression and curly brackets.
html
<%/* eslint "lodash-template/template-tag-spacing": ["error", "never"] */%>
<!-- ✓ GOOD -->
<div><%=text%></div>
<!-- ✗ BAD -->
<div><%= text %></div>
<div><%= text %></div>