Need help with ember-template-lint?
Click the β€œchat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

ember-template-lint
234 Stars 195 Forks MIT License 3.8K Commits 189 Opened issues

Description

Linter for Ember or Handlebars templates

Services available

!
?

Need anything else?

Contributors list

ember-template-lint

npm version Build Status

ember-template-lint
is a library that will lint your handlebars template and return error results.

For example, if the rule

no-bare-strings
is enabled, this template would be in violation:

{{! app/components/my-thing/template.hbs  }}
A bare string

When the

ember-template-lint
executable is run, we would have a single result indicating that the
no-bare-strings
rule found an error.

Requirements

  • Node.js
    >= 10.24 < 11 || 12.* || >= 14.*

Installation

npm install --save-dev ember-template-lint
yarn add --dev ember-template-lint

Note: this library is installed by default with new Ember apps.

Usage

While

ember-template-lint
does have a Node API, the main way to use it is through its executable, which is intended to be installed locally within a project.

Basic usage is as straightforward as

ember-template-lint .

Workflow Examples

See documentation on workflow examples.

See documentation on the todo functionality.

Configuration

Project Wide

You can turn on specific rules by toggling them in a

.template-lintrc.js
file at the base of your project, or at a custom relative path which may be identified using the CLI:
module.exports = {
  extends: 'recommended',

rules: { 'no-bare-strings': true, }, };

For more detailed information see configuration.

Presets

| | Name | Description | | :-- | :--------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | βœ… | recommended | Enables the recommended rules. | | πŸ’… | stylistic | Enables stylistic rules for those who aren't ready to adopt ember-template-lint-plugin-prettier (including stylistic rules that were previously in the

recommended
preset in ember-template-lint v1). | | ⌨️ | a11y | Enables A11Y rules. Its goal is to include all A11Y related rules, therefore it does not follow the same SemVer policy as the other presets. Please see versioning for more details. |

Rules

Each rule has emojis denoting:

  • what configuration it belongs to
  • πŸ”§ if some problems reported by the rule are automatically fixable by the
    --fix
    command line option

