lodash-template/no-template-tag-in-start-tag
disallow template tag in start tag outside attribute values. (ex. 🆖
<input <%= 'disabled' %> >
)
- ⚙️ This rule is included in
"plugin:lodash-template/all"
.
Rule Details
This rule reports the template tag that is in the start tag, outside attribute values.
html
<% /* eslint "lodash-template/no-template-tag-in-start-tag": "error" */ %>
<!-- ✓ GOOD -->
<input disabled >
<input class="<%= hidden ? 'hidden' : '' %>" >
<!-- ✗ BAD -->
<input <%= 'disabled' %> >
<input <%= disabled ? 'disabled' : '' %> >
<input
<% if (disabled) { %>
disabled
<% } %>
>
Options
json
{
"lodash-template/no-template-tag-in-start-tag": ["error", {
"arrowEvaluateTag": false,
}]
}
Examples for this rule with {arrowEvaluateTag: true}
option:
html
<% /* eslint "lodash-template/no-template-tag-in-start-tag": ["error", {"arrowEvaluateTag": true}] */ %>
<!-- ✓ GOOD -->
<input disabled >
<input
<% if (disabled) { %>
disabled
<% } %>
>