{"id":20356,"library":"prettier-plugin-elm","title":"prettier-plugin-elm","description":"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.","status":"active","version":"0.12.0","language":"javascript","source_language":"en","source_url":"https://github.com/gicentre/prettier-plugin-elm","tags":["javascript","elm","elm-format","gicentre","prettier","prettier-plugin","typescript"],"install":[{"cmd":"npm install prettier-plugin-elm","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-elm","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-elm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required at runtime for formatting orchestration.","package":"prettier","optional":false},{"reason":"Vendored dependency for actual Elm formatting logic; not a peer dependency.","package":"elm-format","optional":false}],"imports":[{"note":"The plugin does not export an ES module; use CommonJS require() or use Prettier's config resolution (plugins array).","wrong":"import prettierPluginElm from 'prettier-plugin-elm'; // ESM import will fail – plugin is CommonJS","symbol":"default","correct":"const prettierPluginElm = require('prettier-plugin-elm');"},{"note":"With Prettier v3, you must list the plugin explicitly in the config file; global install with v2 auto-detects.","wrong":"Using plugins array without specifying package name or wrong casing","symbol":"prettierPluginElm in .prettierrc","correct":"{\n  \"plugins\": [\"prettier-plugin-elm\"]\n}"},{"note":"Run prettier directly on .elm files; the plugin is loaded automatically when installed globally (v2) or via config (v3).","wrong":"Calling prettier with no plugin installed or using older elm-format version inline.","symbol":"CLI usage","correct":"prettier --write '**/*.elm'"}],"quickstart":{"code":"// Install Prettier v2 globally and the plugin\n// npm install --global prettier@2 prettier-plugin-elm\n//\n// Now format an Elm file:\n// prettier --write Main.elm\n\n// Or for local project with Prettier v3:\n// npm install --save-dev prettier prettier-plugin-elm\n// Then in .prettierrc:\n{\n  \"plugins\": [\"prettier-plugin-elm\"]\n}\n// Run: npx prettier --write src/**/*.elm","lang":"typescript","description":"Global installation with Prettier v2 and formatting a single file; also shows local config for Prettier v3."},"warnings":[{"fix":"Upgrade Node.js to v18.20.6 or later.","message":"Minimum Node.js version increased to 18.20.6 in v0.12.0","severity":"breaking","affected_versions":">=0.12.0"},{"fix":"Use older plugin version if running on legacy Node.js, or upgrade Node.","message":"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","severity":"breaking","affected_versions":"<0.12.0"},{"fix":"Add \"plugins\": [\"prettier-plugin-elm\"] to .prettierrc or Prettier config file.","message":"Prettier v3 does not support automatic plugin discovery; manual plugin listing is required.","severity":"gotcha","affected_versions":">=0.12.0"},{"fix":"Do not install elm-format separately; the plugin uses its own bundled version.","message":"elm-format is vendored; installing separate elm-format globally may cause version mismatches.","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Use version 0.3.x for Elm 0.18 compatibility.","message":"Plugin assumes Elm 0.19; for Elm 0.18 use prettier-plugin-elm@0.3.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev prettier-plugin-elm' (local) or 'npm install --global prettier-plugin-elm' (global).","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'prettier-plugin-elm'"},{"fix":"Reinstall the plugin: npm install prettier-plugin-elm. Ensure network access for binary download.","cause":"The vendored elm-format binary is missing or corrupted.","error":"Error: [prettier-plugin-elm] Could not find elm-format."},{"fix":"Increase timeout via PR or reduce file size. Check elm-format version compatibility.","cause":"Elm file formatting took longer than expected; possibly large file or infinite loop.","error":"Error: [prettier-plugin-elm] elm-format timed out"},{"fix":"Add \"plugins\": [\"prettier-plugin-elm\"] to .prettierrc.","cause":"Prettier v3 without explicit plugin listing.","error":"Error: Plugin loaded but no parser found for '.elm'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}