Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
ember-template-lint
Advanced tools
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.
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' };
ESLint is a widely-used linting tool for JavaScript. It helps developers find and fix problems in their JavaScript code. While ESLint focuses on JavaScript, ember-template-lint is specifically designed for Handlebars templates in Ember.js.
Stylelint is a linter for CSS and other stylesheets. It helps enforce consistent conventions and avoid errors in stylesheets. Like ember-template-lint, it is highly configurable, but it focuses on styles rather than Handlebars templates.
ember-cli-template-lint is an older package that integrates template linting into the Ember CLI build process. It has been largely superseded by ember-template-lint, which offers more features and better integration.
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.
^14.18.0 || ^16.0.0 || >=18.0.0
npm install --save-dev ember-template-lint
yarn add --dev ember-template-lint
Note: this library is installed by default with new Ember apps.
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 .
See documentation on workflow examples.
See documentation on the todo functionality.
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.
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. |
Each rule has emojis denoting:
--fix
command line option--fix
optionYou can add a fixer to a rule. See fixer documentation for more details.
It is possible to share a config (extends
) or plugin (custom rules) across projects. See ember-template-lint-plugin-peopleconnect for an example.
You can define and use your own custom rules using the plugin system. See plugin documentation for more details.
The semver policy for this addon can be read here: semver policy.
See the Contributing Guidelines for information on how to help out.
This project is licensed under the MIT License.
v5.11.0 (2023-06-27)
no-at-ember-render-modifiers
(@NullVoxPopuli)FAQs
Linter for Ember or Handlebars templates.
The npm package ember-template-lint receives a total of 121,719 weekly downloads. As such, ember-template-lint popularity was classified as popular.
We found that ember-template-lint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 7 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.