{"id":20358,"library":"prettier-plugin-ember-template-tag","title":"Prettier Plugin Ember Template Tag","description":"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.","status":"active","version":"2.1.5","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/ember-tooling/prettier-plugin-ember-template-tag","tags":["javascript","ember","ember template imports","gjs","gts","prettier","template tag"],"install":[{"cmd":"npm install prettier-plugin-ember-template-tag","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-ember-template-tag","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-ember-template-tag","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required as the plugin runs under Prettier >= 3.0.0","package":"prettier","optional":false}],"imports":[{"note":"CJS default import; ESM import with default is not supported because the plugin does not export default in ESM.","wrong":"import prettierPluginEmberTemplateTag from 'prettier-plugin-ember-template-tag'","symbol":"default","correct":"const prettierPluginEmberTemplateTag = require('prettier-plugin-ember-template-tag')"},{"note":"Since v2.1.0, the package publishes both CJS and ESM. In ESM context, use named or default import as shown.","wrong":"const p = require('prettier-plugin-ember-template-tag')","symbol":"default (ESM)","correct":"import p from 'prettier-plugin-ember-template-tag'"},{"note":"Simply use the package name string; Prettier resolves it automatically. Avoid direct path references.","wrong":"plugins: ['./node_modules/prettier-plugin-ember-template-tag/index.js']","symbol":"plugin in prettier config","correct":"plugins: ['prettier-plugin-ember-template-tag']"}],"quickstart":{"code":"// .prettierrc.js\nmodule.exports = {\n  plugins: ['prettier-plugin-ember-template-tag'],\n  overrides: [\n    {\n      files: '*.{js,ts,gjs,gts}',\n      options: {\n        singleQuote: true,\n        trailingComma: 'all',\n      },\n    },\n  ],\n};\n\n// Then run:\n// prettier --write . (Prettier >= 3.1)\n// prettier --write . --plugin prettier-plugin-ember-template-tag (Prettier < 3.1)","lang":"javascript","description":"Shows how to configure Prettier with the plugin for .gjs/.gts files, including overrides for single quotes and trailing commas."},"warnings":[{"fix":"Upgrade to Prettier 3+.","message":"Requires Prettier >= 3.0.0. Prettier 2.x is not supported.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Ensure Prettier version is >=3.0.0. Update configuration as needed.","message":"v2.0.0 dropped support for Prettier 2.x and changed plugin initialization behavior.","severity":"breaking","affected_versions":">=2.0.0 <2.1.0"},{"fix":"If using eslint-plugin-ember <12, downgrade plugin to 1.1.0. Otherwise upgrade eslint-plugin-ember to >=12.","message":"With eslint-plugin-ember <12, use plugin version 1.1.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use prettier >=3.1 and the plugins array in config, or add --plugin flag to command.","message":"When using Prettier < 3.1, the --plugin flag must be used explicitly (e.g., --plugin prettier-plugin-ember-template-tag).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Remove the prettier section from package.json or ensure consistency between both config sources.","message":"If you have a `\"prettier\"` section in package.json, it takes precedence over .prettierrc.js.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use separate handlebars prettier plugin for .hbs files.","message":"The plugin does not support formatting .hbs files; only .gjs and .gts.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install plugin: npm install --save-dev prettier-plugin-ember-template-tag. Use string name in plugins array, not a path.","cause":"Plugin not installed or incorrect import path in config.","error":"Cannot find module 'prettier-plugin-ember-template-tag'"},{"fix":"Check if plugin is installed. Ensure prettier >= 3.0.0.","cause":"Plugin not installed or not in node_modules, or prettier version < 3.0.0.","error":"Error: Couldn't resolve plugin \"prettier-plugin-ember-template-tag\""},{"fix":"Upgrade to Prettier 3+ or downgrade plugin to v1.x.","cause":"Using incompatible version of prettier-plugin-ember-template-tag with Prettier 2.x.","error":"TypeError: prettier.resolveConfig.sync is not a function"},{"fix":"Add 'prettier-plugin-ember-template-tag' to the plugins array in config or use --plugin flag.","cause":"Prettier is run without the plugin enabled, and does not recognize .gjs/.gts extensions.","error":"Error: You cannot use .gjs files with prettier-plugin-ember-template-tag without the plugin"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}