Registry / web-framework / prettier-plugin-ember-template-tag

prettier-plugin-ember-template-tag

JSON →
library2.1.5jsnpmunverified

A Prettier plugin for formatting Ember template tags in .gjs and .gts files, currently at version 2.1.5. It requires Prettier >= 3.0.0 and Node 18+ or 20+. The plugin integrates Prettier's babel-ts parser for the script portion and the glimmer parser for template content, providing seamless formatting for Ember's first-class component templates. Unlike alternative approaches (e.g., using eslint-plugin-ember), this plugin is the recommended official solution for formatting GJS/GTS files. Releases follow a patch/minor cadence with active maintenance from the Ember Tooling team. Notable recent changes include dual CJS/ESM output since v2.1.0, and fix for comment formatting crash in v2.1.4.

npm install prettier-plugin-ember-template-tag
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-EM
P
prettier-plugin-ember-template-tag
web-frameworkjavascriptv2.1.5
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ const prettierPluginEmberTemplateTag = require('prettier-plugin-ember-template-tag')
✗ import prettierPluginEmberTemplateTag from 'prettier-plugin-ember-template-tag'
CJS default import; ESM import with default is not supported because the plugin does not export default in ESM.
default (ESM)
✓ import p from 'prettier-plugin-ember-template-tag'
✗ const p = require('prettier-plugin-ember-template-tag')
Since v2.1.0, the package publishes both CJS and ESM. In ESM context, use named or default import as shown.
plugin in prettier config
✓ plugins: ['prettier-plugin-ember-template-tag']
✗ plugins: ['./node_modules/prettier-plugin-ember-template-tag/index.js']
Simply use the package name string; Prettier resolves it automatically. Avoid direct path references.

Shows how to configure Prettier with the plugin for .gjs/.gts files, including overrides for single quotes and trailing commas.

// .prettierrc.js module.exports = { plugins: ['prettier-plugin-ember-template-tag'], overrides: [ { files: '*.{js,ts,gjs,gts}', options: { singleQuote: true, trailingComma: 'all', }, }, ], }; // Then run: // prettier --write . (Prettier >= 3.1) // prettier --write . --plugin prettier-plugin-ember-template-tag (Prettier < 3.1)
Debug
Known issues
breakingRequires Prettier >= 3.0.0. Prettier 2.x is not supported.
fix
Upgrade to Prettier 3+.
affects: <2.0.0
breakingv2.0.0 dropped support for Prettier 2.x and changed plugin initialization behavior.
fix
Ensure Prettier version is >=3.0.0. Update configuration as needed.
affects: >=2.0.0 <2.1.0
deprecatedWith eslint-plugin-ember <12, use plugin version 1.1.0.
fix
If using eslint-plugin-ember <12, downgrade plugin to 1.1.0. Otherwise upgrade eslint-plugin-ember to >=12.
affects: >=2.0.0
gotchaWhen using Prettier < 3.1, the --plugin flag must be used explicitly (e.g., --plugin prettier-plugin-ember-template-tag).
fix
Use prettier >=3.1 and the plugins array in config, or add --plugin flag to command.
affects: >=2.0.0
gotchaIf you have a `"prettier"` section in package.json, it takes precedence over .prettierrc.js.
fix
Remove the prettier section from package.json or ensure consistency between both config sources.
affects: >=1.0.0
gotchaThe plugin does not support formatting .hbs files; only .gjs and .gts.
fix
Use separate handlebars prettier plugin for .hbs files.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-ember-template-tag'
Plugin not installed or incorrect import path in config.
fix
Install plugin: npm install --save-dev prettier-plugin-ember-template-tag. Use string name in plugins array, not a path.
Error: Couldn't resolve plugin "prettier-plugin-ember-template-tag"
Plugin not installed or not in node_modules, or prettier version < 3.0.0.
fix
Check if plugin is installed. Ensure prettier >= 3.0.0.
TypeError: prettier.resolveConfig.sync is not a function
Using incompatible version of prettier-plugin-ember-template-tag with Prettier 2.x.
fix
Upgrade to Prettier 3+ or downgrade plugin to v1.x.
Error: You cannot use .gjs files with prettier-plugin-ember-template-tag without the plugin
Prettier is run without the plugin enabled, and does not recognize .gjs/.gts extensions.
fix
Add 'prettier-plugin-ember-template-tag' to the plugins array in config or use --plugin flag.
Upgrade
Version history
2.1.5latest on npm
Audit
Dependencies
prettierrequiredPeer dependency; required as the plugin runs under Prettier >= 3.0.0
Agent activity
3 hits · last 30 days
node
3
Resources
prettier-plugin-ember-template-tag — npm install prettier-plugin-ember-template-tag · libregistry