|
|
|
@ -919,8 +919,8 @@ Prettier is an opinionated code formatter with support for:
|
|
|
|
|
* [GraphQL](http://graphql.org/)
|
|
|
|
|
|
|
|
|
|
It removes all original styling[\\*](#styling-footnote) and ensures that all
|
|
|
|
|
outputted code conforms to a consistent style. (See this [blog
|
|
|
|
|
post](http://jlongster.com/A-Prettier-Formatter))
|
|
|
|
|
outputted code conforms to a consistent style. (See this
|
|
|
|
|
[blog post](http://jlongster.com/A-Prettier-Formatter))
|
|
|
|
|
|
|
|
|
|
<details>
|
|
|
|
|
<summary><strong>Table of Contents</strong></summary>
|
|
|
|
@ -931,15 +931,13 @@ post](http://jlongster.com/A-Prettier-Formatter))
|
|
|
|
|
|
|
|
|
|
* [What does Prettier do?](#what-does-prettier-do)
|
|
|
|
|
* [Why Prettier?](#why-prettier)
|
|
|
|
|
* [Building and enforcing a style
|
|
|
|
|
guide](#building-and-enforcing-a-style-guide)
|
|
|
|
|
* [Building and enforcing a style guide](#building-and-enforcing-a-style-guide)
|
|
|
|
|
* [Helping Newcomers](#helping-newcomers)
|
|
|
|
|
* [Writing code](#writing-code)
|
|
|
|
|
* [Easy to adopt](#easy-to-adopt)
|
|
|
|
|
* [Clean up an existing codebase](#clean-up-an-existing-codebase)
|
|
|
|
|
* [Ride the hype train](#ride-the-hype-train)
|
|
|
|
|
* [How does it compare to ESLint (or TSLint,
|
|
|
|
|
stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint)
|
|
|
|
|
* [How does it compare to ESLint (or TSLint, stylelint...)?](#how-does-it-compare-to-eslint-or-tslint-stylelint)
|
|
|
|
|
* [Usage](#usage)
|
|
|
|
|
* [CLI](#cli)
|
|
|
|
|
* [ESLint](#eslint)
|
|
|
|
@ -969,8 +967,7 @@ post](http://jlongster.com/A-Prettier-Formatter))
|
|
|
|
|
* [Visual Studio Code](#visual-studio-code)
|
|
|
|
|
* [Visual Studio](#visual-studio)
|
|
|
|
|
* [Sublime Text](#sublime-text)
|
|
|
|
|
* [JetBrains WebStorm, PHPStorm,
|
|
|
|
|
PyCharm...](#jetbrains-webstorm-phpstorm-pycharm)
|
|
|
|
|
* [JetBrains WebStorm, PHPStorm, PyCharm...](#jetbrains-webstorm-phpstorm-pycharm)
|
|
|
|
|
* [Language Support](#language-support)
|
|
|
|
|
* [Related Projects](#related-projects)
|
|
|
|
|
* [Technical Details](#technical-details)
|
|
|
|
@ -1220,9 +1217,8 @@ prettier --single-quote --trailing-comma es5 --write "{app,__{tests,mocks}__}/**
|
|
|
|
|
\`\`\`
|
|
|
|
|
|
|
|
|
|
Don't forget the quotes around the globs! The quotes make sure that Prettier
|
|
|
|
|
expands the globs rather than your shell, for cross-platform usage. The [glob
|
|
|
|
|
syntax from the glob
|
|
|
|
|
module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer)
|
|
|
|
|
expands the globs rather than your shell, for cross-platform usage. The
|
|
|
|
|
[glob syntax from the glob module](https://github.com/isaacs/node-glob/blob/master/README.md#glob-primer)
|
|
|
|
|
is used.
|
|
|
|
|
|
|
|
|
|
#### \`--debug-check\`
|
|
|
|
@ -1780,8 +1776,8 @@ parser: flow
|
|
|
|
|
|
|
|
|
|
### Configuration Overrides
|
|
|
|
|
|
|
|
|
|
Prettier borrows eslint's [override
|
|
|
|
|
format](http://eslint.org/docs/user-guide/configuring#example-configuration).
|
|
|
|
|
Prettier borrows eslint's
|
|
|
|
|
[override format](http://eslint.org/docs/user-guide/configuring#example-configuration).
|
|
|
|
|
This allows you to apply configuration to specific files.
|
|
|
|
|
|
|
|
|
|
JSON:
|
|
|
|
@ -1845,8 +1841,8 @@ Atom users can simply install the
|
|
|
|
|
|
|
|
|
|
### Emacs
|
|
|
|
|
|
|
|
|
|
Emacs users should see [this
|
|
|
|
|
repository](https://github.com/prettier/prettier-emacs) for on-demand
|
|
|
|
|
Emacs users should see
|
|
|
|
|
[this repository](https://github.com/prettier/prettier-emacs) for on-demand
|
|
|
|
|
formatting.
|
|
|
|
|
|
|
|
|
|
### Vim
|
|
|
|
@ -1855,8 +1851,8 @@ Vim users can simply install either
|
|
|
|
|
[sbdchd](https://github.com/sbdchd)/[neoformat](https://github.com/sbdchd/neoformat),
|
|
|
|
|
[w0rp](https://github.com/w0rp)/[ale](https://github.com/w0rp/ale), or
|
|
|
|
|
[prettier](https://github.com/prettier)/[vim-prettier](https://github.com/prettier/vim-prettier),
|
|
|
|
|
for more details see [this
|
|
|
|
|
directory](https://github.com/prettier/prettier/tree/master/editors/vim).
|
|
|
|
|
for more details see
|
|
|
|
|
[this directory](https://github.com/prettier/prettier/tree/master/editors/vim).
|
|
|
|
|
|
|
|
|
|
### Visual Studio Code
|
|
|
|
|
|
|
|
|
@ -1865,13 +1861,12 @@ formatter\`.
|
|
|
|
|
|
|
|
|
|
Can also be installed using \`ext install prettier-vscode\`.
|
|
|
|
|
|
|
|
|
|
[Check its repository for configuration and
|
|
|
|
|
shortcuts](https://github.com/prettier/prettier-vscode)
|
|
|
|
|
[Check its repository for configuration and shortcuts](https://github.com/prettier/prettier-vscode)
|
|
|
|
|
|
|
|
|
|
### Visual Studio
|
|
|
|
|
|
|
|
|
|
Install the [JavaScript Prettier
|
|
|
|
|
extension](https://github.com/madskristensen/JavaScriptPrettier).
|
|
|
|
|
Install the
|
|
|
|
|
[JavaScript Prettier extension](https://github.com/madskristensen/JavaScriptPrettier).
|
|
|
|
|
|
|
|
|
|
### Sublime Text
|
|
|
|
|
|
|
|
|
@ -1880,8 +1875,8 @@ Sublime Text support is available through Package Control and the
|
|
|
|
|
|
|
|
|
|
### JetBrains WebStorm, PHPStorm, PyCharm...
|
|
|
|
|
|
|
|
|
|
See the [WebStorm
|
|
|
|
|
guide](https://github.com/jlongster/prettier/tree/master/editors/webstorm/README.md).
|
|
|
|
|
See the
|
|
|
|
|
[WebStorm guide](https://github.com/jlongster/prettier/tree/master/editors/webstorm/README.md).
|
|
|
|
|
|
|
|
|
|
## Language Support
|
|
|
|
|
|
|
|
|
@ -1933,8 +1928,8 @@ ability to have leading \`|\` for type definitions which prettier outputs.
|
|
|
|
|
* [\`markdown-magic-prettier\`](https://github.com/camacho/markdown-magic-prettier)
|
|
|
|
|
allows you to use Prettier to format JS
|
|
|
|
|
[codeblocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/)
|
|
|
|
|
in Markdown files via [Markdown
|
|
|
|
|
Magic](https://github.com/DavidWells/markdown-magic)
|
|
|
|
|
in Markdown files via
|
|
|
|
|
[Markdown Magic](https://github.com/DavidWells/markdown-magic)
|
|
|
|
|
* [\`tslint-plugin-prettier\`](https://github.com/ikatyang/tslint-plugin-prettier)
|
|
|
|
|
runs Prettier as a TSLint rule and reports differences as individual TSLint
|
|
|
|
|
issues
|
|
|
|
@ -1944,8 +1939,8 @@ ability to have leading \`|\` for type definitions which prettier outputs.
|
|
|
|
|
## Technical Details
|
|
|
|
|
|
|
|
|
|
This printer is a fork of [recast](https://github.com/benjamn/recast)'s printer
|
|
|
|
|
with its algorithm replaced by the one described by Wadler in "[A prettier
|
|
|
|
|
printer](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf)".
|
|
|
|
|
with its algorithm replaced by the one described by Wadler in
|
|
|
|
|
"[A prettier printer](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf)".
|
|
|
|
|
There still may be leftover code from recast that needs to be cleaned up.
|
|
|
|
|
|
|
|
|
|
The basic idea is that the printer takes an AST and returns an intermediate
|
|
|
|
@ -2179,8 +2174,7 @@ This paragraph has some \`code\` in it.
|
|
|
|
|
|
|
|
|
|
![Alt Text](http://placehold.it/200x50 "Image Title")
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
[View raw
|
|
|
|
|
(TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md)
|
|
|
|
|
[View raw (TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md)
|
|
|
|
|
|
|
|
|
|
This is a paragraph.
|
|
|
|
|
|
|
|
|
|