prettier с фиксом для поддержки скобок с новой строки
 
 
 
 
 
 
Go to file
Christopher Chedeau 43d03209d2
Update ?? precedence to match stage 3 proposal (#6404)
The spec was updated ( https://tc39.es/proposal-nullish-coalescing/ ) with the following two changes:
- ?? has lower precedence than ||. (previously equal)
- ?? cannot immediately contain, or be contained within, an && or || operation. (parens are now required)

The safe way to upgrade is to run prettier with just this change so that parenthesis are properly added. Then to upgrade the parser (only flow supports the new precendence in the next release, babel hasn't been updated yet) in prettier so that the new precedence is being used. Failure to do so will result in parse errors because of missing parenthesis so we will not have silent errors.

There was only 44 callsites mixing || and ?? in a confusing way in the Facebook codebase so it shouldn't be a huge deal in practice.
2019-08-20 14:26:21 -07:00
.azure-pipelines chore(azure): node v4 compatible yarn (#5766) 2019-01-18 21:40:35 +08:00
.github Update FUNDING.yml 2019-06-14 11:02:35 -03:00
bin refactor(cli): separate files and make it pure as possible (#2730) 2017-09-03 19:21:06 +10:00
docs include renames in git pre-commit hook (#6371) 2019-08-15 12:34:19 +03:00
scripts Fix `.eslintrc.yml` code style (#6388) 2019-08-12 18:23:13 +03:00
src Update ?? precedence to match stage 3 proposal (#6404) 2019-08-20 14:26:21 -07:00
tests Update ?? precedence to match stage 3 proposal (#6404) 2019-08-20 14:26:21 -07:00
tests_config fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
tests_integration Delete .config.json.swp (#6363) 2019-08-08 15:02:47 +03:00
website Update website/versioned_docs/version-stable/ 2019-08-12 19:17:55 +02:00
.codecov.yml Improve coverage and remove some dead code (#2504) 2017-07-17 23:31:42 +10:00
.eslintignore Introduce Release script (#4631) 2018-06-05 16:37:52 -03:00
.eslintrc.yml Fix `.eslintrc.yml` code style (#6388) 2019-08-12 18:23:13 +03:00
.flowconfig Build the dist/ with rollup (#1794) 2017-05-28 21:49:41 -07:00
.gitattributes fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
.gitignore chore: update azure pipelines (#5611) 2018-12-18 08:16:32 +08:00
.ignore fix: Adjacent JSX elements should be allowed in mdx (#6332) 2019-07-29 14:32:24 +03:00
.pre-commit-hooks.yaml docs(blog): 1.15 release (#5296) 2018-11-07 09:09:04 +08:00
.prettierignore Implement getSupportInfo() and use it for inference (#3033) 2017-11-03 18:06:25 +11:00
.prettierrc Add empty .prettierrc to project root (#6125) 2019-05-15 12:25:22 -03:00
.yarnrc chore(yarn): disable integrity migration 2018-10-27 21:01:26 +08:00
CHANGELOG.md Swap bases in changelog (#6251) 2019-07-01 08:24:41 +02:00
CHANGELOG.unreleased.md fix(mdx): text with whitespace after JSX trim incorrectly (#6340) 2019-08-14 13:45:59 +03:00
CODE_OF_CONDUCT.md Add a code of conduct (#5891) 2019-02-22 11:01:32 -05:00
CONTRIBUTING.md Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
LICENSE Update copyright line (#5455) 2019-01-03 07:21:32 -05:00
README.md chore: update azure pipelines (#5611) 2018-12-18 08:16:32 +08:00
azure-pipelines.yml chore: update azure pipelines (#5611) 2018-12-18 08:16:32 +08:00
commands.md Add a new `trim` command to trim whitespaces in the current line (#4772) 2018-10-06 20:18:52 +08:00
index.js refactor: move index.js and standalone.js to src (#5054) 2018-09-06 13:51:18 +08:00
jest.config.js chore: update azure pipelines (#5611) 2018-12-18 08:16:32 +08:00
package.json get-stream@4.1.0 update in package dependencies (#6372) 2019-08-09 16:42:02 +03:00
standalone.js refactor: move index.js and standalone.js to src (#5054) 2018-09-06 13:51:18 +08:00
yarn.lock get-stream@4.1.0 update in package dependencies (#6372) 2019-08-09 16:42:02 +03:00

README.md

Prettier Banner

Opinionated Code Formatter

JavaScript · TypeScript · Flow · JSX · JSON
CSS · SCSS · Less
HTML · Vue · Angular
GraphQL · Markdown · YAML
Your favorite language?

Azure Pipelines Build Status Codecov Coverage Status Blazing Fast
npm version weekly downloads from npm code style: prettier Chat on Gitter Follow Prettier on Twitter

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

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 Prettiercode style: 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.