1 | [![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)](https://prettier.io)
|
2 |
|
3 | <h2 align="center">Opinionated Code Formatter</h2>
|
4 |
|
5 | <p align="center">
|
6 | <em>
|
7 | JavaScript
|
8 | · TypeScript
|
9 | · Flow
|
10 | · JSX
|
11 | · JSON
|
12 | </em>
|
13 | <br />
|
14 | <em>
|
15 | CSS
|
16 | · SCSS
|
17 | · Less
|
18 | </em>
|
19 | <br />
|
20 | <em>
|
21 | HTML
|
22 | · Vue
|
23 | · Angular
|
24 | </em>
|
25 | <br />
|
26 | <em>
|
27 | GraphQL
|
28 | · Markdown
|
29 | · YAML
|
30 | </em>
|
31 | <br />
|
32 | <em>
|
33 | <a href="https://prettier.io/docs/en/plugins.html">
|
34 | Your favorite language?
|
35 | </a>
|
36 | </em>
|
37 | </p>
|
38 |
|
39 | <p align="center">
|
40 | <a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amain">
|
41 | <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/prod-test.yml?label=Prod&style=flat-square"></a>
|
42 | <a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amain">
|
43 | <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/dev-test.yml?label=Dev&style=flat-square"></a>
|
44 | <a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amain">
|
45 | <img alt="Github Actions Build Status" src="https://img.shields.io/github/actions/workflow/status/prettier/prettier/lint.yml?label=Lint&style=flat-square"></a>
|
46 | <a href="https://codecov.io/gh/prettier/prettier">
|
47 | <img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
|
48 | <a href="https://twitter.com/acdlite/status/974390255393505280">
|
49 | <img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a>
|
50 | <br/>
|
51 | <a href="https://www.npmjs.com/package/prettier">
|
52 | <img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a>
|
53 | <a href="https://www.npmjs.com/package/prettier">
|
54 | <img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a>
|
55 | <a href="#badge">
|
56 | <img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
|
57 | <a href="https://twitter.com/PrettierCode">
|
58 | <img alt="Follow Prettier on Twitter" src="https://img.shields.io/badge/%40PrettierCode-9f9f9f?style=flat-square&logo=x&labelColor=555"></a>
|
59 | </p>
|
60 |
|
61 | ## Intro
|
62 |
|
63 | 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.
|
64 |
|
65 | ### Input
|
66 |
|
67 |
|
68 | ```js
|
69 | foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
|
70 | ```
|
71 |
|
72 | ### Output
|
73 |
|
74 | ```js
|
75 | foo(
|
76 | reallyLongArg(),
|
77 | omgSoManyParameters(),
|
78 | IShouldRefactorThis(),
|
79 | isThereSeriouslyAnotherOne(),
|
80 | );
|
81 | ```
|
82 |
|
83 | Prettier can be run [in your editor](https://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
|
84 |
|
85 | ---
|
86 |
|
87 | **[Documentation](https://prettier.io/docs/en/)**
|
88 |
|
89 |
|
90 | [Install](https://prettier.io/docs/en/install.html) ·
|
91 | [Options](https://prettier.io/docs/en/options.html) ·
|
92 | [CLI](https://prettier.io/docs/en/cli.html) ·
|
93 | [API](https://prettier.io/docs/en/api.html)
|
94 |
|
95 | **[Playground](https://prettier.io/playground/)**
|
96 |
|
97 | ---
|
98 |
|
99 | ## Badge
|
100 |
|
101 | 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)
|
102 |
|
103 | ```md
|
104 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
|
105 | ```
|
106 |
|
107 | ## Contributing
|
108 |
|
109 | See [CONTRIBUTING.md](CONTRIBUTING.md).
|