Commit Graph
121 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
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
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
fisker Cheung e0117a165b Add Knip (#16653) 2024-09-18 16:40:10 +08:00
Seiya c921abee76 Improve computational time complexity for printing fill() (#16595) 2024-08-24 08:23:59 +09: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
fisker Cheung c03a12ad2b Enable require-unicode-regexp and regexp/strict rule (#16408) 2024-06-18 07:52:54 +09:00
fisker Cheung b94811f988 Fix stripTrailingHardline (#16347) 2024-06-04 17:33:09 +08:00
5ceeccf38d chore(deps): update dependency typescript to v5.4.3 (#16181)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: Sosuke Suzuki <sosuke.suzuki@dr-ubie.com>
2024-04-08 14:26:54 +08:00
Seiya 063978a592 Correct invalid fill() in markdown paragraph print (#16158) 2024-04-06 19:25:30 +09:00
fisker Cheung 384e2b4959 Remove getDocParts (#16026) 2024-02-04 14:33:39 +08:00
Alexander Kachkaev 1ea2fd059a Add eslint-plugin-simple-import-sort (#15817) 2023-12-18 03:34:12 +08:00
Sosuke Suzuki eebf0e4b5e Bump Prettier dependency to 3.1.0 2023-11-13 12:00:57 +09:00
Klaus Hott Vidal 347c60730e Missing types (#15287)
* adding missing public util functions to the util namespace

* adding missing `id` to the Group interface and `label`, and `contents` to the `Label` interface
2023-08-24 15:47:28 +09:00
Sosuke Suzuki fa48415617 Bump Prettier dependency to 3.0.0 2023-07-05 21:50:05 +09:00
fisker Cheung a78e514d77 Improve doc printer when printWidth: Infinity (#14638) 2023-03-31 16:47:26 +08:00
fisker Cheung 6d21de11fd Update plugin build system (#14571) 2023-03-24 08:44:25 +08:00
fisker Cheung a07927aa11 Refactor estree main print function (#14473) 2023-03-13 09:13:27 +08:00
fisker Cheung 57b37a3c27 Move propagateBreaks to printDocToString (#14466) 2023-03-07 20:42:14 +08:00
fisker Cheung 134f6078e1 Add document/public.js to export public apis, remove internal utils (#14456) 2023-03-07 08:54:11 +08:00
SUZUKI Sosukeandfisker Cheung 813df18df6 Moves @types/prettier to this repository (#14212)
* Rename `types` to `thirs-party-types`

* Copy `index.d.ts` from `@types/prettier`

* Make public APIs async

* Add missing `formatAST`

* Fix `CustomParser`

* Fix `Parser.parse` signature

* Add comment

* Add `standalonw.d.ts`

* first implement

* Fix path

* Add missing parser `.d.ts`

* Fix

* Fix path

* Introduce valid tests

* Add unit tests for dts files

* Add unit tests

* Simplify unit testing

* Tweaks structures

* Revert needless change

* Fix types path

* Introduce `ts-expect`

* Fix doc utils api

* Add AstPath API

* Fix API

* Fix tests

* Fix changelog

* Move dts

* Update module specifiers

* Remove generate dts config file

* Update build scripts

* Fix type errors

* Refactor with namespace imports

* Update comments

* Fix build script

* Improve build script

* `typing` -> `types`

* Clean up

* Minor tweak

* Minor tweak

* Modify `exports` field

* Fix paths in builder

* Refactor

* Refactor

* Address review

* Update changelog

* Address reviews

* Remove `since` from tests

* Improve utils type def

* Mark deprecated methods

* Address review

* Move docs types

* Address review

* Update c8 config

* Minor tweak

---------

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2023-02-23 22:15:18 +09:00
fisker CheungandSosuke Suzuki 01a9241959 Improve assertDoc (#13917)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2023-01-11 11:22:10 +08:00
fisker Cheung 9fd8dbed88 Skip measure width of last string in printDocToString (#13894) 2022-12-19 13:30:50 +08:00
fisker Cheung ff43f661ed Update browserslist (#13884) 2022-11-23 19:27:45 +08:00
renovate[bot]andfisker 6959f30a81 Update dependency eslint-plugin-unicorn to v45 (#13876)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2022-11-21 23:41:27 +08:00
fisker Cheung 59eda43d71 Use optional chaining where possible (#13773) 2022-11-03 14:23:07 +08:00
fisker Cheung 81b8726d0f Make flatContents in ifBreak default to "" (#13700) 2022-10-25 10:20:44 +08:00
fisker Cheung 9cf73d3610 Use c8 ignore comments (#13683) 2022-10-22 23:33:08 +08:00
fisker Cheung 0e06cc4d62 Minor refactor to stripTrailingHardline (#13695) 2022-10-21 23:33:33 +08:00
fisker Cheung 8c93abf557 Enable unicorn/switch-case-braces rule (#13585) 2022-10-08 10:44:30 +08:00
fisker Cheung f3d1790533 Enable logical-assignment-operators rule (#13529) 2022-09-29 10:40:13 +08:00
Lipisandfisker Cheung 4ed2d3c4bc style: Add new ESLint rule no-lonely-if and unicorn/no-lonely-if (#10176)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-09-29 10:25:54 +08:00
Georgii Dolzhykov 6d4d011252 Fix unstable embedded template literals (#13532) 2022-09-26 16:24:41 +03:00
fisker Cheung 9bacc75772 Use .at() and Object.hasOwn() (#13482) 2022-09-18 17:50:14 +08:00
Georgii Dolzhykov 5766433a62 Get rid of regexp and handle cursor in trim in doc printer (#13426) 2022-09-06 15:57:47 +03:00
fisker Cheung 05922176b9 Simplify print command trim (#13314) 2022-08-31 17:46:22 +08:00
fisker Cheung d0f0b09d1b Replace replaceTextEndOfLine with replaceEndOfLine (#13343) 2022-08-27 19:14:07 +08:00
fisker Cheung 5c465a77b3 Check all types in traverseDoc (#13357) 2022-08-27 18:41:33 +08:00
fisker Cheung d921087d12 Throw errors when too many 'cursor' found in doc (#13339) 2022-08-26 21:33:49 +08:00
fisker Cheung 75025561c4 Return undefined for invalid doc type (#13306) 2022-08-25 19:18:26 +08:00
fisker Cheung edf36039f9 Add test for traverseDoc and findInDoc (#13349) 2022-08-25 01:12:41 +03:00
fisker Cheung f33ae9f583 Check all types in cleanDoc (#13348) 2022-08-23 16:14:48 +08:00
fisker Cheung 4959b7c113 Check all doc types in mapDoc (#13344) 2022-08-23 09:49:45 +08:00
fisker Cheung e28ae2670c Remove placeholder from doc.builders.cursor (#13312) 2022-08-22 19:21:30 +08:00
fisker Cheung 49cd8be0b8 Minor refactor to mapDoc (#13305) 2022-08-22 18:38:18 +08:00
fisker Cheung 88c178c17f Minor refactor to cleanDoc (#13304) 2022-08-22 18:04:32 +08:00
fisker Cheung 968ea2e444 Use symbol for doc print mode (#13313) 2022-08-22 12:16:20 +08:00
fisker Cheung aa3158d43e Move groupModeMap into printDocToString (#13311) 2022-08-20 21:12:07 +08:00
fisker Cheung 3e9e9ddec7 Imporve error message for InvalidDocError (#13248) 2022-08-07 14:13:03 +03:00
fisker Cheung 7abc9bcb07 Remove stripTrailingHardline option in textToDoc (#13220) 2022-08-07 18:15:24 +08:00