Commit Graph
46 Commits
Author SHA1 Message Date
fisker Cheung 69ed5dad2a Fix code frames for glimmer and hermes parser (#19163) 2026-05-19 02:58:09 +08:00
fisker Cheung 5017d66ea7 Test: Update printWidth indicator (#10293) 2026-01-31 03:45:41 +08:00
fisker Cheung 7ca5d83e45 Move parser name to end in test title (#18745) 2026-01-25 11:53:51 +08:00
fisker Cheungandautofix-ci[bot] ed5bb0bf62 Refactor tests (#18743)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-25 10:30:19 +08:00
fisker Cheung a7b8a4f77d Avoid linebreaks in embedded template interpolations (#18380) 2025-12-06 14:45:25 +08:00
Seiyaandfisker Cheung 9266e3e85b Add resolved test cases (#18358)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2025-11-29 15:11:52 +08:00
fisker Cheung 40d4bb1815 Remove redundant parentheses around JSX element (#18243) 2025-11-16 20:37:39 +08:00
fisker Cheung d548a87684 Fix a miss used willPrintOwnComments (#18166) 2025-10-31 09:02:39 +08:00
renovate[bot]andfisker a6bbdad8ca chore(deps): update dependency jest to v30.1.1 (#17819)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2025-08-30 15:36:22 +08: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 Cheung 9e814108ca Add oxc-ts parser (#17483) 2025-05-27 13:32:23 +08:00
fisker Cheungandautofix-ci[bot] c26d23c955 Add oxc parser (#17472)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-27 09:35:31 +08:00
fisker Cheung b289ecbb19 Remove support for tupleAndRecord (#17363) 2025-04-17 04:53: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
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
fisker Cheung b19139acb7 Support TLA for typescript parser (#16729) 2024-10-18 21:11:55 +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
fisker Cheung d2c415deae Update meriyah to v6 (#16667) 2024-09-18 19:48:57 +08:00
Klaus Hott Vidalandfisker 16449ce914 renaming jsfmt.spec.js to format.test.js (#16244)
Co-authored-by: fisker <lionkay@gmail.com>
2024-05-06 10:25:10 +08:00
fisker Cheung 6eda34db44 Test: Rename run_spec to runFormatTest (#15943) 2024-01-19 17:20:24 +08:00
Eelco Lempsink 0bfcb2d5a5 Fix css embed in JSX when using (only) a spread attribute (#15896) 2024-01-14 11:42:25 +09:00
Kevin Gibbons cb6fea81fb Avoid introducing linebreaks in template interpolations (#15209) 2023-12-17 18:10:20 +08:00
fisker Cheung b15d287f81 Update Jest to v30 (#15580) 2023-11-27 23:25:58 +08:00
Alex RattrayandAlex Rattray f25a592f57 Add indentation back to nested ternaries (#9559)
* Add indentation back to nested ternaries (except JSX)

* Add a real-world test case

* Add changelog entry

---------

Co-authored-by: Alex Rattray <rattrayalex@stripe.com>
2023-09-24 15:13:00 -04:00
Sosuke Suzuki fa48415617 Bump Prettier dependency to 3.0.0 2023-07-05 21:50:05 +09:00
Seiyaandfisker Cheung 7f64e920de Make curried arrow function and normal arrow function consistent (#14633)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2023-04-27 11:01:35 +08:00
fisker Cheung bec997e85c Fix cursor tracking inside JSXText (#14163) 2023-04-10 10:44:31 +08:00
fisker Cheung 5cdc3ab2dd Support print ChainExpression (#13735) 2023-02-13 10:11:40 +08:00
fisker CheungandGeorgii Dolzhykov add84358d8 Remove flow plugin from babel parser (#14314)
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2023-02-10 17:27:17 +08:00
fisker Cheung 97c8e3c18f Run JSX tests on acorn, espree and meriyah (#10494) 2023-02-01 14:20:36 +08:00
fisker Cheung 468c514ba2 Fix inconsistent between array/tuple and object/record (#14065) 2023-01-04 15:07:07 +08:00
fisker Cheung f65768d00a Merge branch 'main' into next
# Conflicts:
#	package.json
#	scripts/release/yarn.lock
#	src/language-css/parser-postcss.js
#	src/language-css/printer-postcss.js
#	src/language-js/print/jsx.js
#	src/language-json/printer-estree-json.js
#	website/yarn.lock
#	yarn.lock
2023-01-04 14:25:53 +08:00
fisker Cheung e301b1f9ce Fix comments inside JSX attributes (#14082)
Fixes https://github.com/prettier/prettier/issues/11242
2022-12-30 10:36:58 +08:00
Sosuke Suzuki a8869bef55 Merge branch 'main' into next 2022-12-08 22:00:17 +09:00
Alex Rattray 28d097bbf5 Add test cases for questioning ternaries (#13952)
## Description

Extracts test cases that I added for https://github.com/prettier/prettier/pull/13183 to make it easier to visualize the changes that PR makes, as @vjeux [requested](https://github.com/prettier/prettier/pull/13183#discussion_r990820889).

## Checklist

<!-- Please ensure you’ve done all of these things (if applicable). -->
<!-- You can replace the `[ ]` with `[x]` to mark each task as done. -->

- [x] I’ve added tests to confirm my change works.
- [x] I’ve read the [contributing guidelines](https://github.com/prettier/prettier/blob/main/CONTRIBUTING.md).

<!-- Please DO NOT remove the playground link -->

**✨[Try the playground for this PR](https://prettier.io/playground-redirect)✨**
2022-12-07 15:46:40 -05:00
fisker Cheung 83400d19b4 Change default value of trailingComma to "all" (#11479) 2022-08-01 11:05:17 +08:00
fisker Cheung 6016404f59 Merge branch 'main' into next
# Conflicts:
#	.eslintrc.cjs
#	.github/workflows/prod-test.yml
#	.github/workflows/validate-vendors.yml
#	scripts/build/bundler.mjs
#	scripts/vendors/bundle-vendors.mjs
#	scripts/vendors/utils.mjs
#	scripts/vendors/vendor-meta.json
#	scripts/vendors/vendors.mjs
#	src/cli/logger.js
#	src/cli/options/get-options-for-file.js
#	src/cli/options/parse-cli-arguments.js
#	src/common/util.js
#	src/language-html/utils/html-tag-names.js
#	tests/integration/__tests__/bundle.js
#	tests/integration/__tests__/loglevel.js
#	tests/integration/run-prettier.js
#	vendors/string-width.js
2022-04-06 15:41:50 +08:00
dependabot[bot]andfisker Cheung b1e96cde95 Build(deps): Bump meriyah from 4.2.0 to 4.2.1 (#12567)
* Build(deps): Bump meriyah from 4.2.0 to 4.2.1

Bumps [meriyah](https://github.com/meriyah/meriyah) from 4.2.0 to 4.2.1.
- [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/v4.2.0...v4.2.1)

---
updated-dependencies:
- dependency-name: meriyah
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add test for https://github.com/meriyah/meriyah/commit/6de707a0efb3053767deaa36b1ed6979b0d3f873

* Test https://github.com/meriyah/meriyah/commit/37c63613771e5bc6e23b7da2d92e992c60dafc5a

* Test https://github.com/meriyah/meriyah/commit/d757c6b20ae4f6f4e55a77179726db36cf2bd50b

* Add changelog

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-04-02 20:13:21 +09:00
fisker Cheung f0b63f3dff Merge branch 'main' into next
# Conflicts:
#	CONTRIBUTING.md
#	cspell.json
#	docs/options.md
#	package.json
#	scripts/build/bundler.mjs
#	src/language-css/loc.js
#	src/language-css/parser-postcss.js
#	src/language-css/utils/index.js
#	tests/format/js/arrows-bind/jsfmt.spec.js
#	tests/format/js/async-do-expressions/jsfmt.spec.js
#	tests/format/js/bind-expressions/jsfmt.spec.js
#	tests/format/js/classes/top-level-super/jsfmt.spec.js
#	tests/format/js/comments-pipeline-own-line/jsfmt.spec.js
#	tests/format/js/decorator-comments/jsfmt.spec.js
#	tests/format/js/decorators-export/jsfmt.spec.js
#	tests/format/js/decorators/jsfmt.spec.js
#	tests/format/js/do/jsfmt.spec.js
#	tests/format/js/export-default/escaped/jsfmt.spec.js
#	tests/format/js/export-extension/jsfmt.spec.js
#	tests/format/js/export-star/jsfmt.spec.js
#	tests/format/js/exports/jsfmt.spec.js
#	tests/format/js/invalid-code/jsfmt.spec.js
#	tests/format/js/logical-assignment/jsfmt.spec.js
#	tests/format/js/multiparser-invalid/jsfmt.spec.js
#	tests/format/js/no-semi-babylon-extensions/jsfmt.spec.js
#	tests/format/js/object-property-comment/jsfmt.spec.js
#	tests/format/js/partial-application/jsfmt.spec.js
#	tests/format/js/pipeline-operator/jsfmt.spec.js
#	tests/format/js/private-in/jsfmt.spec.js
#	tests/format/js/record/jsfmt.spec.js
#	tests/format/js/reserved-word/jsfmt.spec.js
#	tests/format/js/strings/jsfmt.spec.js
#	tests/format/js/throw_expressions/jsfmt.spec.js
#	tests/format/js/trailing-whitespace/jsfmt.spec.js
#	tests/format/js/v8_intrinsic/jsfmt.spec.js
#	tests/format/misc/errors/js/literal/jsfmt.spec.js
#	tests/format/misc/errors/js/object/jsfmt.spec.js
#	tests/format/misc/errors/js/variable-declarator/jsfmt.spec.js
#	tests/integration/__tests__/bundle.js
#	tsconfig.json
#	yarn.lock
2022-02-09 09:22:32 +08:00
Jed Fox f29a7565e9 Collapse JSXExpressionContainer → AwaitExpression → JSXElement (#12109) 2022-01-16 14:59:22 -05:00
Jed Fox 920283a1dd Inline await expressions in JSX (#12088) 2022-01-15 16:00:39 -05:00
fisker CheungandSosuke Suzuki 6bd81c23b6 Migrate format test to ES Module (#11902)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2022-01-04 17:00:25 +08:00
Jere Kankaanranta 0e42acb49b feat: added singleAttributePerLine option (#5501) (#6644) 2021-12-02 11:46:11 +03:00
4992d97203 Deprecate jsxBracketSameLine option in favour of multi-language bracketSameLine option (#11006)
* deprecate jsxBracketSameLine in favour of multi-language angleBracketSameLine option

* update docs and snapshots

* update tests to to make them more reviewable

* Rewrite angular tests

* Rewrite html tests

* Rewrite vue tests

* Restore unnecessary changes in jsx

* Fix file location

* Test both `true` and `false`

* Revert changes in markdown

* Run tests on all js parsers

* Improve html test

* fix changelog comment

* move bracketSameLine to common options

* mark jsxBracketSameLine as deprecated

* Update changelog_unreleased/html/11006.md

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

* Update 11006.md

* fix tests by removing `jsxBracketSameLine` `default` property

* fix style

* Revert docs under website dir

* Add tests for deprecated options

* Fix lint problems

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
2021-08-31 11:47:50 +09:00
fisker Cheung ece93681f1 Restructure test files (#10415) 2021-04-25 20:01:56 +08:00