Registry / devops / prettier-plugin-elm

prettier-plugin-elm

JSON →
library0.12.0jsnpmunverified

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.

npm install prettier-plugin-elm
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-EL
P
prettier-plugin-elm
devopsjavascriptv0.12.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
const prettierPluginElm = require('prettier-plugin-elm');
import prettierPluginElm from 'prettier-plugin-elm'; // ESM import will fail – plugin is CommonJS
The plugin does not export an ES module; use CommonJS require() or use Prettier's config resolution (plugins array).
prettierPluginElm in .prettierrc
{ "plugins": ["prettier-plugin-elm"] }
Using plugins array without specifying package name or wrong casing
With Prettier v3, you must list the plugin explicitly in the config file; global install with v2 auto-detects.
CLI usage
prettier --write '**/*.elm'
Calling prettier with no plugin installed or using older elm-format version inline.
Run prettier directly on .elm files; the plugin is loaded automatically when installed globally (v2) or via config (v3).

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
Debug
Known issues
breakingMinimum Node.js version increased to 18.20.6 in v0.12.0
fix
Upgrade Node.js to v18.20.6 or later.
affects: >=0.12.0
breakingNode.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.
affects: <0.12.0
gotchaPrettier v3 does not support automatic plugin discovery; manual plugin listing is required.
fix
Add "plugins": ["prettier-plugin-elm"] to .prettierrc or Prettier config file.
affects: >=0.12.0
gotchaelm-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.
affects: >=0.6.0
deprecatedPlugin 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.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-elm'
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: [prettier-plugin-elm] Could not find elm-format.
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: [prettier-plugin-elm] elm-format timed out
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: Plugin loaded but no parser found for '.elm'
Prettier v3 without explicit plugin listing.
fix
Add "plugins": ["prettier-plugin-elm"] to .prettierrc.
Upgrade
Version history
0.12.0latest on npm
Audit
Dependencies
prettierrequiredPeer dependency required at runtime for formatting orchestration.
elm-formatrequiredVendored dependency for actual Elm formatting logic; not a peer dependency.
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-elm — npm install prettier-plugin-elm · libregistry