Ika
99c4e41fa1
feat: format yaml front matter ( #4773 )
...
* refactor: front-matter
* feat: format yaml front matter
2018-07-03 09:54:40 +08:00
Lucas Duailibe
6a6e8cada0
Fix benchmark require ( #4792 )
2018-07-02 13:17:08 -03:00
Ika
e9f489cea1
refactor(debug-repeat): use built-in int type ( #4791 )
2018-07-02 16:01:05 +08:00
Ivan Babak
b9fb113b3b
feat(benchmark): add options to measure performance ( #4776 ) ( #4789 )
...
- `--debug-benchmark` uses `benchmark` module to produce statistically significant time measurements.
- `--debug-repeat` uses a naive loop and measures just the average run time, but useful for profiling to highlight hot functions.
2018-07-01 19:49:16 -07:00
Ivan Babak
95cc2c97b5
fix(perf): shortcut getStringWidth for ASCII-only strings ( #4776 ) ( #4790 )
2018-07-01 19:47:55 -07:00
Alexander Kachkaev
a05fd118be
Do not require space after markdown block language name ( #4783 )
...
https://github.com/prettier/prettier/pull/4153 made it possible to detect fenced code block language when it is followed by arguments (e.g. ` ```js {something=something} `). This PR makes it also possible to detect language in cases cases like ` ```js{something=something} ` (no space).
The reason for this change is that Atom highlights code blocks regardless of a space after the language name, which makes users wonder why the correctly detected code block is not being formatted:
<img width="324" alt="screen shot 2018-06-28 at 22 08 13" src="https://user-images.githubusercontent.com/608862/42060780-db11f5b6-7b1f-11e8-9f43-fe91843f7d89.png ">
PR background: https://github.com/prettier/prettier/pull/4153#issuecomment-401174999
2018-07-02 08:22:56 +08:00
Ika
9bb8edf96a
feat: support .js.flow ( #4777 )
...
* feat: support .js.flow
* feat: add Flow language entry
2018-07-01 16:18:08 +08:00
Ika
61d5eeadd3
fix(javascript): add parens for await in bind ( #4778 )
2018-06-30 23:15:45 +08:00
Ika
50d242d085
feat(typescript): support TSOptionalType and TSRestType ( #4757 )
...
Ref: Microsoft/TypeScript#24897
2018-06-30 09:10:56 +08:00
Ika
e10c31a333
fix(typescript): update typescript-eslint-parser ( #4762 )
2018-06-29 19:27:21 +08:00
Lucas Duailibe
576e570711
Fix custom require's ( #4766 )
2018-06-28 15:56:25 -03:00
Ika
0b659b898d
feat: update linguist languages ( #4741 )
...
Context: https://github.com/prettier/prettier/pull/4734#issue-196702272
Languages should be easy to maintain now.
2018-06-28 08:24:02 +08:00
Ika
b67fa907bd
fix(markdown): preserve email autolink ( #4740 )
...
```diff
<hello@example.com >
<mailto:hello@example.com >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-<mailto:hello@example.com >
+<hello@example.com >
<mailto:hello@example.com >
```
2018-06-27 08:36:51 +08:00
Warren Seine
6c482e2e6c
Expose isPreviousLineEmpty to plugins ( #4747 ). ( #4748 )
2018-06-25 23:20:00 -06:00
Karl O'Keeffe
7a3ac3a693
Handle JSX whitespace separately from fbt whitespace ( #4717 )
...
* Hande JSX whitespace separately from fbt whitespace
* Extra test cases
* Further tweak to JSX handling
* Possible improvement of single character text
* More tests
* Pull out separator code
* More tests for fbt
2018-06-25 19:11:40 +01:00
Evilebot Tnawi
aa4ea034b3
refactor: some stuff ( #4703 )
2018-06-25 12:57:41 +03:00
Ika
f51acf22fe
feat(vue): support pragma ( #4713 )
2018-06-25 10:44:00 +08:00
Ika
c38e6af301
fix(yaml): add missing since field ( #4739 )
2018-06-23 17:04:47 +08:00
Suchipi
cb5e1db4a5
Revert "Ternary Operators in JSX Expression Containers ( #4731 )" ( #4736 )
...
This reverts commit 12046cd01b .
2018-06-22 10:32:38 -06:00
tyrerexus
12046cd01b
Ternary Operators in JSX Expression Containers ( #4731 )
...
This pull request aims to fix the issue of excessive nesting brought up in the following comment: https://github.com/prettier/prettier/issues/737#issuecomment-392541493
This "fix" is very simple. It adds a new possible way to activate JSX mode for ternary operators. If the first non-conditional parent of the expression is a JSX expression container, then JSX mode gets activated.
This branch also contains a test case for said scenario.
2018-06-22 10:30:53 -06:00
Ika
f53b5b8323
fix(options): inferParser for standalone ( #4721 )
2018-06-22 12:43:44 +08:00
Ika
dcf44ffbdc
feat: support YAML ( #4563 )
...
* feat: support YAML
* fix: do not indent sequence in mappingValue
* docs: add yaml to index.md
* fix: reduce `SyntaxError: Node#parse consumed no characters`
* chore: remove old-build and new-worker.js
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* fix: no space after `<<`
* fix: add yaml to standalone test
* test: add tests
* fix: next empty line in flow collection
* fix: tabs are not allowed
http://yaml.org/spec/1.2/spec.html#space/indentation/
* fix: update parser
* feat: rewrite the mappingItem logic
* feat: indent sequence in mapping
* feat(doc): add ifBreak#groupId and group#id
* chore: fix node 4
* chore: add tools_yaml.svg
* chore: remove resolved TODO
* refactor: remove unnecessary workaround
* chore(worker): importScriptOnce
* chore(build): rename with babelPlugins
* make it rollup compatible
* feat: support singleQuote
* refactor
2018-06-21 10:29:42 +08:00
Anthony Sottile
5d5c97a17f
Fix prettier installed in a directory not named prettier ( #4706 )
2018-06-18 13:29:54 -03:00
Ika
b99de9811b
feat(graphql): support pragma ( #4699 )
2018-06-17 14:04:48 +08:00
Ika
4109abf4dd
feat(javascript): support BigIntLiteral ( #4697 )
2018-06-16 00:20:04 +08:00
Evilebot Tnawi
03a2002348
fix: newline between front-matter and comment ( #4701 )
2018-06-15 16:27:41 +03:00
Vojtěch Štěpančík
56af3d621d
Add support for parsing babylons throwExpressions ( #4695 )
2018-06-14 21:35:39 -03:00
Ika
18aa527adc
feat(api): support relative paths for plugin(SearchDir)s in config files ( #4667 )
...
* feat(api): support relative paths for plugin(SearchDir)s in config files
* fix: convince appveyor
2018-06-15 04:25:03 +08:00
Ika
f6890bd071
feat(css): support pragma ( #4688 )
2018-06-14 09:51:18 +08:00
Joseph Frazier
88be12ca07
Allow originalText to be passed to formatAST() ( #4677 )
...
This allows `prettier.__debug.formatAST` to not crash when given the AST
for the below code (taken from https://astexplorer.net/ ), which is
useful when trying to use Prettier as a code generator for an AST
without corresponding source code (https://github.com/prettier/prettier/issues/4675 )
```js
let tips = [
"Click on any AST node with a '+' to expand it",
"Hovering over a node highlights the \
corresponding part in the source code",
"Shift click on an AST node expands the whole substree"
];
function printTips() {
tips.forEach((tip, i) => console.log(`Tip ${i}:` + tip));
}
```
2018-06-13 12:30:14 -04:00
Tony Trinh
dcc060a5a5
refactor: remove redundant call to normalizeOptions ( #4671 )
...
Removes redundant call to `normalizeOptions` (already done in preceding line)
https://github.com/prettier/prettier/blob/8ec543276838f66f0a84824a39c215a3039e9071/src/main/core.js#L260-L263
2018-06-12 10:56:16 +08:00
Ika
5646573ad7
fix(javascript): preserve parens for type casting for sub-item ( #4648 )
2018-06-11 19:50:53 +08:00
Lynn Smeria
61d35dd636
fix(typescript): preserve type parameters of import-types ( #4656 ) ( #4662 )
2018-06-11 11:29:10 +10:00
Brian Ng
3e0dceda99
flow-parser@0.74.0 ( #4649 )
2018-06-09 17:03:50 -05:00
Ika
98bfd03d93
feat(typescript): support unknown type ( #4625 )
2018-06-10 00:12:30 +08:00
Lucas Duailibe
d013983d8a
Always expand first argument if the second argument is also a call expression ( #4657 )
2018-06-08 15:16:12 -03:00
Lucas Duailibe
cb1c52ad08
Break JSX in arrow functions in JSX expressions ( #4601 )
2018-06-08 15:15:50 -03:00
Ika
35a42bef24
fix(markdown): better handling for trailing spaces ( #4593 )
...
- preserve trailing spaces in html, excluding html comment
- `doc-printer` is now unrelated to `options.parser`
- fix some cases that two trailing spaces are mis-considered as `break`
2018-06-08 00:20:25 +08:00
Ika
fb74dc54c3
feat(api): make getFileInfo() really async ( #4640 )
2018-06-07 00:34:02 +08:00
Aakansha Doshi
8ec5432768
Fix empty file error in json and graphql ( #4553 )
...
* Fix empty file error in json and graphql
* fix AST_COMPARE=1 issue
* use tests/empty
* revert
* fix lint
2018-06-06 10:41:12 -03:00
Lucas Duailibe
a4da6e6c8e
Inline _ or $ in the root of a method chain ( #4621 )
2018-06-01 12:51:06 -03:00
Ika
b55997eb3d
fix(multiparser): no additional trailing newline for graphql in js ( #4616 )
...
Fixes #4615
The root cause is the output doc from graphql printer does not match the desired input from `stripTrailingHardline`.
https://github.com/prettier/prettier/blob/a9b21a01e2d352aab06332e8e545e33efacc4f97/src/doc/doc-utils.js#L167-L180
2018-06-01 00:38:39 +08:00
Ika
e74e6565b4
fix(markdown): respect blank line between block htmls ( #4609 )
...
Fixes #4605
The AST here is actually two `html`s and it did follow the [CommonMark spec](https://spec.commonmark.org/0.28/#html-blocks ), so I ended up with respecting the blank line between block `html`s.
2018-06-01 00:33:37 +08:00
Evilebot Tnawi
9387e9d833
fix: comment type for scss ( #4598 )
2018-05-30 23:22:18 +03:00
Ika
75e86b9e6b
fix(cli): no regression for --debug-check + --list-different ( #4600 )
2018-05-31 00:42:26 +08:00
Ika
8abbc5d4b0
fix(javascript): regression for hasOwnProperty ( #4603 )
2018-05-31 00:39:39 +08:00
Jimmy Jia
dc5de053c4
fix: comment around color adjusters ( #4595 )
2018-05-29 21:03:09 +03:00
Evilebot Tnawi
3d60871458
fix: output color adjusters ( #4494 )
2018-05-29 15:24:38 +03:00
Lucas Duailibe
1350edc5a6
Revert no parser error for API ( #4587 )
...
* Revert no parser error for API
* use warn
2018-05-28 23:43:44 -06:00
Lucas Duailibe
b8ded70848
Handle comments in assignments before template literals ( #4580 )
...
Closes #4560
2018-05-29 00:08:18 +10:00