PACKAGE · LINTING & FORMATTING

dprint-node

A node API for the dprint TypeScript and JavaScript code formatter

WEEKLY DOWNLOADS 662.8K
STARS 491
FORKS 9
OPEN ISSUES 13
INSTALL SIZE 24.8 MB
UNPACKED SIZE 24.8 MB
LAST UPDATED 2y ago
DOWNLOAD TRENDS

dprint-node downloads — last 12 months

Download trends for dprint-node1 download series from Jun 2025 to May 2026. Use left and right arrow keys to inspect monthly values.01.6M3.1M4.7M6.2MJun 2025SepDecMarMay 2026
dprint-node
ABOUT DPRINT-NODE

dprint-node provides a programmatic API for the dprint code formatter, enabling integration into custom tooling and workflows within Node.js environments. It addresses the need for consistent code style across development teams by offering a declarative and highly configurable formatting solution specifically for TypeScript and JavaScript.

The core philosophy behind dprint is to offer a fast, reliable, and reproducible code formatter. It aims to be developer-friendly, with a clear API and understandable configuration options, making it accessible for individual developers and teams seeking to automate code quality. dprint emphasizes broad language support, including TypeScript and JavaScript, with a focus on performance.

Key API patterns revolve around the `dprint.format` function, which takes a configuration object and a map of file paths to code content, returning a map of formatted file paths to code content. This approach allows for batch processing and fine-grained control over which files are formatted and how, supporting plugin-based architecture for extending its capabilities to other languages or custom formatting rules.

Integration points include CI/CD pipelines, pre-commit hooks using tools like Husky, and custom build scripts. Developers can leverage dprint-node within Node.js projects to automatically format code before committing or during the build process, ensuring code uniformity across various development stages.

With 1.0M weekly downloads and active maintenance indicated by its last update on September 15, 2023, dprint demonstrates significant adoption and ongoing development. Its performance is a key design tenet, aiming to format code quickly even in large codebases, though the unpacked size of 24.8 MB suggests it includes significant tooling.

Developers should be aware that dprint operates on a strict set of formatting rules, which are generally less configurable than some older or more opinionated formatters. While this promotes consistency, it may require adjustment if specific, niche formatting preferences are deeply embedded in an existing codebase. The limited number of forks (9) compared to stars (491) might suggest a focus on core functionality over extensive community modification.

WHEN TO USE
  • When automating code formatting via a Node.js script or CI/CD pipeline utilizing the `dprint.format` API.
  • When integrating consistent TypeScript and JavaScript code style into pre-commit hooks managed by tools like Husky.
  • When needing to programmatically format collections of files by providing a map of file paths to code content to `dprint.format`.
  • When building custom developer tools that require code formatting as a backend service.
  • When aiming for reproducible builds where code formatting is a deterministic step.
  • When prioritizing formatter speed and a defined set of configurable formatting rules over extensive customization options.
WHEN NOT TO USE
  • If your project exclusively uses languages not supported by dprint's core or available plugins, consider formatters with broader language support.
  • If your workflow heavily relies on highly opinionated, non-standard formatting rules that dprint's configuration cannot accommodate, explore more flexible alternatives.
  • If the 24.8 MB unpacked size is a critical constraint for a minimal tooling environment. A lighter alternative formatter might be more suitable.
  • When needing to format code on a per-line or per-token basis programmatically without batch file processing, as dprint's API is file-centric.
  • If the strict set of formatting rules imposes a significant refactoring burden on an existing, inconsistently formatted large codebase, consider a phased approach or a formatter with more lenient initial settings.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 4
dprint-node vs prettier ★ 51.9K · 54.1M/wk dprint-node vs oxlint ★ 21.5K · 3.9M/wk dprint-node vs eslint ★ 27.3K · 67.4M/wk dprint-node vs @biomejs/biome ★ 24.9K · 4.5M/wk