You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP β†’
Socket
Socket
Sign inDemoInstall

ember-template-lint

Package Overview
Dependencies
17
Maintainers
6
Versions
215
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-template-lint

Linter for Ember or Handlebars templates.


Version published
Weekly downloads
129K
decreased by-16.7%
Maintainers
6
Created
Weekly downloads
Β 

Package description

What is ember-template-lint?

ember-template-lint is a linting tool for Ember.js templates. It helps developers maintain consistent coding styles, catch potential errors, and enforce best practices in Handlebars templates.

What are ember-template-lint's main functionalities?

Linting Templates

This feature allows you to lint your Handlebars templates to ensure they follow specific rules. For example, the 'no-bare-strings' rule prevents the use of bare strings in templates, encouraging the use of translation helpers instead.

module.exports = { 'no-bare-strings': true };

Custom Rules

You can define custom linting rules to enforce specific coding standards within your project. In this example, the 'no-inline-styles' rule is set to 'error' severity, which will flag any inline styles in templates as errors.

module.exports = { rules: { 'no-inline-styles': { severity: 'error' } } };

Configuration File

You can extend from predefined configurations to quickly set up linting rules. The 'recommended' configuration includes a set of rules that are generally considered best practices for Ember.js templates.

module.exports = { extends: 'recommended' };

Other packages similar to ember-template-lint

Changelog

Source

v4.14.0 (2022-09-01)

:rocket: Enhancement
  • #2483 Implement support for embedded templates (@ventuno)
:bug: Bug Fix
:house: Internal
  • #2605 Add concurrency setup to GitHub Actions workflow (@rwjblue)
  • #2602 Update GitHub Actions setup to volta-cli/action@v3 (@rwjblue)
Committers: 2

Readme

Source

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  }}
<div>A bare string</div>

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 ^12.22.0 || ^14.17.0 || >=16.0.0

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

NameDescription
βœ…recommendedEnables the recommended rules.
πŸ’…stylisticEnables 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).
⌨️a11yEnables 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-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-aria-unsupported-elements⌨️
no-array-prototype-extensionsπŸ”§
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-aria-attributes⌨️
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-obscure-array-accessπŸ”§
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-scope-outside-table-headings⌨️
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-unsupported-role-attributesβŒ¨οΈπŸ”§
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-aria-activedescendant-tabindex⌨️
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-mandatory-role-attributes⌨️
require-media-caption⌨️
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.

Keywords

FAQs

Package last updated on 01 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc