Skip to content

lodash-template/no-invalid-template-interpolation

disallow other than expression in micro-template interpolation. (ex. 🆖 <%= if (test) { %>)

  • ⚙️ This rule is included in all of "plugin:lodash-template/best-practices", "plugin:lodash-template/recommended", "plugin:lodash-template/recommended-with-html", "plugin:lodash-template/recommended-with-script" and "plugin:lodash-template/all".

Rule Details

This rule disallow other than expression in micro-template interpolation.

html
<% /* eslint "lodash-template/no-invalid-template-interpolation": "error" */ %>
<!-- ✓ GOOD -->
<% if (a) { %>
  <div></div>
<% } %>

<div><%= text %></div>

<!-- ✗ BAD -->
<%= if (a) { %>
<div></div> <% } %> <div>
<%= /**/ %>
</div>

Implementation