Prettier

prettier.io

Opinionated code formatter enforcing consistent style across JavaScript and beyond.

Overview

Prettier is an opinionated code formatter that removes all original styling and reprints code from scratch with consistent formatting rules. It supports a wide range of languages including JavaScript, TypeScript, JSX, CSS, HTML, JSON, GraphQL, Markdown, YAML, and many others through community plugins.

Rather than debating code style in reviews, Prettier automatically formats code on save, saving time and energy. It parses code into an abstract syntax tree and reprints it with rules that account for maximum line length, automatically wrapping code when necessary. The tool integrates with most popular editors and works alongside linters like ESLint through dedicated configuration packages.

Key features

  • Supports 15+ languages and formats
  • Removes original styling and reprints code consistently
  • Integrates with major editors (VS Code, WebStorm, Vim, etc.)
  • Works with ESLint and other linters
  • Pre-commit hook support via Git hooks
  • CLI and API interfaces
  • Minimal configuration philosophy
Pros
  • Eliminates style discussions in code reviews
  • Automatic formatting on save in editors
  • Consistent output across entire codebase
  • Wide language support with community plugins
  • Easy integration with existing tools and workflows
  • Minimal configuration required
Cons
  • Limited customization options by design
  • Can require adjustment period for teams with different style preferences
  • Performance impact on very large projects
  • Opinionated approach may not suit all coding standards
Use this if
You want to enforce consistent code formatting across your team without configuration debates, need automatic formatting on save, or are working with JavaScript/TypeScript projects that benefit from standardized style.
Skip this if
Your project requires highly customized formatting rules that conflict with Prettier's opinionated approach, or you need extensive configuration options for style control.

Best for

Enforcing consistent code style across teamsRemoving style debates from code reviewsFormatting JavaScript and TypeScript projectsIntegrating with CI/CD pipelinesAutomating code formatting on save

Alternatives

ESLintPrettier with ESLint integrationStylelintBlack (Python)Go fmt (Go)

Compare Prettier alternatives

More Devtool

Compare all
View Deno
Deno

Secure TypeScript/JavaScript runtime with built-in tooling, permissions, and npm compat.

View Nuxt Studio
Nuxt Studio

Visual content editor for Nuxt Content with live preview and team workflows.

View matlab
matlab

Matrix-based language and environment for engineering, signal processing, and simulation.

View Emacs
Emacs

Powerful, extensible text editor that supports various programming languages and file types.