ember-template-lint
Advanced tools
Changelog
v0.6.3
Add support for Handlebars comments.
A few new types of control statements are now available:
{{! template-lint-enable some-rule-name }}
- This will enable the rule some-rule-name
with the default configuration (from .template-lintrc.js
) or true
(if not present in the config file). This can be ran for multiple rules at once (i.e. {{! template-lint-enable bare-strings some-other-thing }}
).{{! template-lint-disable some-rule-name }}
- This will disable the rule some-rule-name
. Multiple rules can be provided at once (i.e. {{! template-lint-disable bare-strings some-other-thing }}
).{{! template-lint-configure some-rule-name { "whitelist": ["some", "valid", "json"] } }}
- This configures the rule some-rule-name
with the JSON.parse()
'ed result of the second argument. The configure instruction only applies toa single rule at a time.These configuration instructions do not modify the rule for the rest of the template, but instead only modify it within whatever DOM scope the comment instruction appears.
An instruction will apply to all later siblings and their descendants:
{{! disable for <p> and <span> and their contents, but not for <div> or <hr> }}
<div>
<hr>
{{! template-lint-disable }}
<p>
<span>Hello!</span>
</p>
</div>
An in-element instruction will apply to only that element:
{{! enable for <p>, but not for <div>, <hr> or <span> }}
<div>
<hr>
<p {{! template-lint-enable }}>
<span>Hello!</span>
</p>
</div>
An in-element instruction with the -tree suffix will apply to that element and all its descendants:
{{! configure for <p>, <span> and their contents, but not for <div> or <hr> }}
<div>
<hr>
<p {{! template-lint-configure-tree block-indentation "tab" }}>
<span>Hello!</span>
</p>
</div>
Deprecate using HTML comments for enabling/disabling rules. Support for HTML comments will be removed in v0.7.0.
Changelog
v0.6.2
ignore
to allowed configuration values. ignore
is an array of moduleId's that are to be completely ignored. This is similar (but different) from pending
.unused-block-params
rule. The following example would fail this rule (since it has an unused block param index
):{{#each foo as |bar index|}}
{{bar}}
{{/each}}
img-alt-attributes
rule to allow <img alt>
and <img alt="">
.invalid-interactive
rule to allow <form {{action 'foo' on="submit"}}>
.Changelog
v0.6.1
deprecated-inline-view-helper
(throwing error when parsing mustache statements).Changelog
v0.6.0
invalid-interactive
to recommended rules.img-alt-attributes
to recommended rules.style-concatenation
to recommended rules.deprecated-inline-view-helper
to recommended rules.link-rel-noopener
to recommended rules.Changelog
v0.5.18
deprecated-inline-view-helper
rule. Usage of {{view
/ {{#view
helper and {{view.path.here}}
were deprecated in Ember 1.13, and subsequently removed in Ember 2.0.
This rule flags these usages.Changelog
v0.5.17
invalid-interactive
rule not honoring the documented additonalInteractiveTags
option.Changelog
v0.5.16
link-rel-noopener
rule when using properly with a listing (i.e. rel="noopener noreferrer"
).inline-link-to
rule to prevent usage of inline {{link-to
.style-concatenation
rule. This prevents the usage of <div style="{{make-background url}}">
(quoted value with any dynamic segments) but allows
<div style={{make-background url}}>
.Changelog
v0.5.15
<iframe>
to be detected as {{#if
.link-rel-noopener
rule. This rule requires that any <a target="_blank">
have a rel="noopener"
. This prevents the newly opened window from having access
to the opener (and helps prevent a number of phishing attacks).Changelog
v0.5.14
invalid-indentation
rule to allow scenarios where the opening and closing elements can have no space between. For example:<textarea
class="form-control"
id="job-instructions"
rows="3"
placeholder="Do it well"
value={{job.instructions}}
oninput={{action 'updateInstructions' value='target.value'}}></textarea>
If the above </textarea>
had been after a newline and indented properly, the default contents of the textarea would then include that whitespace. The rule now enforces
that there be no child elements within a given block.
dialog
and alertdialog
).