{"id":26100,"library":"prettier-plugin-hbs","title":"Prettier Plugin for Handlebars (Ember.js Templates)","description":"A Prettier plugin that adds support for formatting Handlebars templates, primarily used in Ember.js applications. Current stable version 1.0.1. Development appears to be minimal with infrequent updates. Differentiates from other Handlebars formatters by integrating directly with Prettier, leveraging its consistent formatting engine and configuration. Suitable for Ember.js projects using GJS/GTS files or standalone .hbs templates.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install prettier-plugin-hbs","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-hbs","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-hbs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; requires Prettier as the formatting engine.","package":"prettier","optional":false}],"imports":[{"note":"Plugin is not imported directly in code; it's registered in Prettier config or passed as an option.","wrong":"import plugin from 'prettier-plugin-hbs'; (not used directly; plugin is used via Prettier configuration)","symbol":"prettier-plugin-hbs","correct":"// In .prettierrc: { \"plugins\": [\"prettier-plugin-hbs\"] } or Prettier API: const prettier = require('prettier'); prettier.format(code, { parser: 'hbs', plugins: [require('prettier-plugin-hbs')] });"},{"note":"Parser ID is 'hbs', not 'handlebars'.","wrong":"const formatted = prettier.format(template, { parser: 'handlebars' }); (wrong parser name)","symbol":"hbs","correct":"const formatted = prettier.format(template, { parser: 'hbs', plugins: [require('prettier-plugin-hbs')] });"}],"quickstart":{"code":"npm install --save-dev prettier prettier-plugin-hbs\n# Then create .prettierrc:\necho '{ \"plugins\": [\"prettier-plugin-hbs\"] }' > .prettierrc\n# Format a file:\nnpx prettier --write app/templates/application.hbs","lang":"javascript","description":"Install Prettier and the plugin, configure with .prettierrc, then format a .hbs file."},"warnings":[{"fix":"Ensure prettier is also installed: npm install --save-dev prettier","message":"Plugin must be installed as a devDependency alongside Prettier.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Check plugin compatibility; consider alternative plugins like 'prettier-plugin-ember-template-tag' for Ember GJS/GTS files.","message":"Version 1.0.1 may not support the latest Prettier versions (e.g., 3.x).","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use parser: 'hbs' in Prettier configuration or API calls.","message":"Parser name is 'hbs', not 'handlebars' as one might expect.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev prettier-plugin-hbs","cause":"Plugin not installed or not in node_modules.","error":"Cannot find module 'prettier-plugin-hbs'"},{"fix":"Add 'plugins': ['prettier-plugin-hbs'] to .prettierrc or pass plugins option in API.","cause":"Plugin is not specified in Prettier plugins list.","error":"Couldn't resolve parser \"hbs\""},{"fix":"Downgrade Prettier to 2.x or use a compatible plugin.","cause":"Incompatible Prettier version (e.g., 3.x).","error":"Error: Plugin prettier-plugin-hbs requires Prettier 2.x"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}