James Henry
5feb76f13f
Update tsep to v11 and update snapshot ( #3471 )
...
* Update tsep to v11 and update snapshot
* Remove unneeded TSNamespaceFunctionDeclaration
2017-12-14 17:44:59 +11:00
Lucas Duailibe
7c83ac782e
Regression test for #1473
2017-12-12 01:30:20 -02:00
Lucas Duailibe
694f9c8588
Print comment after arrow function params ( #3444 )
2017-12-12 01:26:41 -02:00
Lucas Duailibe
d00d09bb87
Don't break single argument destructuring arguments ( #3443 )
2017-12-10 12:29:09 -02:00
Brian Ng
38c8286907
Fix closing parens on multi-line intersection/union type ( #3436 )
2017-12-10 22:32:17 +11:00
Lucas Duailibe
3fa2229a62
Fix printing union types inside a function param type ( #3446 )
...
* Fix printing union types inside a function param type
* fix alignment
2017-12-10 20:22:13 +11:00
Lucas Duailibe
dbf22eb41a
Fix printing separator in objects with prettier-ignore ( #3448 )
2017-12-10 02:57:42 -02:00
Lucas Duailibe
69f05e42c9
Consider TSNonNullExpression part of member chain ( #3442 )
2017-12-10 02:41:53 -02:00
Lucas Duailibe
934e4d3027
Fix babylon misplacing comments ( #3441 )
...
* Fix comments in class method args
* Fix comments in obj property
2017-12-09 15:43:19 -02:00
Lucas Duailibe
69f6ee7829
Only prevent lone `get` and `set` if property has no value ( #3434 )
2017-12-07 11:03:55 -02:00
Lucas Duailibe
90e8b13e86
Ignore whitespace in docblock right after /** ( #3430 )
2017-12-07 03:28:29 -02:00
Lucas Duailibe
7cff189dd8
Print trailing comma when last arg is arrow ( #3428 )
2017-12-07 02:48:11 -02:00
Lucas Azzola
829616dd6c
Fix multiparser trailing comma regression ( #3405 )
...
* Fix multiparser trailing comma regression
* Refactor trailing comma application
2017-12-05 19:01:00 +01:00
Ika
e09359d242
fix(doc-printer): no wrong function call ( #3401 )
2017-12-05 20:09:36 +08:00
Lucas Duailibe
66c9315d13
Don't default print comments for JSXFragments ( #3398 )
2017-12-05 08:41:45 -02:00
Ika
1122701053
fix(doc-printer): respect indent/align order ( #3383 )
2017-12-05 08:59:27 +11:00
Kevin Gibbons
8e377a1e56
Add support for flow mixins when using babylon ( #3391 )
2017-12-05 08:58:14 +11:00
Lucas Duailibe
ceabc48e01
Format CSS prop for emotion ( #3381 )
2017-12-03 03:25:17 -03:00
Ika
c1623d88e6
feat(markdown): preserve `break` style ( #3325 )
2017-12-03 15:02:13 +11:00
Lucas Azzola
8524ed5b6f
Fix printing of comments around decorators and class properties ( #3382 )
2017-12-03 14:59:35 +11:00
Lucas Duailibe
a9be90c5d4
Format CSS prop for emotion
2017-12-02 22:50:07 -03:00
Simon Lydell
d80728b5ff
Support toplevel interpolations in graphql tags ( #3370 )
...
* Refactor multiparser
* Add support for toplevel interpolations in graphql tags
* Update snapshots
* Fix JSX-in-markdown special-case
2017-12-03 12:31:23 +11:00
Ika
073c0b16d8
feat(markdown): add `proseWrap: "preserve"` option ( #3340 )
...
* test: add test case
* feat(markdown): add `proseWrap: "preserve"` option
* test: add tests
* docs(options): update `proseWrap`
* feat(markdown): change default to `proseWrap: "preserve"`
BREAKING CHANGE
* docs(options): update `proseWrap`
* test: specify option explicitly
* Fix lint after merge
* Fix error after merge
2017-12-02 09:48:40 +11:00
Brian Ng
d52d721cd1
Bump babylon to 7.0.0-beta.33 ( #3372 )
2017-12-02 09:39:10 +11:00
Lucas Duailibe
f119d4a90f
Change run_spec to have explicit parser list ( #3356 )
2017-11-30 03:31:52 -03:00
Lucas Duailibe
b2cca7eacc
Add support for JSX fragments ( #3237 )
2017-11-30 00:09:45 -03:00
Ika
7670024292
fix(markdown): do not break before special prefix ( #3347 )
2017-11-30 08:43:22 +11:00
Ika
fbbfa52517
fix(markdown): do not print linebreaks in heading ( #3343 )
2017-11-29 22:13:38 +11:00
Alex Rattray
606c5abbfc
Merge pull request #3324 from suchipi/arrow_parens
...
Simple arrow function parens option
2017-11-28 10:23:56 -05:00
Jacky Ho
a02e3b3464
Fix format of comment in paren of call expression in arrow expression ( #3334 )
2017-11-28 21:58:39 +11:00
Suchipi Izumi
6abdd2c6b7
PR feedback
2017-11-27 22:27:34 -07:00
Stephen Scott
a6c12ca7a9
Inline type parameters in test callback
2017-11-27 22:27:34 -07:00
Stephen Scott
e4eb8a4065
Add implementation for arrow parens option
...
Based on https://github.com/prettier/prettier/pull/2676
* Thread `path` and `options` through helpers so we don't need to add `needsParens` onto the AST node anymore (mutation)
* Pull test call detection logic out into helper method so it can be re-used for arrow function parens
* Add arrow function parens option implementation (avoid/always)
* Don't break arrow function parens around (done) in test call
2017-11-27 22:27:34 -07:00
Stephen Scott
9a1e408a3f
Add option and specs (no implementation yet)
...
These new snapshots are from https://github.com/prettier/prettier/pull/2676
2017-11-27 22:26:58 -07:00
Artem Sapegin
172d34e43d
Do not prepend / append with a semicolon the only JSX element in a program ( #3330 )
...
* Do not prepend / append with a semicolon the only JSX element in a program
Fixes #3196
* Limit single JSX element without semicolon to Markdown only
* Fix tests
2017-11-27 22:04:12 -07:00
Simon Lydell
56951a71b4
Don't lowercase element names and attribute names in selectors ( #3317 )
...
* Don't lowercase element names and attribute names in selectors
https://www.w3.org/TR/css3-selectors/#casesens
> All Selectors syntax is case-insensitive within the ASCII range (i.e.
> [a-z] and [A-Z] are equivalent), except for parts that are not under the
> control of Selectors. The case sensitivity of document language element
> names, attribute names, and attribute values in selectors depends on the
> document language. For example, in HTML, element names are
> case-insensitive, but in XML, they are case-sensitive.
Fixes #3304 .
* Fix number normalization in selector interpolation
2017-11-27 13:28:03 +01:00
Lucas Azzola
2dd76c6a95
Print parens around type assertions for decorators ( #3329 )
2017-11-27 23:10:33 +11:00
Ika
9b4ecec183
fix(markdown): preserve non-breakable whitespaces ( #3327 )
2017-11-27 19:37:52 +11:00
Lucas Duailibe
f9f056612f
Update flow to 0.59.0 ( #3238 )
2017-11-26 23:14:45 -03:00
Lucas Duailibe
742a5c3d02
Don't add trailing comma after object rest spread in TypeScript ( #3313 )
2017-11-23 12:54:21 -02:00
Anton
a0c95cf862
UTF8-BOM - if input string has BOM that mean output string also should have it ( #3283 )
...
The issue that prettier lost BOM and mean convert UTF-8 with BOM to just UTF-8
2017-11-21 14:38:21 -07:00
Lucas Duailibe
759953ef6d
Template literals: Don't break on identifiers but break if comments ( #3299 )
2017-11-21 15:51:15 -02:00
Ika
d5a3abd7a6
fix(markdown): only indent the first non-list node in checkbox list item ( #3297 )
...
* fix(markdown): do not indent checkbox
* fix: keep alignment for first non-list node
* fix: force whitespaces
2017-11-22 00:01:59 +08:00
Ika
3cbbac3d08
fix(multiparser): fix markdown error and remove trailing new line ( #3293 )
2017-11-21 00:19:49 +08:00
Ika
b6f126eb29
feat(markdown): support TOML ( #3290 )
2017-11-19 17:38:25 +11:00
Christopher Chedeau
4b070c3a93
[flow] Do not break on empty type parameters ( #3281 )
...
Not only does breaking look bad but when you have trailing comma enabled, it puts a comma there which is not valid.
2017-11-16 14:36:37 -08:00
Ika
378cfee508
refactor(markdown): expose `hasPunctuation` to AST for better debugging ( #3272 )
...
* refactor(markdown): extract `punctuationRegex`
* refactor: expose `has(Leading|Trailing)Punctuaion` to AST for better debugging
* refactor: tweak
* refactor: tweak
* fix: no regression
* test: fix typo
2017-11-16 13:59:01 +08:00
Lucas Duailibe
482c83df20
Don't break self closing elements with no attributes ( #3250 )
2017-11-13 02:20:17 -02:00
Ika
d08df0b221
fix(markdown): handle punctuation variants ( #3254 )
...
* fix(markdown): handle punctuation variants
* docs: add comment
2017-11-13 00:09:04 +08:00
Lucas Duailibe
ece764a049
Preserve intentional new lines in GraphQL ( #3252 )
...
* Preserve intentional new lines in GraphQL
* Move function to bottom
* Rename arg
* Refactor
* Add comments in tests and support for arguments
2017-11-12 02:10:54 -02:00
Ika
bddbd1914d
fix(markdown): no extra whitespace between ascii punc and CJK char ( #3249 )
...
* fix(markdown): no extra whitespace between ascii punctuation and CJK character
* test: update snapshot
2017-11-12 00:38:18 +08:00
Ika
4ae52c5aa6
fix(markdown): do not enable splitText in inlineCode ( #3243 )
2017-11-12 00:29:59 +08:00
Ika
1cde865a11
fix(markdown): no extra whitespace between non-cjk and cjk-punctuation ( #3244 )
...
* fix(markdown): no extra whitespace between non-cjk and cjk-punctuation
* fix: no node v4 unsupported feature
2017-11-12 00:08:24 +08:00
Ika
4c6a7e8749
fix(markdown): escape all emphasis-like text ( #3246 )
...
* fix(markdown): escape all emphasis-like text
* test: add test case
2017-11-12 00:07:58 +08:00
Ika
92459047ed
fix(markdown): force print spaces ( #3225 )
2017-11-11 15:05:07 +08:00
Ika
49f578fb91
fix(markdown): do not break `inlineCode` ( #3230 )
2017-11-11 12:50:40 +08:00
Lucas Duailibe
658886aab1
Prevent adding semi in TypeScript interfaces when type has prettier-ignore ( #3103 )
2017-11-09 21:52:47 -02:00
Mitermayer Reis
813d9b93eb
Fix typos ( #3212 )
...
* Adding --stdin-filepath option in order to enable filetype inference from
stdin
* Fixing typo on the documentation
* Fixing typos - fixing some typos
* Restoring static lib files back since they are artifacts
2017-11-09 11:44:24 +11:00
Ika
7fb8e3fe43
fix(markdown): no break on link ( #3204 )
...
* fix(markdown): link/image url head is breakable
* fix(markdown): no break on link
2017-11-09 08:19:35 +11:00
Ika
4f1a2c4108
feat(markdown): add `--no-prose-wrap` option ( #3199 )
...
* feat(markdown): add `--no-prose-wrap` option
* refactor: fix typo
* refactor: fix typo
* refactor: reduce duplicate code
* docs: mention the option is for markdown
2017-11-08 21:01:06 +11:00
Lucas Duailibe
a35257bacf
Print JSON top comments as leading comments of root node ( #3187 )
...
* Make JSON top comments be leading comments of root node
* Update snapshot
2017-11-08 09:01:09 +11:00
Lucas Duailibe
68a99cf4b2
Parenthesis around TSAsExpression inside TSAbstractClassDeclaration ( #3191 )
2017-11-08 08:59:15 +11:00
Ika
ec7eced099
test: lowercase the test file to avoid cross platform issue ( #3189 )
2017-11-07 22:07:01 +08:00
Ika
18345817d8
fix(markdown): allow more cases that `_`-style emphasis is available ( #3186 )
...
* fix(markdown): add more cases `_`-style emphasis is available
* refactor: fix naming style
2017-11-07 23:33:29 +11:00
Lucas Duailibe
49b07c3983
Don't add trailing commas in JSXAttribute for arrow functions ( #3181 )
2017-11-07 22:37:36 +11:00
Ika
ffd198beaa
fix(markdown): handle additional spaces before `code` ( #3180 )
...
* fix(markdown): handle additional spaces before `code`
* test: update snapshots
* fix: ignore leading `\n` from indented `code`
* docs: add comment
2017-11-07 22:25:20 +11:00
Lucas Azzola
e733a7706d
Force JSON to no trailing comma in multiparser ( #3182 )
...
* Force JSON to no trailing comma in multiparser
* Switch to mutate next.options
2017-11-07 22:01:40 +11:00
Ika
9d616817be
fix(markdown): do not break on unbreakable place ( #3177 )
2017-11-07 21:10:41 +11:00
Ika
2bdb652667
fix(markdown): do not break before special prefix ( #3172 )
...
* fix(markdown): do not break before special prefix
* fix: add more cases
2017-11-07 20:40:09 +11:00
Lucas Duailibe
8249b1c841
Add support for JSXSpreadChild and fix comments inside JSXSpread ( #3163 )
...
* Add support for JSXSpreadChild and fix comments inside JSXSpread
* Dangling comments
* Use another approach
2017-11-07 14:23:10 +11:00
Lucas Duailibe
2c5a792d9a
fix(jsx): Break opening elements with single text attribute if there's a comment ( #3154 )
...
* fix(jsx): Break opening elements with single text attribute if there's a comment
* Single text attribute with a comment on the JSXElement name
* Consolidate rules of comments in JSX
2017-11-07 08:05:59 +11:00
Ika
1d4848b37c
chore(deps): upgrade patch-level dependencies ( #3153 )
...
* chore(deps): update jest-docblock to 21.3.0-beta.7
* chore(deps): upgrade patch-level dependencies
* test: update snapshot
2017-11-07 00:38:37 +11:00
Ika
ec8deb6c0b
fix(markdown): print `---`-style thematic break ( #3148 )
...
* fix(markdown): print `---`-style thematic break
* test: fix diff
2017-11-05 20:50:10 +11:00
Christopher Chedeau
ec18ebc6c6
[Graphql] Escape strings ( #3143 )
...
When I ran it on all the graphql files of fb, none of them had escape, but someone reported this issue!
2017-11-04 11:04:45 -07:00
Lucas Duailibe
1dfffd14e7
Don't inline trailing } for arrow functions in JSX
2017-11-04 01:52:27 -02:00
Lucas Duailibe
979b86944d
Consider [0] to be part of the first member group
2017-11-02 14:42:13 -02:00
Lucas Duailibe
538ce6d209
Preserve line breaks in css grid declaration
2017-11-02 00:21:41 -02:00
Lucas Duailibe
21c6d4f501
Prevent inlining JSXAttribute if it has comments ( #3132 )
2017-11-01 09:56:04 -06:00
Lucas Duailibe
38b15f7899
Improve template literal expresions line breaks ( #3124 )
2017-10-31 14:31:27 -06:00
Christopher Chedeau
777090ca99
Make the factory detection handle multiple elements ( #3112 )
...
This was only accounting for a single element in the first group. Now it handles arbitrary elements. Only the last element being capitalized matters.
This fixes one issue in #3107
2017-10-27 09:05:40 -07:00
Lucas Duailibe
6ccf5c0246
fix(jsx): Don't inline trailing } for arrow functions attributes ( #3110 )
2017-10-26 11:32:57 -06:00
Lucas Azzola
1d3c86be4d
Fix util.getStringWidth for falsy input ( #3092 )
2017-10-24 15:19:27 +11:00
Lucas Azzola
c0aaa0fa52
Don't print JSX bracket on same line when it has trailing comments ( #3088 )
2017-10-23 17:13:12 +11:00
Ika
11d7213862
test(markdown): rename test case to avoid confusing ( #3086 )
2017-10-23 09:49:13 +08:00
Lucas Duailibe
878412c680
Break parens for binaries in member expression ( #2958 )
...
* Break parens for binaries in member expression
* Add test case
* Update snapshot
2017-10-22 17:29:13 -06:00
Cyril Junod
e589babeaf
Split source elements relative to their language. ( #3069 )
...
* Split source elements relative to their language.
Colliding node types which are not source elements in every language.
Example ObjectExpression in JSON / JS
* Node4's Array.prototype.includes
* Ensure there is no confusion
ObjectExpression vs BlockStatement & LabeledStatement
2017-10-22 20:04:06 +11:00
Karl O'Keeffe
fa83ce3f3f
Fix calculation of whether doc parts fit ( #3081 )
2017-10-22 07:54:23 +01:00
Andy Mockler
c6d97abf95
Format SCSS maps like CSS rules ( #3070 )
...
* Format SCSS maps like CSS rules
* Ensure parent value starts with $ before formatting map with hardlines
2017-10-22 12:35:22 +11:00
Lucas Duailibe
b53a426e15
Prevent breaking MemberExpression inside NewExpression ( #3075 )
...
* Test case
* Prevent breaking MemberExpression inside NewExpression
2017-10-22 10:30:05 +11:00
Mutasem Aldmour
54bdd30595
Fix first argument left behind when line breaks ( #3079 )
...
* fixing issue #2984
* removed typescript from test #2984
* prettier
* removed obsolete test copied from another
* added verification parsers
* added new line
2017-10-21 23:12:26 +11:00
Lucas Duailibe
465729685f
Fix indentation of intersection object types ( #3074 )
2017-10-21 17:45:41 +11:00
Brian Ng
12f028cd46
Fix formatting styled(Foo).attrs(...)`` ( #3073 )
2017-10-21 09:10:55 +11:00
Jacky Ho
5b7b012fcd
Account for empty lines in long member call chain ( #3035 )
...
* Account for empty lines in member chain
* Add tests
* Account for parens
* Improve tests
* Add some comments
* Remove an outdated comment
* Fix lint errors
* Refactor a line of code
* Add one more comment for clarification
2017-10-19 09:25:51 +11:00
Lucas Azzola
7162e1ecc8
Keep parens around TSAsExpression in ConditionalExpression ( #3053 )
2017-10-18 20:03:58 +11:00
Lucas Azzola
624d89e7a5
Print pipeline and nullish-coalescing operators ( #3036 )
2017-10-16 09:13:25 +11:00
Brian Ng
d90aec1a1d
Add test for nested ternary with arrow func ( #3039 )
2017-10-16 09:09:57 +11:00
Ika
c27cc7ff45
feat(markdown): support CJK and emoji ( #3026 )
...
* refactor: extract `splitText`
* fix: respcet CJK width in table
* test: add failing test
* fix: support emoji
* test: add failing test
* feat: support CJK character
* feat: enable adding whitespace between non-CJK/CJK-character by default
* fix: do not print softline at node that is sensitive to its identifier
* fix: treat full-width whitespace as CJK punctuation
* disallow leading/trailing full-width whitespace
* feat: remove `--split-cjk-text` option and enable it by default
* refactor: simplify regex and remove unnecessary `g` flag
2017-10-14 23:57:31 -05:00
Ika
c3b965145b
feat(markdown): auto-detect which number style of ordered list to be used ( #3029 )
2017-10-14 22:53:58 +11:00
Ika
c4118edbe7
fix(markdown): print auto-link as-is ( #3032 )
2017-10-14 22:49:12 +11:00
Ika
5c789b2dfc
fix(markdown): use the most popular unordered list style ( #3027 )
2017-10-14 22:41:25 +11:00