Commit Graph
323 Commits
Author SHA1 Message Date
fisker Cheung 561d62a212 Fix comment attach in ForXStatement (#18099) 2025-10-19 18:49:23 +08:00
fisker Cheung 66eaaaa69a Use printObject to print import attributes (#17329) 2025-10-19 18:37:06 +08:00
fisker Cheung 3a3db39b32 Improve comment handling between if statement condition and the "body" (#17998) 2025-10-11 16:13:44 +08:00
fisker Cheung 05b1a783d1 Use printCallExpression to print TSExternalModuleReference (#18035) 2025-10-11 01:08:24 +08:00
fisker Cheung fc7da89a54 Improve require() call with comments (#18037) 2025-10-10 23:43:08 +08:00
a5296b3d7b Prevent break long module name in more places (#17908)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2025-09-23 04:14:17 +08:00
fisker Cheung 1520a58879 Fix format of comments around ChainExpression (#17723) 2025-09-12 05:01:51 +08:00
Konv Suuandfisker 4df75d090d Avoid break ImportExpression with long module name (#17882)
Co-authored-by: fisker <lionkay@gmail.com>
2025-09-11 16:18:03 +08:00
Ben Scott 7e3288f4cf Add extra playwright test functions (#17876) 2025-09-10 11:22:31 +08:00
fisker Cheungandautofix-ci[bot] 95ef24d1f0 Support "Discard Bindings" proposal (#17708)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-04 15:41:42 +08:00
fisker f67b32ba66 Clean changelog_unreleased 2025-06-23 10:10:54 +08:00
a24878a1e2 3.6 blog post (#17636)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2025-06-23 10:04:03 +08:00
SUZUKI Sosuke 0ef2086cc9 Fix English grammer in changelog_unreleased (#17635) 2025-06-22 14:58:35 +09:00
Seiyaandautofix-ci[bot] 84ee9016ba Get JSX in arrow in method call to be consistent (#17616)
* add failing test

* fix #17489

* add more tests

* refactor ...but perhaps get ugly? I'm not sure

* Apply automated changes

* utilize path.match

* add changelog

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-22 00:51:13 +09:00
fisker Cheungandautofix-ci[bot] f41214b2f1 Add changelog for hermes and oxc plugin (#17629)
* Add changelog for `hermes` and `oxc` plugin

* Apply automated changes

* Move to `flow/`

* Spellcheck

* Reword

* Reword

* Apply automated changes

* Fix

* Reword

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-22 00:49:06 +09:00
fisker Cheung 7a91dc4a59 Revert "Support type cast comments for espree parser (#17587)" (#17614) 2025-06-19 15:49:38 +08:00
fisker Cheung 17cdff607a Support type cast comments for meriyah parser (#17600) 2025-06-13 17:27:07 +08:00
fisker Cheung 3b0f33539f Support type cast comments for espree parser (#17587) 2025-06-13 16:56:42 +08:00
fisker Cheung 242b524eb1 Fix optional chaining as computed key (#17486) 2025-05-28 03:26:56 +08:00
fisker Cheung 441cb1e132 Fix comments in tagged template literal (#17510) 2025-05-27 09:08:27 +08:00
2e78cb5834 Support type cast comments for acorn parser (#17491)
Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-20 14:38:34 +08:00
fisker Cheung 2349a6ee6f Fix inconsistent assignment format (#17469) 2025-05-15 11:27:32 +08:00
fisker Cheungandautofix-ci[bot] b5378edeeb Fix inconsistent member chain format (#17470)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-15 11:27:22 +08:00
SUZUKI Sosukeandautofix-ci[bot] d3332e06d3 Preserve spaces between CSS words and embedded expression (#17398)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-04-25 10:11:50 +08:00
fisker Cheung b289ecbb19 Remove support for tupleAndRecord (#17363) 2025-04-17 04:53:05 +08:00
fisker Cheung 6a3c132be4 Add parentheses to numbers in optional member expression (#17190) 2025-03-05 02:47:46 +08:00
fisker Cheung 73d26d777d Add parentheses to AssignmentExpression in class property keys (#17145) 2025-02-26 14:07:05 +08:00
ff3bb50881 Add parentheses to SequenceExpression in ReturnStatement and ExpressionStatement (#17085)
Co-authored-by: tongyu <tongyu10287@xwtec.cn>
Co-authored-by: fisker <lionkay@gmail.com>
2025-02-26 11:44:37 +09:00
Sosuke Suzuki 3fe8152c5c Clean changelog_unreleased 2025-02-09 20:45:20 +09:00
SUZUKI Sosuke 5ed5dc0b8a Fix a link in changelog (#17088) 2025-02-09 19:58:53 +09:00
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
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
fisker 6c7460a5d7 Clean changelog_unreleased 2024-12-04 15:06:20 +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
Sosuke Suzuki f53791a2c8 Clean changelog_unreleased 2024-11-26 13:53:25 +09:00
fisker Cheung 6b582a0619 Improve string print perfomance (#16763) 2024-11-04 15:24:02 +08:00
fisker Cheung ab00c1c919 Remove support for "importReflection" (#16705) 2024-10-08 22:03:37 +08:00
fisker Cheung 4b9c16703c Remove support for DecimalLiteral (#16643) 2024-09-29 17:13:12 +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 44a35adfa8 Don't remove uselsess \ in string literals (#16563) 2024-08-14 07:53:22 +09:00
fisker Cheung 820b47bf51 Fix changelog for #13315 (#16524) 2024-07-29 09:34:40 +01:00
Sung Ye Inandfisker Cheung 4a39c117d1 Handle exception in needs parens with optional chaining (#16500)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-07-27 15:11:27 +08:00
fisker CheungandAlexander Kachkaev c60eb83d59 Stop mutate doc.parts when printing fill (#13315)
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
2024-07-26 19:51:00 +08:00
Sosuke Suzuki a0cde0ad88 Clean changelog_unreleased 2024-07-13 21:27:55 +09:00
Christopher Dignamandfisker Cheung 988b43b72d Add parens for nullish coalescing in tenary (#16391)
* add parens for nullish coalescing

fix #4873

* add function

* Update tests/format/js/nullish-coalescing/nullish_coalesing_operator.js

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

* update snapshot

* add changelog entry

* fix typo

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2024-06-18 01:47:28 +01:00
fisker cdd480e1b6 Clean changelog_unreleased 2024-06-05 17:23:57 +08:00
fisker CheungandAlexander Kachkaev efc3d053ac Avoid line breaks in import attributes (#16349)
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
2024-06-05 17:01:58 +08:00
Sosuke Suzuki 2406fee590 Clean changelog_unreleased 2024-06-02 02:04:43 +09:00