Commit Graph
2523 Commits
Author SHA1 Message Date
Georgii Dolzhykov 56840d4890 Followup for #10169: minor tweaks (#10177)
* Followup for #10169: minor tweaks

* Add Copy doc button to Playground
2021-01-30 18:25:43 +02:00
Georgii Dolzhykov 78b38d2282 Round-trippable --debug-print-doc (#10169) 2021-01-29 21:48:34 +02:00
Georgii Dolzhykov a7ea77e0ef Fix regression after pr-10106 (#10160) 2021-01-29 19:58:24 +02:00
Sosuke Suzukiandfisker Cheung 07b30645ec style: Add new ESLint rule no-empty-string-for-ifbreak (#10172)
* Add new ESLint rule for ifBreak

* Fix for third argument

* Run fix with new rule

* Address review

* Fix

* Update no-empty-flat-contents-for-if-break.js

* Fix CI config

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-01-29 20:03:11 +09: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
fisker Cheung 4536fef4fe Simplify printStartingTag in glimmer printer (#10152) 2021-01-28 00:32:08 +02:00
Daron McIntosh 3d9f102301 Add CLI option to prevent errors on unmatched patterns (#10058) 2021-01-28 00:30:16 +02:00
Georgii Dolzhykov 53b59d2d39 Fix lineSuffixBoundary (#10122) 2021-01-28 00:29:34 +02:00
fisker Cheung bba719283d JS: Simplify clean function (#10154) 2021-01-27 14:36:02 +02:00
Georgii Dolzhykov 79d2f4a295 Add CLI flag for debugging comment attachment issues (#10124) 2021-01-27 12:30:10 +02:00
Georgii Dolzhykov 1df287acc8 Use default parameters where possible and other microrefactoring (#10135) 2021-01-27 12:36:39 +08:00
fisker Cheung a98292e417 Simplify frontMatter parse (#10136)
* Simplify frontMatter parse

* Rewrite regex to @thorn0's version
2021-01-27 01:11:53 +02:00
fisker e8a5d867cd Use ... instead of .concat() 2021-01-26 09:54:20 +08:00
fisker Cheung 89e5751b46 Use Object.{entries,values} if possible (#10131) 2021-01-26 09:48:31 +08:00
fisker Cheung ce26805e84 Enable unicorn/prefer-spread (#10129) 2021-01-26 09:46:14 +08: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
Georgii Dolzhykov f333c65231 Minor spellchecking and typechecking fixes (#10125) 2021-01-25 02:43:42 +02:00
fisker CheungandGeorgii Dolzhykov 6175013ae3 Enable unicorn/no-array-for-each (#10112)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-01-24 19:26:42 +08:00
fisker Cheung dd606d9ce1 Enable unicorn/no-array-push-push (#10111)
* Enable rule

* Apply auto-fix

* Manual fix
2021-01-23 22:37:01 +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
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
Sosuke Suzuki 0144c7aa2f Rename shouldNotPrePrintHardline to shouldPrePrintHardline (#10067) 2021-01-18 10:50:02 +09:00
Sosuke Suzuki 87b5cfc8ab Refactor: Use getLastStatement function in printStatementSequence (#10066)
* Add getLastStatement function

* Use loop

* Fix lint problem
2021-01-17 10:54:38 +09: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
fisker Cheung 0009e0d276 Enable unicorn/prefer-regexp-test (#10045) 2021-01-12 20:37:05 +08:00
fisker Cheung 7b24335064 Refactor: Use Doc[] instead of concat() (#9993) 2021-01-11 13:46:05 +08:00
fisker Cheung 358ad36a84 Forbid use concat() in concat() (#9998) 2021-01-11 10:19:13 +08:00
fisker CheungandSosuke Suzuki 7ec7a0f21f Fix using concat() on single Doc (#9994)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2021-01-04 14:40:02 +08:00
fisker Cheung 3efa3d3c58 Simplify printBody (#9926) 2021-01-04 10:18:14 +08:00
fisker Cheung 181a325c1c Enable unicorn/explicit-length-check (#9975) 2021-01-04 10:11:57 +08:00
fisker CheungandGeorgii Dolzhykov 9d9c0e2b6f Add Doc[] as Doc (#9733)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-01-04 10:04:30 +08:00
Sosuke Suzuki 23521ded6c Refactor CLI context with ES2015 class (#9964)
* Remove createContext

* Remove initContext

* Remove pushContextPlugins

* Remove popContextPlugins

* Move JSDoc comments

* Remove updateContextArgv

* Remove normalizeContextArgv

* Remove updateContextOptions

* Fix typedef

* Change exports format

* Add comment for initContext
2021-01-01 01:56:32 +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
fisker Cheung 5d69b2e324 Refactor: Move jsx related function to jsx.js (#9927) 2020-12-18 19:21:53 +08:00
fisker Cheung 85abe0fccd Refactor graphql parser to use tryCombinations (#9928) 2020-12-18 19:20:20 +08:00
fisker Cheung d55d4e90d8 Add JS version isNextLineEmpty (#9925) 2020-12-18 10:14:14 +08:00
fisker Cheung ec5f60725b Send array to FastPath#{each,map} callback (#9901) 2020-12-17 15:52:51 +08:00
fisker Cheung c7e354e38c Add isNonEmptyArray (#9902) 2020-12-17 14:46:59 +08:00
fisker Cheung 0fd2a28cff Enable arrow-body-style rule (#9918) 2020-12-17 14:31:51 +08:00
fisker Cheung ea17be725c Move isLastStatement to print/statement.js (#9916) 2020-12-17 12:10:49 +08:00