dprint

A pluggable, fast code formatting platform supporting Rust, TypeScript, JavaScript, JSON, Markdown, TOML, and more via WebAssembly plugins.

dprint is a fast, pluggable code formatting platform written in Rust. Where tools like Prettier are monolithic, dprint's architecture is built around WebAssembly plugins — one plugin per language, each independently versioned and replaceable. This makes it fast (plugins run in parallel), flexible (mix and match formatters for any language), and deterministic (plugin versions are pinned in dprint.json).

Features

  • Plugin-based — each language is handled by a separate WASM plugin; only load what you need
  • Blazing fast — incremental formatting using a cache; only re-formats files that have changed since the last run
  • Broad language support — TypeScript, JavaScript, JSON, Markdown, TOML, Rust (via rustfmt), and more via community plugins
  • Consistent config — a single dprint.json at the project root controls all formatters
  • Editor integration — LSP-compatible; integrates with VS Code, Helix, Neovim, and others
  • CI-friendlydprint check exits non-zero on unformatted files
  • Incremental — a local cache means repeated runs on unchanged files take milliseconds

Installation

cargo install dprint

Or via the install script:

# macOS / Linux
curl -fsSL https://dprint.dev/install.sh | sh

# Windows (PowerShell)
iwr https://dprint.dev/install.ps1 -useb | iex

Or via your package manager:

# macOS
brew install dprint

# Arch Linux
pacman -S dprint

# Nix
nix-env -iA nixpkgs.dprint

# Debian / Fedora — no official package; use the install script above:
# curl -fsSL https://dprint.dev/install.sh | sh

Setup

Initialise a dprint.json config file in your project root:

dprint init

This creates a dprint.json and downloads the plugins you select. A typical config for a Rust project with some JSON and Markdown looks like:

{
  "incremental": true,
  "rust": {},
  "json": {
    "indentWidth": 2
  },
  "markdown": {
    "lineWidth": 80
  },
  "toml": {},
  "excludes": ["**/target", "**/.git", "**/node_modules"],
  "plugins": [
    "https://plugins.dprint.dev/rustfmt-0.10.5.wasm",
    "https://plugins.dprint.dev/json-0.19.4.wasm",
    "https://plugins.dprint.dev/markdown-0.17.8.wasm",
    "https://plugins.dprint.dev/toml-0.6.3.wasm"
  ]
}

Usage

# Format all files in the project
dprint fmt

# Check formatting without modifying files (for CI)
dprint check

# Format a specific file
dprint fmt src/main.rs

# List all files dprint would format
dprint output-file-paths

# Upgrade all plugins to their latest versions
dprint config update

Available Plugins

PluginLanguages
rustfmtRust
typescriptTypeScript, JavaScript, JSX, TSX
jsonJSON, JSONC
markdownMarkdown
tomlTOML
dockerfileDockerfile
sqlSQL
htmlHTML
prettierAny language Prettier supports (via the Prettier WASM plugin)

Find the full list at plugins.dprint.dev.

CI Integration

Add a formatting check to your GitHub Actions workflow:

- name: Install dprint
  uses: dprint/check@v2.2

- name: Check formatting
  run: dprint check

Or without the action:

- name: Check formatting
  run: |
    curl -fsSL https://dprint.dev/install.sh | sh
    dprint check

Editor Integration

dprint implements the Language Server Protocol and integrates with most editors:

  • VS Code — install the dprint extension and set it as the default formatter
  • Helix — configure dprint as a language formatter in ~/.config/helix/languages.toml
  • Neovim — use none-ls.nvim or conform.nvim with the dprint formatter

Why dprint over Prettier?

Prettier is a Node.js program that starts a JavaScript runtime on every invocation. On a large project, prettier --write . can take 10–30 seconds. dprint's incremental cache means that after the first run, subsequent runs touch only changed files — typically finishing in under a second. The WASM plugin architecture also means you get the same binary regardless of whether Node.js is installed.