Commit Graph
955 Commits
Author SHA1 Message Date
Seiyaandfisker Cheung 97d8115d18 Resolve rule of fill violation in JSX and add assertion. (#16700)
* add stricter assertion into fill()

* resolve rule of fill issue. some comments and naming can be problematic.

* cleanup

* update comments

* rename printWhitespace -> printStringOrLine

* refine isValidSeparator() a bit

* remove FIXME comment for fixed issue

* fix idempotency problem in MDX

* add changelog

* rename assertDocFill() -> assertDocFillParts()

* add test for assertDocFillParts()

* replace cleanDoc(doc) === "" by isEmptyDoc(doc)

* Update src/document/utils/assert-doc.js

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

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2025-01-21 13:09:32 +09:00
SUZUKI Sosuke 4caa6302c0 Update changelog_unreleased for 3.5 (#17019) 2025-01-16 13:45:32 +09:00
Paul DraperandSosuke Suzuki bef1d61a7a Implement objectWrap config option (#16163)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2025-01-15 16:44:45 +09:00
fisker Cheung 8e8260e533 Improve angular ICU expression print (#16922) 2025-01-09 20:08:05 +08:00
fisker Cheung 6f12b94ae9 Fix tests for ts config (#16970) 2025-01-08 10:00:39 +08:00
eed53fc29a Break lines before binary operators (#7111)
* Add additional binary expression comment tests

Refs #3806

These cover a few edge cases I encountered while maintaining
`@btmills/prettier` over the last few years. I'm adding them up front to
demonstrate that the `experimentalOperatorPosition` changes in a later
commit have no effect on this formatting when the flag is not enabled.

* Define experimentalOperatorPosition flag

Refs #3806

This merely defines the flag. A future commit will use it in updated
logic.

* Add experimentalOperatorPosition default tests

Right now, this flag isn't implemented, so these tests duplicate the
existing behavior. I'm adding them now so that when I implement the
flag's logic in a future commit, the changed formatting will be obvious
in the diff and easier to review.

* Implement experimentalOperatorPosition flag

Fixes #3806 as requested in https://github.com/prettier/prettier/pull/7111#issuecomment-2252623779

The flag's tests were already added in a previous commit, so the test
changes you see in this commit are specifically due to the new flag's
implementation.

* Document experimentalOperatorPosition flag

* Change operator position option start|end

In response to https://github.com/prettier/prettier/pull/7111#discussion_r1729382119

* Add TS intersection line wrapping tests

This clones TypeScript's type union operator tests in `union-parens.ts`
and swaps the operators (& <-> |) to test the the type interesection
operator. It also runs intersection tests with the new
`experimentalOperatorPosition: "start"` flag. This does _not_ yet update
the implementation to consider the flag; to ease review, I'll make that
change in the next commit to isolate the impact of the change.

* Apply experimentalOperatorPosition: start to type intersections

The type union operator was already formatted at the beginning of lines
by default, so that logic didn't need to be updated.

* Update 7111.md

* Update tests after rebasing

I rebased from 1dfe28f85 to c7066780e to fix test failures related to
https://github.com/prettier/prettier/pull/16601. The rebase applied
cleanly, and this was the only change to tests. Since the PR has
already been approved, I'll keep this as a separate commit rather than
squashing into the prior commits.

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2025-01-04 01:30:51 +09:00
Norbert Elterandfisker 84de783ce6 Add support for TS config files (#16828)
* feat: prettier.config.ts

* revert

* feat: add flag

* fix: remove experimental warning

* Revert changes

* Add tests

* Update docs

* Only test on Node.js v22

* Add changelog

* Update docs

* Update examples

* Fix changelog

* Fix command

* Name `loadJs` back

* Fix

---------

Co-authored-by: fisker <lionkay@gmail.com>
2024-12-21 15:39:45 +09:00
fisker Cheung 66a77da2c5 Support Vue .prop shorthand (#16920) 2024-12-21 15:36:50 +09:00
Seiya a7ddbdb899 Consitent break for comma seperated value (#16907)
* add softline before root paren group

* add changelog

* make conservative
2024-12-21 15:36:36 +09:00
George Zahariev 0015a83d93 Suppport const type params in Flow (#16947) 2024-12-20 11:59:25 +09:00
Matic Jurgličandfisker ed94e9415b Handle <style> and <pre> tags in Handlebars/Glimmer (#15087)
Co-authored-by: fisker <lionkay@gmail.com>
2024-12-16 16:28:32 +08:00
Tatsunori Uchino 88c210e844 Treat U+FF5E as CJK punctuation (#16832) 2024-12-16 16:26:22 +08:00
fisker 6c7460a5d7 Clean changelog_unreleased 2024-12-04 15:06:20 +08:00
fisker Cheung 572bebe2d4 Fix comments on class methods with decorators (#16891) 2024-12-02 10:03:56 +08:00
Seiya e13614ffd8 Correct fit() for fill() (#16899)
* add test for #16897

this test fails at this commit.
snapshots are taken at e3b8a16c7f

* Fix #16897

* add changelog

* omit redundant test case
2024-12-01 19:00:35 +09:00
Tatsunori Uchino ac46a4f16e Treat U+30A0 & U+30FB in Katakana Block as CJK (#16796) 2024-11-26 23:52:53 +08:00
fisker a1e354d7fc Clean changelog_unreleased 2024-11-26 21:06:35 +08:00
fisker Cheung f6fccadbc7 Remove unnecessary parentheses around assignment in v-on (#16887) 2024-11-26 20:57:26 +08:00
SUZUKI Sosuke 3542f13845 3.4 release blog (#16851) 2024-11-26 14:02:34 +09:00
Sosuke Suzuki f53791a2c8 Clean changelog_unreleased 2024-11-26 13:53:25 +09:00
fisker Cheung 73efde346a Angular: Support typeof expression (#16862) 2024-11-25 21:39:05 +08:00
SUZUKI Sosuke a3ba537295 Fix loading ESM-style shared config file in Node.js 23 (#16857)
* Return `.default` when Node.js 23 module feature is enabled

* Add changelog

* Add `ERR_REQUIRE_ASYNC_MODULE` to ignored error code
2024-11-25 21:33:48 +09:00
fisker CheungandSUZUKI Sosuke c7066780ef Keep non-html doctype unchanged (#16765)
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2024-11-24 19:19:01 +09:00
Tatsunori Uchinoandfisker Cheung dc8df0ab80 Tell regexp-util to generate regex compatible with u flag (#16816)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-11-04 19:39:31 +08:00
fisker Cheung 6b582a0619 Improve string print perfomance (#16763) 2024-11-04 15:24:02 +08:00
fisker Cheung fe4302d987 Fix v-on print (#16733) 2024-10-18 22:32:59 +08:00
fisker Cheung 02200375bc Print declare before accessibility in class properties (#16731) 2024-10-18 21:13:39 +08:00
fisker Cheung d973283c16 Fix space between class heritage and class body (#16730) 2024-10-18 21:12:30 +08:00
fisker Cheung b19139acb7 Support TLA for typescript parser (#16729) 2024-10-18 21:11:55 +08:00
Tatsunori UchinoandSUZUKI Sosuke 0a4c1e303f Markdown: Don't break a line at the place around Chinese or Japanese characters (#16691)
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2024-10-18 15:03:09 +08:00
43feccbf37 Fixed wrong trailing comma position after comment in scss (#16617)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Cyrille David <dcyriller@users.noreply.github.com>
2024-10-10 16:15:00 +08:00
SUZUKI Sosukeandfisker 973f3b5940 Fix formatting of incomplete CSS value comments (#16583)
Co-authored-by: fisker <lionkay@gmail.com>
2024-10-10 13:15:06 +08:00
fisker Cheung ab00c1c919 Remove support for "importReflection" (#16705) 2024-10-08 22:03:37 +08:00
Fu YuchenandSUZUKI Sosuke 1ce5eeea77 Fix yaml comment in non-singleline items missing space before # (#16489)
Co-authored-by: SUZUKI Sosuke <aosukeke@gmail.com>
2024-10-01 20:54:46 +09:00
fisker Cheung 4b9c16703c Remove support for DecimalLiteral (#16643) 2024-09-29 17:13:12 +08:00
Mark Ameryandfisker Cheung d28d40ac0c Reduce how much text needs to be diffed when computing cursor positions (#15709)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-09-27 21:35:32 +08:00
Tatsunori Uchinoandfisker Cheung a4be6a0fde Markdown: preserve non-ASCII whitespaces at the end of the line and beginning of the next line (#16619)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-09-27 21:07:12 +08:00
6168d1e990 Removed excessive spaces after line prefixes for unordered lists in Markdown (#15526)
Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
2024-09-27 19:58:11 +08:00
Marcus Pettersen Irgensandfisker Cheung 5bb04801a2 Ignore files in the Jujutsu directory (#16684)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-09-27 19:53:37 +08:00
Seiya 3fd32a0258 Fix rule of fill violations in CSS (#16570) 2024-09-08 18:03:46 +08:00
fisker Cheung 5cd15f2168 Fix SCSS parenthesized value group print (#16607) 2024-08-26 08:23:31 +08:00
SUZUKI Sosuke 92253a3f40 Improve comment formatting for logical expression in unary expression (#16593) 2024-08-24 08:22:43 +09:00
SUZUKI Sosuke f675f9f3c0 Don't print an extra line break for arrow function with type parameter in assignment (#16586)
* Dont print extra softline

* Update snapshot

* Add changelog
2024-08-19 11:05:32 +09:00
SUZUKI Sosuke f7cceb9be1 Preserve a comment between modifier and the decorated property name (#16578) 2024-08-16 13:12:24 +09:00
SUZUKI Sosuke bd3ad84c29 Preserve a comment on between decorator and modified parameter property (#16574) 2024-08-15 16:03:53 +09:00
SUZUKI Sosuke 1dfe28f857 Remove extra indentation in pseudo class function (#16572) 2024-08-14 09:52:53 +09:00
SUZUKI Sosuke 3cf3f5ac29 Make getPreferredQuote public (#16567) 2024-08-14 09:34:58 +09:00
SUZUKI Sosuke 44a35adfa8 Don't remove uselsess \ in string literals (#16563) 2024-08-14 07:53:22 +09:00
Seiya e977d65b19 Fix incorrect wrap in sentence with linkReference (#16546) 2024-08-10 00:27:47 +01:00
fisker Cheung 820b47bf51 Fix changelog for #13315 (#16524) 2024-07-29 09:34:40 +01:00