Commit Graph
133 Commits
Author SHA1 Message Date
Georgii Dolzhykov 08fb7af227 Mark formatting improvements in changelog 2021-04-21 02:45:44 +03:00
Georgii Dolzhykov 33cc92daad Address more feedback in changelog entries 2021-04-21 02:05:22 +03:00
Georgii Dolzhykov 8588462f4b Edit changelog entries (@j-f1's suggestions) 2021-04-20 23:48:06 +03:00
Georgii Dolzhykovandfisker Cheung bc90973cad Avoid arg expansion that leads to broken code (#10712)
* Avoid arg expansion that leads to broken code

* Preserve new lines and only take comments into account if they break lines

* Add robustness against path state corruption due to throwing

* Refactor

* Remove redundant logic

It solved the same issue but only partially.

* Simplify further

* Refactor path.try, fix callParent issue

* Minor refactoring

* Add istanbul ignore comment

* Add return to AstPath#try

Co-authored-by: fisker Cheung <lionkay@gmail.com>

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-04-20 15:02:11 +03:00
Georgii Dolzhykov a610179132 Improve lone argument detection (#10672) 2021-04-15 00:19:23 +03:00
Georgii Dolzhykov ae176f2e79 Process conditional groups in mapDoc (#10695) 2021-04-12 18:15:46 +03:00
Georgii Dolzhykov 22f9256faa Edit changelog entries (JS) 2021-04-12 12:43:47 +03:00
Georgii Dolzhykov 641fe5e3a4 Changelog edits 2021-04-12 05:16:47 +03:00
Sosuke Suzuki 0cdc62e405 Improve formatting for do expression (#10693) 2021-04-12 04:22:44 +03:00
fisker Cheung 07ae0134e5 JS: Fix duplicated prettier-ignore comments (#10666) 2021-04-12 03:35:13 +03:00
Georgii Dolzhykov 1eaa8777a7 Mark changelog entries as highlights 2021-04-08 20:06:06 +03:00
Georgii Dolzhykov 7a5ccc581d Tweak object destructuring in assignments (#10643) 2021-04-06 12:59:14 +03:00
fisker Cheung cc5981227a Add parens for yield in pipeline (#10446) 2021-03-26 10:19:00 +02:00
Sosuke SuzukiandGeorgii Dolzhykov a49942c1ba Support module blocks proposal (#10417)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-24 18:19:11 +02:00
Georgii Dolzhykov 13744dffa2 Fix edge case with trailing comments in arrow chains (#10543)
* Fix edge case with trailing comments in arrow chains

* Remove handling of args.needsSemi from printComments
2021-03-16 15:51:03 +02:00
Georgii Dolzhykov 6a87ce138a Improve detection of AMD define (#10528) 2021-03-15 00:08:37 +02:00
Georgii Dolzhykov 2740ea6ee8 Avoid last-argument hugging for number-only arrays (#10517) 2021-03-14 12:15:53 +02:00
046ffb11f9 Support better formatting for curried arrow functions (#9992)
* Support formatting for curried arrow functions

* Fix test file name

* Fix threshold

* Add changelog

* Fix operator for comparing

* Fix return pos

* Fix eslint

* level 2

* Refactor for level2

* Update tests

* Remove concat

* If it fits on one line, print on one line

* Indent second level arg

* Break before last return value

* Use isCallLikeExpression

* Improve printing

* Add tests

* Remove unnecesary condition

* Fix lint problems

* Update src/language-js/utils.js

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>

* Update changelog

* Add ImportExpression

* Add ImportExpression to isCallLikeExpression

* Resolve conflicts

* Address reviews

* Fix ESLint problem

* Fix changelog

* Add tests

* More tests

* Print simple arrow chains on one line

* Don't forcibly break chain when a segment has a return type but no params

* Prevent excessive wrapping in assignments

* Simplify

* Format object bodies like blocks

* Update changelog

* Fix last arg expansion

* Simplify

* Fix arrow chains in assignment chains

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-08 23:18:53 +02:00
Georgii DolzhykovandSosuke Suzuki 5f8fee4d07 Prevent wrapping object properties with short keys (#10335)
* Prevent wrapping object properties with short keys

* Update src/language-js/print/assignment.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

* Use getStringWidth instead of .length

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-03-03 01:43:46 +02:00
fisker CheungandGeorgii Dolzhykov 383e17665e Refactor decorators print (#10296)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-03-01 02:58:43 +08:00
Georgii Dolzhykov 31b3351800 Better formatting for nested await in member/call expression heads (#10342) 2021-02-20 12:50:44 +02:00
Georgii Dolzhykov e147c3b1c4 Fix ASI protection for private fields (#10334) 2021-02-18 12:39:56 +02:00
Georgii Dolzhykov 0a647a0d31 Format assignments more consistently (#10222) 2021-02-16 21:25:11 +02:00
Georgii Dolzhykov a322cf152a Disable Babel error recovery for invalid escaped characters in identifiers (#10322) 2021-02-15 16:58:50 +02:00
Sosuke Suzuki 2598803a2a Improve formatting for React Hooks call (#10238)
* Add isReactHookCallWithDepsArray

* Improve formatting for React hooks call

* Refactor

* Add changelog

* Use isReactHookCallWithDepsArray in shouldGroupLastArg

* Support general pattern
2021-02-14 23:57:26 +02:00
Sosuke Suzukiandfisker Cheung 7d84c0a5a4 Fix inconsistent indentation for ternary in call expressions (#10266)
* Refactor with do while

* return false when ternary in CallExpression is not callee

* Update changelog

* For computed member property

* Fix

* Simplify

* Minor tweak

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-12 08:11:24 +09:00
Georgii Dolzhykov 03a43ae55f Fix error thrown on expressions like a(b => c => function (){}) (#10278) 2021-02-09 11:08:14 +02:00
Sosuke Suzuki cc1f0543e6 Consistent indentations for conditional operators (#10187) 2021-02-07 16:53:05 +02:00
Georgii Dolzhykov a7ea77e0ef Fix regression after pr-10106 (#10160) 2021-01-29 19:58:24 +02:00
Sosuke Suzukiandfisker Cheung c881350e8c Break assignment whose rhs is wrapped by an unary expression (#10158)
* Break assignment whose rhs is wrapped unary expression

* Add changelog

* Recursive

* Refactor

* With loop

* Use if

* Update assignment.js

* Update assignment.js

This rewrite not totally equal, but should safe.

* Revert "Update assignment.js"

This reverts commit 14549442b7726461b0e39d0b1077cdbb00195e73.

* Try move parser check upper

* Simplify `switch`

* Simplify

* Move parser check to top

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-01-28 23:06:16 +09:00
Georgii Dolzhykov 24433cbbf6 Use fill to print number-only arrays (#10106) 2021-01-25 10:07:06 +02:00
fisker Cheung 12bddae20c Switch default branch to main (#10115) 2021-01-23 19:14:13 +02:00
Sosuke Suzuki c7a3c16f7d Improve visual separation between header and body in classes with multiline headers (#10085)
* Add hardline for a class whose extends part is broken

refactor

Use groupId

Remove isPreviousLineEmpty

* Avoid leading comments

* Rename to heritage

* Add heuristic for implements

* Fix lint problems

* Fix

Fix

Fix

* Extract getGroupId patterns

* Adopots solution 2

* Fix

* Fix lint problem

* Add changelog

* Address reviews

* Update tests

* Rename to createGroupIdMapper

* Split files

* Add tests for complex extends

* Fix changelog
2021-01-20 15:01:16 +09:00
Georgii Dolzhykov 92cf9452e9 Disable Babel's error recovery for omitted call arguments (#10065) 2021-01-18 09:45:37 +02:00
fisker Cheung 2725ebee55 Fix unstable JSX formatting with U+3000 (#9866) 2020-12-15 13:45:16 +08:00
fisker Cheung cc9460950d Fix inconsistent directive print (#9850) 2020-12-15 12:24:13 +08:00
Sosuke Suzuki aaa9363e6f Print null argument list item (#9787)
* Print null argument list item

* Add changelog

* Add tests for comments
2020-12-08 13:52:30 +09:00
fisker CheungandGeorgii Dolzhykov f59eacd7f6 JS: Fix multiple-comments-on-same-line format (#9672)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-11-30 13:51:49 +08:00
fisker Cheung 05d20a63a4 Exclude node at rangeStart (#9704) 2020-11-30 12:29:48 +08:00
sosukesuzuki 9ee97183a0 Clean changelog_unreleased for patch-release 2020-11-28 09:46:33 +09:00
sosukesuzuki eb7972a86d Clean changelog_unreleased for patch-release 2020-11-28 09:39:51 +09:00
sosukesuzuki 81cf06129b Merge branch 'patch-release' 2020-11-28 09:28:07 +09:00
fisker Cheung 664d0d33b5 Fix inconsistent language comment detection (#9743) 2020-11-26 19:30:57 +08:00
sosukesuzuki 81bfd3ffc7 Fix changelog to old format 2020-11-26 02:42:41 +09:00
Sosuke Suzuki b46710f2d9 Fix formatting for AssignmentExpression with ClassExpression (#9741)
* Fix formatting for asignment with superClass

* Add tests

* Changelog

* For only AssignmentExpression

* Remove unnecesary ifBreak
2020-11-26 02:35:14 +09:00
Sosuke Suzuki 3208b948fc Fix formatting for AssignmentExpression with ClassExpression (#9741)
* Fix formatting for asignment with superClass

* Add tests

* Changelog

* For only AssignmentExpression

* Remove unnecesary ifBreak
2020-11-22 09:24:22 +09:00
fisker Cheung 4f330f0a78 Fix comments inside JSX end tag (#9711) 2020-11-21 16:34:28 +08:00
sosukesuzuki 28cc1908fd Clean changelog_unreleased 2020-11-20 14:01:22 +09:00
fisker Cheung f9f66711b9 Fix comments in require() with no argument (#9670) 2020-11-16 01:11:53 +08:00
Georgii Dolzhykov e721ef30ea Flatten function expression parameters in hugged last argument (#9662)
Fixes #3376
This was done for arrow functions in #1305 ("Avoid breaking arguments for last arg expansion").
This PR enables the same for function expressions unless the function expression is the only argument.
2020-11-14 13:17:01 +02:00