Npm · npm

prettier

Prettier is an opinionated code formatter

Install

Install-Kommandos

npm install prettier@3.9.6
pnpm add prettier@3.9.6
yarn add prettier@3.9.6

README

Vorschau

<h2 align="center">Opinionated Code Formatter</h2>

<p align="center"> <em> JavaScript · TypeScript · Flow · JSX · JSON </em> <br /> <em> CSS · SCSS · Less </em> <br /> <em> HTML · Vue · Angular </em> <br /> <em> GraphQL · Markdown · YAML </em> <br /> <em> <a href="https://prettier.io/docs/plugins"> Your favorite language? </a> </em> </p>

<p align="center"> <a href="https://github.com/prettier/prettier/actions?query=branch%3Amain"> <img alt="CI Status" src="https://img.shields.io/github/check-runs/prettier/prettier/main?style=flat-square&label=CI"></a> <a href="https://codecov.io/gh/prettier/prettier"> <img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a> <a href="https://x.com/acdlite/status/974390255393505280"> <img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a> <br/> <a href="https://www.npmjs.com/package/prettier"> <img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a> <a href="https://www.npmjs.com/package/prettier"> <img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a> <a href="https://github.com/prettier/prettier#badge"> <img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a> <a href="https://x.com/intent/follow?screen_name=PrettierCode"> <img alt="Follow Prettier on X" src="https://img.shields.io/badge/%40PrettierCode-9f9f9f?style=flat-square&logo=x&labelColor=555"></a> </p>

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

Input

<!-- prettier-ignore -->

foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());

Output

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne(),
);

Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!


Documentation

Install · Options · CLI · API

Playground


Badge

Show the world you're using Prettier

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Contributing

See CONTRIBUTING.md.