Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup markdown formatting #3224

Merged
merged 17 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"proseWrap": false
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ before_script:
- if [ "${NODE_ENV}" = "production" ]; then yarn build; fi
script:
- yarn lint
- yarn lint-docs
- AST_COMPARE=1 yarn test -- --runInBand
- if [ "${NODE_ENV}" = "development" ]; then yarn codecov; fi
deploy:
Expand Down
95 changes: 48 additions & 47 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
* Fix website on iOS Safari (#1970)

Formatting change:

* Position JSX whitespace (`{" "}`) at the end of lines (#1964)

Lots of small fixes, mainly for TypeScript.
Expand Down Expand Up @@ -209,7 +210,7 @@ Lots of small fixes, mainly for TypeScript.
* Add space around `=` for flow generics default arguments (#1476)
* Don't break for unparenthesised single argument flow function (#1452)
* Don't break on empty arrays and objects (#1440)
* Do not break on [0] (#1441)
* Do not break on `[0]` (#1441)
* Reorder flow object props (#1451)
* Break inline object first in function arguments (#1453)
* Break inline object first in function arguments (#1453) (#1173)
Expand Down Expand Up @@ -308,7 +309,7 @@ Lots of small fixes, mainly for TypeScript.
* [JSX] Break if opening element breaks (#942)
* Parenthesize function expressions in expression position (#941)
* update the README to add a pre-commit hook (#944)
* Fix #951: properly parenthesize ** expressions (#952)
* Fix #951: properly parenthesize \** expressions (#952)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be formatted as \*\*, fixed in #3246.

* [WIP] TypeScript Parser (#915)
* Do not break long `describe` calls (#953)
* Recursively find leading comments inside ReturnStatements (#955)
Expand Down Expand Up @@ -578,50 +579,50 @@ Lots of small fixes, mainly for TypeScript.

Now using minor versions instead of patch versions for the releases.

* Swap quotes (#355)
* Drop jsesc (#357)
* Use a Symbol instead of the private dep (#359)
* Add parens for default export FunctionExpressions (#345)
* Fix export extension output (#361)
* Exit with an error if an unknown CLI option is passed (#365)
* Warn if using deprecated CLI options (#364)
* s/jscodefmt/prettier/ (#370)
* Fix CLI options (#369)
* Fix some parens cases for UpdateExpressions (#381)
* Output strings with the minimum amount of escaped quotes (#390)
* Ignore EmptyStatement inside of switch case (#391)
* Support multiple standalones in import (#389)
* Fix missing semi-colon in for loop and var body (#388)
* Fix empty labels (#383)
* Fix forced trailing comma (#382)
* Empty switch should not have an empty line (#384)
* add formatAST() for formatting ASTs directly (#393)
* Fix class extends parenthesis (#396)
* Fix class inside of binary expression missing parenthesis (#397)
* Fix parenthesis in object as left-hand-side of template (#398)
* Remove unneeded parens for FunctionExpression inside LogicalExpression (#399)
* Remove trailing comma for array destructuring with rest (#400)
* Fix +++x (#401)
* Also do the class extend parenthesis for class expressions (#403)
* Fix various parenthesis issues on the left side of template (#404)
* Fix in inside of the first group of a for (#406)
* Add parenthesis for arrow function inside of ternary (#408)
* Add parenthesis around class expression when left side of call expression (#409)
* Ensure computed method names don't lose quotes (#419)
* Add parenthesis for yield inside of a conditional (#418)
* Add parenthesis around assignment for arrow function body (#422)
* Add parenthesis around export default assignments (#423)
* Add parenthesis for class expression on left of member expression (#421)
* Fix missing parens around object in MemberExpression (#424)
* Re-run snapshot tests
* Workaround flow bug around trailing comma (#427)
* Add parenthesis when class expressions are left of a ternary (#428)
* Revert "Workaround flow bug around trailing comma" (#429)
* Update commands.md (#430)
* Improve vim integration section (#416)
* Add glob support to the CLI (#363)
* Use babel-code-frame for syntax errors (#367)
* Update yarn.lock
* Swap quotes (#355)
* Drop jsesc (#357)
* Use a Symbol instead of the private dep (#359)
* Add parens for default export FunctionExpressions (#345)
* Fix export extension output (#361)
* Exit with an error if an unknown CLI option is passed (#365)
* Warn if using deprecated CLI options (#364)
* s/jscodefmt/prettier/ (#370)
* Fix CLI options (#369)
* Fix some parens cases for UpdateExpressions (#381)
* Output strings with the minimum amount of escaped quotes (#390)
* Ignore EmptyStatement inside of switch case (#391)
* Support multiple standalones in import (#389)
* Fix missing semi-colon in for loop and var body (#388)
* Fix empty labels (#383)
* Fix forced trailing comma (#382)
* Empty switch should not have an empty line (#384)
* add formatAST() for formatting ASTs directly (#393)
* Fix class extends parenthesis (#396)
* Fix class inside of binary expression missing parenthesis (#397)
* Fix parenthesis in object as left-hand-side of template (#398)
* Remove unneeded parens for FunctionExpression inside LogicalExpression (#399)
* Remove trailing comma for array destructuring with rest (#400)
* Fix +++x (#401)
* Also do the class extend parenthesis for class expressions (#403)
* Fix various parenthesis issues on the left side of template (#404)
* Fix in inside of the first group of a for (#406)
* Add parenthesis for arrow function inside of ternary (#408)
* Add parenthesis around class expression when left side of call expression (#409)
* Ensure computed method names don't lose quotes (#419)
* Add parenthesis for yield inside of a conditional (#418)
* Add parenthesis around assignment for arrow function body (#422)
* Add parenthesis around export default assignments (#423)
* Add parenthesis for class expression on left of member expression (#421)
* Fix missing parens around object in MemberExpression (#424)
* Re-run snapshot tests
* Workaround flow bug around trailing comma (#427)
* Add parenthesis when class expressions are left of a ternary (#428)
* Revert "Workaround flow bug around trailing comma" (#429)
* Update commands.md (#430)
* Improve vim integration section (#416)
* Add glob support to the CLI (#363)
* Use babel-code-frame for syntax errors (#367)
* Update yarn.lock

# 0.0.10

Expand Down Expand Up @@ -744,7 +745,7 @@ Now using minor versions instead of patch versions for the releases.
* remove unused recast ref
* Fix typo in README.
* Support type annotation for rest argument on babylon parser
* Use `setq' instead of `infc' and `decf'
* Use `setq` instead of `infc` and `decf`
* Add title and encoding to the REPL
* Fix old name reference in tests_config
* Minimize string escapes
Expand Down
30 changes: 7 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,14 @@ yarn test
Here's what you need to know about the tests:

* The tests uses [Jest](https://facebook.github.io/jest/) snapshots.
* You can make changes and run `jest -u` (or `yarn test -u`) to update the
snapshots. Then run `git diff` to take a look at what changed. Always update
the snapshots when opening a PR.
* You can run `AST_COMPARE=1 jest` for a more robust test run. That formats each
file, re-parses it, and compares the new AST with the original one and makes
sure they are semantically equivalent.
* Each test folder has a `jsfmt.spec.js` that runs the tests. Normally you can
just put `run_spec(__dirname);` there. You can also pass options and
additional parsers, like this:
`run_spec(__dirname, { trailingComma: "es5" }, ["babylon"]);`
* `tests/flow/` contains the Flow test suite, and is not supposed to be edited
by hand. To update it, clone the Flow repo next to the Prettier repo and run:
`node scripts/sync-flow-tests.js ../flow/tests/`.
* If you would like to debug prettier locally, you can either debug it in node
or the browser. The easiest way to debug it in the browser is to run the
interactive `docs` REPL locally. The easiest way to debug it in node, is to
create a local test file and run it in an editor like VS Code.
* You can make changes and run `jest -u` (or `yarn test -u`) to update the snapshots. Then run `git diff` to take a look at what changed. Always update the snapshots when opening a PR.
* You can run `AST_COMPARE=1 jest` for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent.
* Each test folder has a `jsfmt.spec.js` that runs the tests. Normally you can just put `run_spec(__dirname);` there. You can also pass options and additional parsers, like this: `run_spec(__dirname, { trailingComma: "es5" }, ["babylon"]);`
* `tests/flow/` contains the Flow test suite, and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.js ../flow/tests/`.
* If you would like to debug prettier locally, you can either debug it in node or the browser. The easiest way to debug it in the browser is to run the interactive `docs` REPL locally. The easiest way to debug it in node, is to create a local test file and run it in an editor like VS Code.

Run `yarn lint --fix` to automatically format files.

If you can, take look at [commands.md](commands.md) and check out [Wadler's
paper](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) to
understand how Prettier works.
If you can, take look at [commands.md](commands.md) and check out [Wadler's paper](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) to understand how Prettier works.

If you want to know more about Prettier's GitHub labels, see the
[Issue Labels](https://github.com/prettier/prettier/wiki/Issue-Labels)
page on the Wiki.
If you want to know more about Prettier's GitHub labels, see the [Issue Labels](https://github.com/prettier/prettier/wiki/Issue-Labels) page on the Wiki.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@

## 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.
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 -->
```js
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
```
Expand All @@ -60,28 +59,25 @@ foo(
);
```

Prettier can be ran [in your editor](http://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 comment on a code review ever again!
Prettier can be ran [in your editor](http://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 comment on a code review ever again!

- - -
---

**[Documentation](https://prettier.io/docs/en/)**

<!-- prettier-ignore -->
[Install](https://prettier.io/docs/en/install.html) ·
[Options](https://prettier.io/docs/en/options.html) ·
[CLI](https://prettier.io/docs/en/cli.html) ·
[API](https://prettier.io/docs/en/api.html)

**[Playground](https://prettier.io/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)
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)

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