Commit Graph
1952 Commits
Author SHA1 Message Date
dependabot[bot]andsosukesuzuki 478107836d Build(deps): Bump @babel/parser from 7.12.11 to 7.13.4 (#10397)
* Build(deps): Bump @babel/parser from 7.12.11 to 7.13.4

Bumps [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) from 7.12.11 to 7.13.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.4/packages/babel-parser)

Signed-off-by: dependabot[bot] <support@github.com>

* Add unstable AST compare testing

* Remove error tests for this type with babel-flow

* Fix typo

* Add changelog

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2021-02-26 22:04:53 +09:00
Sosuke Suzuki feacf82892 Update babel/parser to v7.12.17 (#10345) 2021-02-25 18:28:06 +08:00
Georgii Dolzhykov ec27ade49b Heuristic for grouping parameters in method signatures (#10357)
* Heuristic for grouping parameters in method signatures
* Apply the same logic to function declaration and Flow types
* Group only if there is only one parameter
* Don't group if type param has constraints/default or >1 type param
2021-02-23 16:38:56 +02:00
fisker Cheung d544585d87 Make JSON parser stricter (#10346) 2021-02-23 13:33:10 +02:00
Sosuke Suzuki b0d66bb3c6 Support TS 4.1 intrinsic keyword (#10390) 2021-02-22 13:49:49 +02:00
Georgii Dolzhykov 42f8271a1e Indent type assertions in heads of call and member expressions (#10341) 2021-02-20 14:37:08 +02: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 aef9277ada Print trailing comma for TS type parameters but not type arguments (#10353) 2021-02-20 12:47:56 +02:00
Georgii Dolzhykov e147c3b1c4 Fix ASI protection for private fields (#10334) 2021-02-18 12:39:56 +02:00
Georgii Dolzhykov 3950ce194d Correct parentheses for non-null assertions (#10337) 2021-02-18 01:52:24 +02:00
Georgii Dolzhykov 0a647a0d31 Format assignments more consistently (#10222) 2021-02-16 21:25:11 +02:00
Georgii Dolzhykov 3a73f48a0e Don't use smart quotes for JSON5 with --quote-props=preserve (#10323) 2021-02-15 19:13:33 +02:00
Georgii Dolzhykov 81e6208e63 Allow arg hugging for non-concise arrow functions with return type (#10316) 2021-02-15 19:13:09 +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
Cyrille David 5aa057b40b Handlebars: Default --html-whitespace-sensitivity to strict (#10201)
* Handlebars: Default --html-whitespace-sensitivity to strict

* Record tests other than handlebars

* Trim trailing newlines

* Record tests

* Fix rebase

* Record all tests not only hbs

* Fix the idempotency issue

Adjust dedent for the last child node

* Fix the annoying trailing whitespace

* Trim isolated leading newline
2021-02-11 15:43:07 +02:00
Sosuke Suzuki 2d97df8ec7 Fix unnecessary line breaks in method type declaration parameters (#10024) 2021-02-11 09:49:38 +02:00
dependabot[bot]andfisker Cheung d0829f8b95 Build(deps): Bump meriyah from 4.0.0 to 4.1.1 (#10283)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-11 00:51:41 +08:00
Georgii Dolzhykov a55fe2d961 Add tests for #2239 (#10286) 2021-02-10 01:06:14 +02: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
Cyrille Davidandfisker Cheung 8198f40727 handlebars: Split text content on multiple lines (#10179)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-07 08:58:44 +08:00
dependabot[bot]andfisker Cheung d0942b8fae Build(deps): Bump @babel/code-frame from 7.12.11 to 7.12.13 (#10226)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-02-04 09:42:00 +08:00
Georgii Dolzhykov a7ea77e0ef Fix regression after pr-10106 (#10160) 2021-01-29 19:58:24 +02:00
Georgii Dolzhykov 8846448b85 Handlebars: fix formatting of attributes (#10145)
* Handlebars: fix formatting of attributes

* Add group only for class

* Add changelog

* Update clean.js

* Simplify ConcatStatement

* Lowercase attr name in clean

* Use text instead of n.chars
2021-01-28 23:45:08 +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
Sosuke SuzukiandGeorgii Dolzhykov 53a7e9782b Print trailing comma for type parameters (#10109)
* Print type parameters for TypeScript

* Add more tests

* Add changelog

* Avoid duplicates printing trailing-commas

* Fix changelog

* Address review

* Update src/language-js/print/type-parameters.js

* Update 10109.md

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-01-28 23:03:16 +09:00
Georgii Dolzhykov 79d2f4a295 Add CLI flag for debugging comment attachment issues (#10124) 2021-01-27 12:30:10 +02:00
fisker Cheung 743ef3de9b SCSS: Fix maps with keys that are lists or maps (#10005) 2021-01-26 09:45:25 +08:00
Mike 3dfac3d71b Support YAML document end marker in front matter (#9878) 2021-01-25 17:09:22 +02:00
Georgii Dolzhykov 24433cbbf6 Use fill to print number-only arrays (#10106) 2021-01-25 10:07:06 +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 0354b2ef9d Add a test for HTML (#10077) 2021-01-18 16:40:57 +02:00
7cf524fa03 Smarter formatting of HTML class attribute (#7865)
* html: break class attr onto multiple lines, but try keeping consecutive classes with the same prefix on one line

* add changelog

* add more tests

* improve doc structure to fix an issue with the closing quote

* Update changelog_unreleased/html/pr-7865.md

Co-Authored-By: Jed Fox <git@twopointzero.us>

* handle classes with leading _ and -

* update snapshots

* Lint

* Update pr-7865.md

* Update changelog entry

Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-01-18 15:50:52 +02:00
Cyrille David c8cbbb0a79 handlebars: Support htmlWhitespaceSensitivity=strict option (2/3) (#9885)
* hbs: Add a strict mode

* Fix lint (after concat removal)

* Another lint error
2021-01-18 15:49:39 +02:00
Georgii Dolzhykov 92cf9452e9 Disable Babel's error recovery for omitted call arguments (#10065) 2021-01-18 09:45:37 +02:00
dependabot[bot]andfisker c5300fa0ca Build(deps): Bump meriyah from 3.1.6 to 4.0.0 (#10060)
* Build(deps): Bump meriyah from 3.1.6 to 4.0.0

Bumps [meriyah](https://github.com/meriyah/meriyah) from 3.1.6 to 4.0.0.
- [Release notes](https://github.com/meriyah/meriyah/releases)
- [Changelog](https://github.com/meriyah/meriyah/blob/master/CHANGELOG.md)
- [Commits](https://github.com/meriyah/meriyah/compare/v3.1.6...v4.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* `FieldDefinition` -> `PropertyDefinition`

* `PrivateName` -> `PrivateIdentifier`

* Test https://github.com/meriyah/meriyah/issues/164

* Copy test from https://github.com/meriyah/meriyah/commit/f21882c312284572ac6d7e7630c4a677d6caed92

* Revert breaking change from 3cdb2a4edc8af0b1c02b1d3f1e1493550164fed0

* Fix test options

* Typo

* Update snapshot

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2021-01-16 01:28:54 +02:00
Cyrille David 554d45ea20 handlebars: Print final blockParam on its own line (#9978) 2021-01-13 12:02:47 +08:00
dependabot[bot]andsosukesuzuki 1e7fa4a684 Build(deps): Bump cjk-regex from 2.0.0 to 2.0.1 (#10021)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2021-01-11 10:15:37 +08:00
fisker Cheung 27700e5282 Add test to close issue 9102 (#9982) 2020-12-31 21:24:24 +09:00
Christopher Chedeau eec3e82f48 Fix absolute path in custom CSS url() calls (#9966)
At Facebook we have some custom pre-processor `-fb-url(/abs/path/)` that gets messed up as `-fb-url(/ abs/path)`  with the current version of prettier.

The parser has hardcoded logic to only parse as path things that use `url()` but not `-fb-url()` and it parses it as `division /` and `abs/path/`. Because we put a space after division, the bug is introduced.

I don't really know the impact of changing the parser, but on the printer side, it is straightforward to not add a space after `/` if it's the first element in a group. I can't think of any reason why you could write `(/ something` in CSS so I think it's a safe change.
2020-12-28 20:22:25 -03:00
fisker Cheung be497c3c8f Use printBlock to print ClassBody (#9915) 2020-12-21 17:10:03 +08:00
fisker Cheung f0f18d3090 Enable unicorn/prefer-number-properties (#9935) 2020-12-21 17:09:20 +08:00
Cyrille David fbe57068e7 Handlebars: Add tests for ignore and strict modes (1/3) (#9883) 2020-12-21 17:04:18 +08: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
fisker Cheung 099ba04327 TypeScript: Fix missing comments in MethodDefinition (#9872) 2020-12-15 12:22:56 +08:00
fisker Cheung ee1d1a9512 HTML: Remove use of normalizeParts in "text" print (#9846) 2020-12-11 07:44:03 +08:00
dependabot[bot] 892a70e0d3 Build(deps): Bump @glimmer/syntax from 0.68.1 to 0.69.0 (#9862) 2020-12-10 10:53:49 +00:00