Registry / testing / ember-template-lint

ember-template-lint

JSON →
library7.9.3jsnpmunverified

Linter for Ember or Handlebars templates, version 7.9.3. Released regularly with monthly minor/patch updates. It provides over 100 built-in rules covering accessibility, styling, and best practices, with presets for recommended, stylistic, and a11y. Key differentiator: first-class integration with Ember projects, auto-fix support, and plugin architecture. Unlike generic HTML linters, it understands Handlebars syntax and Ember-specific patterns like components and modifiers. Requires Node ^18.18.0 || >=20.9.0.

npm install ember-template-lint
INSTALL
IMPORT
SIG · EMBER-TEMPLATE-LIN
E
ember-template-lint
testingjavascriptv7.9.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Linter
import Linter from 'ember-template-lint'
const Linter = require('ember-template-lint')
Default export; ESM import preferred. CommonJS require is still supported for backward compatibility.
Linter
const { Linter } = require('ember-template-lint')
const Linter = require('ember-template-lint').Linter
CommonJS destructured import works; direct property access also works but less idiomatic.
getConfig
import { getConfig } from 'ember-template-lint'
Utility to load and merge config files.
FIXABLE_RULES
import { FIXABLE_RULES } from 'ember-template-lint'
List of rule names that support auto-fix.

Setup config file, run CLI, use programmatic API to lint and fix a template.

// Create .template-lintrc.js 'use strict'; module.exports = { extends: 'recommended', rules: { 'no-bare-strings': true, }, }; // Run lint via CLI // npx ember-template-lint . // Or use programmatic API import Linter from 'ember-template-lint'; const linter = new Linter(); const results = await linter.verify({ source: '<div>A bare string</div>', filePath: 'app/templates/application.hbs', config: { rules: { 'no-bare-strings': true, }, }, }); console.log(results); // [ // { // rule: 'no-bare-strings', // severity: 2, // filePath: 'app/templates/application.hbs', // message: 'Non-translated string used', // line: 1, // column: 5 // } // ] // Auto-fix import { verifyAndFix } from 'ember-template-lint'; const fixed = await verifyAndFix({ source: '<div>A bare string</div>', filePath: 'app/templates/application.hbs', config: { rules: { 'no-bare-strings': 'fix', }, }, });
ember-template-lint --version
Debug
Known issues
breakingNode.js versions <18.18.0 or <20.9.0 are no longer supported as of v7.0.0.
fix
Upgrade Node.js to ^18.18.0 || ^20.9.0 || >=21.1.0.
affects: >=7.0.0
breakingThe `config` option in the Linter constructor no longer accepts a file path string; must be an object.
fix
Pass config object directly, or use `getConfig` to load from file.
affects: >=5.0.0
deprecatedRule `no-unnecessary-curly-strings` deprecated in favor of `no-curly-component-invocation`.
fix
Replace rule name in config.
affects: >=3.0.0
gotcha`Linter.verify()` is async; forgetting `await` results in a Promise object.
fix
Use `await linter.verify(...)`.
affects: >=4.0.0
gotchaRules with the same name from different plugins may conflict; later plugin overrides earlier.
fix
Ensure unique rule names or use plugin namespacing.
affects: >=3.0.0
deprecatedThe `--json` flag is deprecated in favor of `--format=json`
fix
Use `ember-template-lint --format=json`.
affects: >=5.0.0
Errors
Common errors & fixes
Cannot find module 'ember-template-lint'
Package not installed or path resolution issue.
fix
Run `npm install --save-dev ember-template-lint` or check your node_modules.
Rule 'no-bare-strings' is not configured.
Rule not enabled in .template-lintrc.js or used outside a project.
fix
Add `'no-bare-strings': true` to rules in config file.
Error: EMFILE: too many open files
Max file descriptors reached when linting many files.
fix
Increase file descriptor limit (e.g., `ulimit -n 4096`) or lint fewer files at once.
The `config` option must be an object, not a string
Passing deprecated string path to Linter constructor.
fix
Load config with `require` or use `getConfig` and pass the object.
Upgrade
Version history
7.9.3latest on npm
Audit
Dependencies
@ember-template-lint/todo-utilsrequiredManages todo comments for lint results
chalkrequiredUsed for colored terminal output
ember-template-recastrequiredParses and transforms handlebars templates
Agent activity
4 hits · last 30 days
node
4
Resources