prettier
An opinionated code formatter that enforces consistent style across every language your project speaks.
Repository Health
Technical Analysis
Prettier is an opinionated code formatter that parses your source code into an abstract syntax tree and re-prints it from scratch, applying its own consistent rules while honoring a configurable maximum line length. By removing all original styling and producing deterministic output, it ends debates over formatting entirely and lets teams focus code review on substance rather than whitespace.
With first-class support for JavaScript, TypeScript, JSX, CSS, SCSS, Less, HTML, Vue, Angular, GraphQL, Markdown, YAML, and JSON, Prettier runs from a CLI, an editor-on-save integration, a pre-commit hook, or a CI check. A programmatic API is also available for tools that need to format code on the fly.
What You Get
- A zero-configuration CLI that formats entire projects in place with a single command
- Built-in printers for 15+ languages including JavaScript, TypeScript, CSS, HTML, Vue, GraphQL, Markdown, and YAML
- Editor integrations that reformat files automatically on save
- A programmatic API (format, check, formatWithCursor, resolveConfig) for embedding formatting in your own tooling
- A —check mode for CI that fails the build when files are not already formatted
Common Use Cases
- Enforcing a single, non-negotiable code style across a team or monorepo
- Reformatting files automatically on save in the editor
- Gating pull requests in CI so unformatted code cannot be merged
- Formatting a mixed-language codebase (JS, CSS, Markdown, YAML) with one tool
Under The Hood
Architecture
Prettier is a parse-and-reprint pipeline rather than a rule-patching linter. src/main/core.js orchestrates the flow: source text is parsed by a language-specific parser (src/main/parse.js dispatches to plugins under src/language-js, src/language-css, src/language-html, etc.), then src/main/ast-to-doc.js converts the resulting AST into an intermediate representation called a Doc using the builder combinators in src/document. A Wadler-style pretty-printer (src/document/printer.js) walks the Doc and decides where to break lines based on the configured printWidth, before the result is serialized back to a string. Comments are re-attached to the new tree via src/main/comments, and options flow through normalize-options.js and core-options.evaluate.js.
Tech Stack
Written in JavaScript (ESM, "type": "module", Node >=22) with TypeScript type definitions shipped in src/index.d.ts. It bundles a large set of best-in-class parsers as dependencies — @babel/parser, typescript, flow-parser, meriyah, oxc-parser, and hermes-parser for JS/TS; postcss (with less/scss plugins) for CSS; angular-html-parser and @glimmer/syntax for templates; unified/remark for Markdown; and yaml and graphql for their respective languages. The CLI is delegated to @prettier/cli, and the build is bundled for distribution.
Code Quality
The project is exceptionally well-tested, with over 4,300 test files under tests/ split across format, unit, integration, and dts suites, run via Jest with snapshot testing to lock formatting output. Code is organized cleanly by language into self-contained src/language-* directories, each exposing parsers and printers behind a consistent plugin interface (Parser/Printer in the type definitions). Options are centrally normalized, and the Doc IR provides a clear, well-abstracted seam between parsing and printing.
API Design
The public API is small and ergonomic: format(source, options) and check(source, options) return promises, with formatWithCursor, resolveConfig, resolveConfigFile, getSupportInfo, and getFileInfo covering configuration and tooling needs. The plugin contract (Plugin, Parser, Printer) is fully typed and lets third parties add languages without touching core. Extensive official documentation, a live playground, and near-zero required configuration make it trivial to adopt.
Used by 310 apps in this directory
Cozy Stack
File Storage · Productivity
Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.
Craft CMS
CMS
A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.
Crater
Invoicing Finance
Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.
CubeSandbox
AI Agents · Developer Tools · Security
Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.
DataEase
AI Assistants · Analytics · Data Engineering
Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.
deer-workflow
AI Agents · AI Development
An open-source TypeScript runtime that treats coding agents as replaceable workers inside code-defined, observable Workflow graphs.
DefGuard
Authentication · Networking · Security
Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.
DevTools-X
Developer Tools
41 offline-first developer utilities in a single 10MB cross-platform desktop app — no Electron, no cloud, no compromise.
Directus
CMS · Low Code Platforms
Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.