Commit Graph

152 Commits (952bc0cc039c034c5fe651864db528dcd9800e9e)

Author SHA1 Message Date
Ika 952bc0cc03
fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika 3cd1d003c0
fix(typescript): do not throw errors on bigint keyword (#5577)
- fix `Error: unknown type: "TSBigIntKeyword"`
- bump typescript to stable version
2018-11-30 10:12:32 +08:00
Ika 0534735c2f
fix(vue): tweak semicolon for single expression in event bindings (#5519) 2018-11-29 09:28:35 +08:00
Christopher Chedeau 0af81c7695
Improve union types with leading comments (#5575)
We're running into this issue at Facebook because `// flowfixme` ignores the very next line, but in this case an empty line is added in-between which breaks the fixme.

Ideally the solution is to avoid adding a newline and we'd call it a day. Unfortunately it is tricky to implement in this particular case. The comment is already printed, including its \n. Yet, we want to indent the block and the only way to convince the doc printer to do so is to add an indent group --before-- the \n is printed, otherwise it's just going to indent on the next \n.

So this PR changes the output from one bad way to another, but the new way has the benefit of not breaking flow for Facebook, which makes our internal teams happier.

Note that the way we print the same construct with `&` is broken in the same way as with this PR. https://prettier.io/playground/#N4Igxg9gdgLgprEAuc0DOMAEBbAngNQEMAbAVzkwF5MAKME4+4xhpl5tmgDgHYA2LgE5+g3gP5CRY6cL6iJE2fL4BKJAB0ombTt17tAegOYAwhGzYEMTftu7oFAGSYYAdwjOYACwBOTzABWACYA1gAeXgBmxCFowVEA5jEBaEGJyV6pIdEBCZkhQQGJIcQpXkGRCSFFWaWRXlWlaOWVwZElCUUlAZgqANwgADQgEAAOMACW6MighD4+EK4ACnMIaMgghABuEBNBQyAARj6EYCFwMADKo6cTUAnIMD7kw14w2MQA6l4T8Gg3YDglzWvwmW1+uA2YDQ62GdzQcB8MCWJwS2EIyEiJARwxSYQAQiczhdLoRLAAZO5wTHYuC4tBhS53JJwACKpAg8BpxBxIBuPgRPg2h0Ih1wxGgB1GPjuME+e28yC4AAZhtKIAjPidRhtpXBBVtqcM-ABHUgTPwowhojFILE8ukgBHYCaPZ6OtDM4hsjlcu204YwUXyoKKpAAJkDJwmxGZZgstpAUAcB1ICIAKqL1v6HQBfXNAA

Fixes #5572
2018-11-28 10:30:51 -08:00
Ika 05ad885c3c
feat(typescript): support BigInt (#5546) 2018-11-27 16:53:34 +08:00
Ika 3a5bbf5fd2
fix(typescript): do not change `module` into `namespace` and break/hug their body correctly (#5551) 2018-11-26 13:34:35 +08:00
Ika 66ada24961
feat(angular): do not print colon for ngIf (#5542) 2018-11-25 15:43:40 +08:00
Ika 5c479cc55f
fix(typescript): do not add invalid semi for construct in interface with prettier-ignore (#5469) 2018-11-14 21:35:37 +08:00
Ika 57b057cfa2
fix(typescript): inline method decorators should stay inlined (#5444) 2018-11-14 10:13:35 +08:00
Ika 6cedf7d5d9
fix(flow,ts): consistent interface and remove unnecessary indent for extends (#5432) 2018-11-11 00:15:18 +08:00
Ika 8b1260a770
fix(javascript): inline property decorator should stay inline (part 2) (#5423) 2018-11-10 16:44:33 +08:00
Adrian 6dcc7ed575 fix(javascript): handle createSelector as function composition (#5430)
fixes #5285
2018-11-09 17:55:57 -07:00
Ika 469a831619
fix(mdx): treat jsx codeblock same as in markdown (#5391) 2018-11-09 09:47:05 +08:00
Ika fd8ec95e0a
fix(javascript): do not apply test call formatting to arrow without body (#5366) 2018-11-08 14:00:42 +08:00
Ika 4b51907b87
fix(javascript): inline property decorator should stay inline (#5364)
Fixes the `@action` part in #5360
2018-11-07 17:21:03 +08:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Ika a4e8aaf7a1
fix(jsx): do not move trailing char to the next line as leading char (#5354) 2018-11-07 07:41:34 +08:00
Ika 40f46740f6
fix(jsx): consistent quotes in JSX expression (#5349) 2018-11-06 15:38:50 +08:00
Ika b6691ba615
fix(javascript): no regression for jsx in arrow function in jsx (#5343) 2018-11-06 15:38:30 +08:00
Ika 02f9802119
fix(javascript): no regression for ternary#test alignment (#5333) 2018-11-05 17:07:57 +08:00
Stefan Mirea e17512adcd Add an option to print single quotes in JSX (#4798)
* feat(option-singleQuote-jsx): Added jsSingleQuote

* feat(option-singleQuote-jsx): Refactored to use a simple jsxSingleQuote flag

* feat(option-singleQuote-jsx): Fixed borked rebase

* feat(option-singleQuote-jsx): Updated snapshots

* feat(option-singleQuote-jsx): Resolved pending comments

* feat(option-singleQuote-jsx): Removed assert

* Fixed merge conflicts

* Updated snapshots after merge conflicts
2018-11-04 16:36:00 -05:00
Ika 5e8a4a115a
feat: support HTML/Vue/Angular (#5259) 2018-11-04 23:03:07 +08:00
Simon Lydell 275b0543c8
Never put spaces to the right of stars in indentable block comments (#5330)
Fixes #5323. Previously we added space after `/*` _on the first line
only,_ but the intent is to only fix the indentation of comments, not
changing their "contents". Besides, this was inconsistent with the
handling of every following line. Finally, it broke `/*!` comments which
some minifiers look for to know which (license) comments to keep.

People can use https://eslint.org/docs/rules/spaced-comment to enforce
when to start comments with spaces.
2018-11-03 20:53:24 +01:00
Jordan Brown b861448dbf Pretty print inexact (#5304) 2018-10-26 21:05:42 +03:00
Aquib Master 1234ceb1d6 Fix flow extends not breaking out into new lines (#5244) 2018-10-25 10:49:53 -04:00
Ashwin Bhat 253716dd49 Fix Flow generic comment positioning (#5290)
* add test for ensuring that calls with zero arguments look right
2018-10-25 08:44:16 -04:00
Jed Fox 6a174654a4 Fix indentation of block comments where every line starts with a star (#5206)
Previously this was done only for JSDoc comments. Now it's done in a few additional cases.
2018-10-23 21:04:24 +02:00
Ashwin Bhat 4d4fab39fe Add support for flow typecast comments (#5280)
* Add support for flow typecast comments

* Allow whitespace between comment start and colon

Also rename flow-comments.js to utils.js

* fix bug where type annotations could be accidentally created

* use better regex in detecting flow comment whitespace

* fix comment in utils.js

* simplify conditionals and improve comments

* fix lint error
2018-10-23 10:46:20 -04:00
Lucas Duailibe 62e4654e60
Respect original text decorator order (#5207) 2018-10-17 14:14:59 -03:00
Lucas Duailibe 00004daf84
Break nested TSConditionalType (#5272) 2018-10-15 13:35:37 -03:00
Suchipi 0fa34b2c63 Print nested ternaries differently (#5039) 2018-10-14 12:45:37 -03:00
Lucas Duailibe c7093cb3e4
Add ASI protection for TSNonNullExpression (#5262) 2018-10-13 20:03:51 -03:00
Jed Fox 65b2454dd8
Improved object-break heuristic (#5205) 2018-10-12 12:45:30 -04:00
Lucas Duailibe ed6a2d9055
Prevent JSX from breaking a logical expression chain (#5092) 2018-10-10 14:11:37 -03:00
Lucas Duailibe b5fd382fe8
Inline the arguments of an arrow function in the body is conditional expression (#5209) 2018-10-08 19:28:58 -03:00
Lucas Duailibe ce952fc8c1
Fix printing of catch clause with a comment (#5202) 2018-10-08 14:18:30 -03:00
Lucas Duailibe 303f344bff
Keep decorators inline if they were written inline (#5188) 2018-10-08 11:00:43 -03:00
Lucas Duailibe 31c92a7237
Fix comment in variable declarator (#5190) 2018-10-05 08:40:16 -03:00
Brian Ng 2283efb437
Fix parens around ternary inside OptionalMemberExpression (#5179) 2018-10-02 20:45:15 -05:00
Onur Temizkan cc83a27a3e fix(typescript) Do not add extra semicolon to TSMethodSignature when prettier-ignore is used (#5140) (#5160) 2018-09-29 06:13:17 -04:00
Toru Kobayashi 3e05f210bb fix(js): quote property name as es5 compatible (#5157) 2018-09-28 13:51:34 -03:00
Onur Temizkan d7e96adac0 fix(js) Break args when second arg is a ternary (#5046) (#5151) 2018-09-27 16:50:33 -04:00
James Henry 81cf08118e
Drop-in replacement: typescript-estree for typescript-eslint-parser (#5139) 2018-09-25 15:44:21 -04:00
Jed Fox 59720392c3
Add support for timeouts passed as integers to test functions (#5085)
* Add support for timeouts passed as integers to test functions

* ;
2018-09-13 06:08:47 -04:00
Ika f7a6625d84
fix(typescript): no-semi for class props with modifiers (#5083) 2018-09-13 11:14:21 +08:00
Lucas Duailibe b020a5606f
Keep simple JSXOpeningTag's unbroken (#5078) 2018-09-11 11:15:50 -03:00
Ika 4d488e8b81
fix: no false positive for arrow function in jsx expression (#5063) 2018-09-07 09:39:59 +08:00
Lucas Duailibe 87376f93f3
Inline Generics with a single identifier (#5066) 2018-09-06 14:44:21 -03:00
Ika 50c9115632
feat: add printer.preprocess (#5041)
Sometimes we need to transform the ast to make it easier to print, but it's currently done in the parser (markdown and yaml), which leads the output ast harder to use for external users (custom parser), adding `printer.preprocess` can solve this issue.

And also this way we could move the trailing newline for json from `ast-to-doc.js` to `language-js`.
2018-09-03 23:27:50 +08:00
Eric Sakmar 6288704c41 format jest calls like regular calls (#5011) 2018-09-03 10:15:23 -03:00