Commit Graph
146 Commits
Author SHA1 Message Date
Kevin GibbonsandSosuke Suzuki b86d36a28b fix parentheses around sequence expression as body of arrow chain (#11593)
* fix parentheses around sequence expression as body of arrow chain

* add changelog

* lint

* Update changelog_unreleased/javascript/11593.md

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

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-09-28 05:15:17 +09:00
sosukesuzuki d812687502 Clean changelog 2021-09-09 18:29:57 +09:00
Sosuke SuzukiandJed Fox 07476f80a7 2.4 blog post (#11457)
* Mark highlights

* Add new draft

* Update intro

* Fix typo

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Address review

* Address review

* Address review

* Regenerate draft

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Address review

* Regenerate draft

* Regenerate draft

Co-authored-by: Jed Fox <git@jedfox.com>
2021-09-09 18:24:31 +09:00
Sosuke Suzuki 53f95f3500 Support hack-style pipeline (#11335)
* Avoid to conflicts to v8intrinsic plugin

* Support hack-style pipeline

* Update tests for hask-style pipeline

* Update tests 2

* Add changelog

* Update misc tests

* Address reviews

* Fix type error

* Copy plugin array

* Add tests

* Address review

* Add error tests
2021-08-15 01:16:13 +09:00
Sosuke Suzuki b6fd414918 Count correctly regex literals in method chain arguments (#11299)
* Use getStringWidth instead of String length

* Add changelog

* Fix changelog
2021-08-02 14:15:07 +09:00
Sosuke Suzuki 1ecae48ae8 Support parenthesized tagged template literals for styled components (#11246)
* Support parenthesized styled.property

* Add changelog

* Fix changelog
2021-07-25 18:16:25 +09:00
Sosuke Suzuki e2694e2b21 Clean changelog_unreleased (#11033) 2021-06-09 14:42:00 +09:00
Jed Fox 261bb0314f Fix repositioning the cursor at the end of a range format (#10938)
* Adjust the upper bound on cursorOffset when range formatting

* fix implementation

* Add changelog entry

* Update changelog entry to use PR number
2021-05-24 02:49:49 +09:00
Georgii Dolzhykov 171b1ee2bf Clean changelog_unlreleased 2021-05-10 00:17:59 +03:00
ba1a833378 Add 2.3 blog post (#10659)
* Start 2.3 blog post

* Apply suggestions from code review

Co-authored-by: Alex Rattray <rattray.alex@gmail.com>

* Regenerate the post

* Regenerate blog post

* Regenerate post

* Edit changelog entries

* Regenerate blog post

Co-authored-by: Alex Rattray <rattray.alex@gmail.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-05-10 00:15:27 +03:00
fisker Cheung 877e64c046 Fix missing parentheses on async inside for..of (#10781) 2021-05-06 16:53:48 +03:00
Sosuke Suzuki edc7a30f26 Support async do expressions proposal (#10813)
* Support async-do-expression proposal

* Add more tests

* Add changelog
2021-05-05 22:32:26 +03:00
Georgii Dolzhykov 4d4c0011b6 Edit changelog 2021-04-21 03:34:26 +03:00
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