Prettier ReasonML Plugin
raw JSON → 0.2.0 verified Sat Apr 25 auth: no javascript
A wrapper plugin that adds ReasonML (`.re` files) formatting support to Prettier by delegating to the `refmt` binary. Version 0.2.0 is the current stable release, with no regular cadence. Unlike AST-transforming plugins, this passes code directly to `refmt`, making it a thin integration layer. It requires `refmt` or `bsrefmt` to be installed separately, and inherits Prettier's configured options like `print-width`. Useful for ReasonML projects already using Prettier.
Common errors
error Cannot find module 'prettier-plugin-reasonml' ↓
cause Plugin not installed or not in node_modules path when running prettier.
fix
Install with npm install prettier-plugin-reasonml in the project or globally.
error refmt: command not found ↓
cause refmt binary not available; unable to format files.
fix
Install refmt via npm install -g reason or set REFMT_BIN to bsrefmt.
Warnings
gotcha VSCode Prettier extension does not support this plugin due to an upstream issue. ↓
fix Use CLI or other editor integrations; see https://github.com/prettier/prettier-vscode/issues/395
gotcha Requires `refmt` binary in PATH or set via REFMT_BIN environment variable. ↓
fix Ensure refmt (from reason package) is installed and accessible, or set REFMT_BIN=bsrefmt
gotcha Uses refmt directly; no AST manipulation, so some Prettier options may not apply as expected. ↓
fix Only options that translate to refmt flags (e.g., print-width) have effect.
Install
npm install prettier-plugin-reasonml yarn add prettier-plugin-reasonml pnpm add prettier-plugin-reasonml Imports
- default wrong
const plugin = require('prettier-plugin-reasonml')correct// No JS import; use via Prettier CLI or API with --plugin
Quickstart
npm install -g prettier prettier-plugin-reasonml
prettier src/**/*.re --write --print-width 120