| Name | βœ… | πŸ’… | ⌨️ | πŸ”§ | | :-------------------------------------------------------------------------------------------------------- | :-- | :-- | :-- | --- | | attribute-indentation | | | | | | block-indentation | | πŸ’… | | | | builtin-component-arguments | βœ… | | | | | deprecated-each-syntax | | | | | | deprecated-inline-view-helper | βœ… | | | | | deprecated-render-helper | βœ… | | | | | eol-last | | πŸ’… | | πŸ”§ | | inline-link-to | | | | πŸ”§ | | linebreak-style | | πŸ’… | | | | link-href-attributes | βœ… | | ⌨️ | | | link-rel-noopener | βœ… | | | πŸ”§ | | modifier-name-case | | πŸ’… | | | | no-abstract-roles | βœ… | | ⌨️ | | | no-accesskey-attribute | βœ… | | ⌨️ | πŸ”§ | | no-action | βœ… | | | | | no-action-modifiers | | | | | | no-args-paths | βœ… | | | | | no-arguments-for-html-elements | βœ… | | | | | no-aria-hidden-body | βœ… | | ⌨️ | πŸ”§ | | no-attrs-in-components | βœ… | | | | | no-autofocus-attribute | | | ⌨️ | | | no-bare-strings | | | | | | no-block-params-for-html-elements | βœ… | | | | | no-capital-arguments | | | | | | no-class-bindings | | | | | | no-curly-component-invocation | βœ… | | | πŸ”§ | | no-debugger | βœ… | | | | | no-down-event-binding | βœ… | | ⌨️ | | | no-duplicate-attributes | βœ… | | ⌨️ | | | no-duplicate-id | βœ… | | ⌨️ | | | no-duplicate-landmark-elements | βœ… | | ⌨️ | | | no-dynamic-subexpression-invocations | | | | | | no-element-event-actions | | | | | | no-empty-headings | | | ⌨️ | | | no-extra-mut-helper-argument | βœ… | | | | | no-forbidden-elements | βœ… | | | | | no-heading-inside-button | βœ… | | ⌨️ | | | no-html-comments | βœ… | | | | | no-implicit-this | βœ… | | | | | no-index-component-invocation | βœ… | | | | | no-inline-styles | βœ… | | | | | no-input-block | βœ… | | | | | no-input-tagname | βœ… | | | | | no-invalid-block-param-definition | βœ… | | | | | no-invalid-interactive | βœ… | | ⌨️ | | | no-invalid-link-text | βœ… | | ⌨️ | | | no-invalid-link-title | βœ… | | ⌨️ | | | no-invalid-meta | βœ… | | ⌨️ | | | no-invalid-role | βœ… | | ⌨️ | | | no-link-to-positional-params | βœ… | | | | | no-link-to-tagname | | | | | | no-log | βœ… | | | | | no-model-argument-in-route-templates | | | | πŸ”§ | | no-multiple-empty-lines | | πŸ’… | | | | no-mut-helper | | | | | | no-negated-condition | βœ… | | | πŸ”§ | | no-nested-interactive | βœ… | | ⌨️ | | | no-nested-landmark | βœ… | | ⌨️ | | | no-nested-splattributes | βœ… | | | | | no-obsolete-elements | βœ… | | ⌨️ | | | no-outlet-outside-routes | βœ… | | | | | no-partial | βœ… | | | | | no-passed-in-event-handlers | βœ… | | | | | no-positional-data-test-selectors | βœ… | | | πŸ”§ | | no-positive-tabindex | βœ… | | ⌨️ | | | no-potential-path-strings | βœ… | | | | | no-quoteless-attributes | βœ… | | | | | no-redundant-fn | βœ… | | | πŸ”§ | | no-redundant-landmark-role | βœ… | | ⌨️ | πŸ”§ | | no-restricted-invocations | | | | | | no-route-action | | | | | | no-shadowed-elements | βœ… | | | | | no-this-in-template-only-components | | | | πŸ”§ | | no-trailing-spaces | | πŸ’… | | | | no-triple-curlies | βœ… | | | | | no-unbalanced-curlies | βœ… | | | | | no-unbound | βœ… | | | | | no-unknown-arguments-for-builtin-components | βœ… | | | πŸ”§ | | no-unnecessary-component-helper | βœ… | | | | | no-unnecessary-concat | | πŸ’… | | | | no-unused-block-params | βœ… | | | | | no-valueless-arguments | | | | | | no-whitespace-for-layout | | πŸ’… | ⌨️ | | | no-whitespace-within-word | | πŸ’… | ⌨️ | | | no-with | | | | | | no-yield-only | βœ… | | | | | no-yield-to-default | | | | | | quotes | | πŸ’… | | | | require-button-type | βœ… | | | πŸ”§ | | require-context-role | | | ⌨️ | | | require-each-key | | | | | | require-form-method | | | | | | require-has-block-helper | βœ… | | | πŸ”§ | | require-iframe-title | βœ… | | ⌨️ | | | require-input-label | βœ… | | ⌨️ | | | require-lang-attribute | βœ… | | ⌨️ | | | require-presentational-children | | | ⌨️ | | | require-splattributes | | | | | | require-valid-alt-text | βœ… | | ⌨️ | | | require-valid-named-block-naming-format | | | | | | self-closing-void-elements | | πŸ’… | | | | simple-unless | βœ… | | | | | splat-attributes-only | βœ… | | | | | style-concatenation | βœ… | | | | | table-groups | βœ… | | ⌨️ | | | template-length | | | | |

Supporting the
--fix
option

You can add a fixer to a rule. See fixer documentation for more details.

Sharing configs

It is possible to share a config (

extends
) or plugin (custom rules) across projects. See ember-template-lint-plugin-peopleconnect for an example.

Defining your own rules

You can define and use your own custom rules using the plugin system. See plugin documentation for more details.

Semantic Versioning Policy

The semver policy for this addon can be read here: semver policy.

Contributing

See the Contributing Guidelines for information on how to help out.

License

This project is licensed under the MIT License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.