Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 1.51 KB

no-template-tag-in-start-tag.md

File metadata and controls

61 lines (47 loc) · 1.51 KB
pageClass sidebarDepth title description
rule-details
0
lodash-template/no-template-tag-in-start-tag
disallow template tag in start tag outside attribute values. (ex. 🆖 `<input <%= 'disabled' %> >`)

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.

<% /* 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

{
  "lodash-template/no-template-tag-in-start-tag": ["error", {
    "arrowEvaluateTag": false,
  }]
}

Examples for this rule with {arrowEvaluateTag: true} option:

<% /* eslint "lodash-template/no-template-tag-in-start-tag": ["error", {"arrowEvaluateTag": true}] */ %>
<!-- ✓ GOOD -->
<input disabled >
<input
  <% if (disabled) { %>
  disabled
  <% } %>
>

Implementation