prettier-plugin-elm

raw JSON →
0.12.0 verified Sat Apr 25 auth: no javascript

Adds Elm language support to Prettier by wrapping elm-format. Version 0.12.0 (2025-09-21) requires Node >=18.20.6 and uses elm-format 0.8.8. Works with Prettier v2 (global) or v3 (local with explicit plugin config). Formats .elm files and Elm code blocks inside Markdown documents, with support for <!-- prettier-ignore -->. Key differentiators: integrates elm-format directly into the Prettier ecosystem, handles both standalone files and embedded code blocks. Vendors elm-format internally, reducing version conflicts. Designed for Elm 0.19; older plugin versions support Elm 0.18. Maintained by giCentre, with TypeScript source code.

error Error: Cannot find module 'prettier-plugin-elm'
cause Plugin not installed or not in node_modules.
fix
Run 'npm install --save-dev prettier-plugin-elm' (local) or 'npm install --global prettier-plugin-elm' (global).
error Error: [prettier-plugin-elm] Could not find elm-format.
cause The vendored elm-format binary is missing or corrupted.
fix
Reinstall the plugin: npm install prettier-plugin-elm. Ensure network access for binary download.
error Error: [prettier-plugin-elm] elm-format timed out
cause Elm file formatting took longer than expected; possibly large file or infinite loop.
fix
Increase timeout via PR or reduce file size. Check elm-format version compatibility.
error Error: Plugin loaded but no parser found for '.elm'
cause Prettier v3 without explicit plugin listing.
fix
Add "plugins": ["prettier-plugin-elm"] to .prettierrc.
breaking Minimum Node.js version increased to 18.20.6 in v0.12.0
fix Upgrade Node.js to v18.20.6 or later.
breaking Node.js v14 minimum required in v0.9.0, v12 in v0.8.0, v8 dropped in v0.6.0, v6 in v0.5.0
fix Use older plugin version if running on legacy Node.js, or upgrade Node.
gotcha Prettier v3 does not support automatic plugin discovery; manual plugin listing is required.
fix Add "plugins": ["prettier-plugin-elm"] to .prettierrc or Prettier config file.
gotcha elm-format is vendored; installing separate elm-format globally may cause version mismatches.
fix Do not install elm-format separately; the plugin uses its own bundled version.
deprecated Plugin assumes Elm 0.19; for Elm 0.18 use prettier-plugin-elm@0.3.
fix Use version 0.3.x for Elm 0.18 compatibility.
npm install prettier-plugin-elm
yarn add prettier-plugin-elm
pnpm add prettier-plugin-elm

Global installation with Prettier v2 and formatting a single file; also shows local config for Prettier v3.

// Install Prettier v2 globally and the plugin
// npm install --global prettier@2 prettier-plugin-elm
//
// Now format an Elm file:
// prettier --write Main.elm

// Or for local project with Prettier v3:
// npm install --save-dev prettier prettier-plugin-elm
// Then in .prettierrc:
{
  "plugins": ["prettier-plugin-elm"]
}
// Run: npx prettier --write src/**/*.elm