Commit Graph
1920 Commits
Author SHA1 Message Date
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
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 52f0894611 Fix stripTrailingHardline function (#9736)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-12-07 10:07:34 +08:00
fisker Cheung c0fbd75288 Fix empty front matter formatting (#9791) 2020-11-30 18:10:09 +08: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
fisker Cheung 902d524d2f Treat .prettierrc as yaml (#8105) 2020-11-30 12:23:20 +08:00
fisker Cheung 664d0d33b5 Fix inconsistent language comment detection (#9743) 2020-11-26 19:30:57 +08:00
fisker Cheung 25d53fa9b3 SCSS/LESS: Fix comment inside parens (#9710) 2020-11-26 19:28:00 +08:00
fisker Cheung 5f01f34453 Add semi to DeclareExportAllDeclaration (#9767) 2020-11-25 19:26:20 +08:00
dependabot[bot]andfisker 21dd12d370 Build(deps): Bump @glimmer/syntax from 0.66.1 to 0.67.0 (#9762)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-11-24 19:26:14 +08:00
fisker Cheung d02a367e64 Remove JSXText spacial case in comment attaching (#9759) 2020-11-24 17:37:29 +08:00
Juriy Zaytsevandfisker 90abbb7924 [Glimmer] Preserve tilde comments (#9082)
Co-authored-by: fisker <lionkay@gmail.com>
2020-11-24 14:45:03 +08:00
dependabot[bot]andfisker 82603f2609 Build(deps): Bump @babel/parser from 7.12.5 to 7.12.7 (#9748)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-11-24 14:24:30 +08:00
fisker CheungandGeorgii Dolzhykov f254314feb Use meriyah (#9731)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-11-23 13:57:13 +08: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
fisker Cheung f532bf2b49 Refactor: Module releated format (#9691) 2020-11-19 08:58:56 +08:00
Sosuke Suzukiandfisker Cheung 4cc149248a Support TypeScript 4.1 via typescript-estree (#9636)
* Update typescript and typescript-estree

* Add AST transformation for TSTemplateLiteralType

* Update tests for template-literal-types

* Fix transformChainExpression

* Update tests for key-remapping-in-mapped-types

* Implement recoverInvalidDecorators

* Update changelog

* Avoid typecheck error

* Add os.platform() shim

* Update config.js

* Update config.js

* Shim os.cpus

* Update `process.versions.node`

* Attempt to fix build

* Update ts parserOptions

* Fix code style

* Remove `errorOnUnknownASTType`, fix code style

* Use `[] ||` instead of `[] //`

* Fix hack

* Add invalid tests

* checkMissingDecorators

* Update tests

* Fix tests

* Add comment

* Revert "Implement recoverInvalidDecorators"

This reverts commit 27e7b46ed41df36fb585791117c85e1b2dab932c.

* Add ref pr link

* Simplify logic

* Don't transform `TSTemplateLiteralType`

* Add `TSTemplateLiteralType` as simple type

* Fix tests

* Update comments

* Add comment

* Fix logic

* Minor tweak

* use multiple parsers

* Update @typescript-eslint/typescript-estree to v4.8.0

* Switch to `parseWithNodeMaps`

* Rename `esNode` -> `esTreeNode`

* Update @typescript-eslint/typescript-estree to 4.8.1-alpha.1

* Use @typescript-eslint/typescript-estree 4.8.1

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2020-11-18 10:59:58 +09:00
fisker Cheung 702f543635 YAML: Apply trailingComma option (#9665) 2020-11-18 09:05:56 +08:00
fisker Cheung 85e5cfaf2f YAML: Fix comments in flowMapping and flowSequence (#9669) 2020-11-17 21:38:50 +08:00
dependabot[bot] e73576a64b Build(deps): Bump @glimmer/syntax from 0.65.0 to 0.66.0 (#9693) 2020-11-17 07:59:26 +00:00
fisker Cheung 386759c6f7 Test: Allow multiple parsers in error test (#9648) 2020-11-16 15:19:50 +08:00
fisker Cheung f9f66711b9 Fix comments in require() with no argument (#9670) 2020-11-16 01:11:53 +08:00
fisker CheungandGeorgii Dolzhykov 35a1497024 Update remark-math to v3 (#7938)
* bump remark-math to 3.0.1

* escape $ only it was escaped in the input

* remove unsupported syntax from tests

remark-math@3 doesn't support text after the closing fence ($$). Such $$ aren't parsed as a closing fence anymore.

* refactor

* add a test

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-11-15 19:03:35 +02: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
fisker Cheung 4bcf8a3a36 Markdown: Fix extra empty line added after empty table (#9654) 2020-11-13 19:13:03 +08:00
fisker CheungandGeorgii Dolzhykov 2a9d0f66d5 Typescript: Fix prettier-ignored mapped types (#9551)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-11-13 09:06:02 +08:00
fisker Cheung 28d914b811 Vue: Consistent slot, support Vue3 (#9609) 2020-11-13 09:05:30 +08:00
Brian Kim d0f813e5d4 Revert #9011, don’t add parens when yielding simple JSX expressions (#9650) 2020-11-13 08:49:15 +08:00
fisker Cheung 60a5729a19 Move prettier-ignore related functions into language-js/ (#9555) 2020-11-10 09:12:46 +08:00
c91914e610 Build(deps): Bump @babel/parser from 7.12.3 to 7.12.5 (#9597)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-11-06 19:30:42 +08:00
fisker Cheung 7836466d67 Test: snapshot parse errors (#9467) 2020-11-06 15:27:04 +08:00