Commit Graph
101 Commits
Author SHA1 Message Date
fisker Cheung b3d1f8cdc2 Add mjml parser (#17339) 2025-04-14 08:12:53 +08:00
fisker Cheung 64e7dab1fd Fix links to Prettier/Babel/Jest website (#17079) 2025-02-15 12:18:09 +08:00
Will Slattum ef7aae3964 docs: fix content change from docusaurus migration (#17059) 2025-01-31 09:32:26 +08:00
Lehoczky Zoltánandfisker Cheung 6a612520bc Migrate from Docusaurus 1 to Docusaurus 3 (#17043)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2025-01-30 10:16:21 +08: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
Alex Piechowski 509a0cc10f Add oxford comma to Single Attribute Per Line doc (#16566) 2024-08-13 07:33:07 +09:00
fisker Cheung 1dc924f2f2 Add jsonc parser (#15831) 2024-01-02 10:59:34 +08:00
Mark Amery 1e30f66f39 Remove claim, untrue since over 5 years ago, that cursorOffset is incompatible with rangeStart/rangeEnd (#15750) 2023-12-08 16:35:02 +02:00
SUZUKI Sosuke 56945ecf12 Update trailingComma: es5 document (#15555) 2023-10-28 01:52:39 +09:00
4aa5fd1c79 New Ternary Formatting: A Curious Case of the Ternaries (#13183)
Co-authored-by: Alex Rattray <rattrayalex@stripe.com>
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2023-10-09 10:44:30 +09:00
Corey Thompson 281072befd Correct typo (#14618) 2023-03-29 04:36:19 +08:00
fisker 883324dbb6 Merge branch 'main' into next
# Conflicts:
#	scripts/tools/bundle-test/package.json
#	scripts/tools/bundle-test/yarn.lock
#	src/language-js/needs-parens.js
#	tests/format/typescript/typeof/jsfmt.spec.js
#	website/package.json
#	website/yarn.lock
2023-03-18 08:57:03 +08:00
MaximAL 0894348de8 Add note about SmartTabs (#14428)
I think it’s worth noticing for those who search for SmartTab-related tool (as I did, for example).
2023-03-11 23:52:59 +09:00
fisker Cheung b1ef30dd17 Merge branch 'main' into next
# Conflicts:
#	docs/browser.md
#	package.json
#	src/language-js/comments/handle-comments.js
#	src/language-js/needs-parens.js
#	src/language-js/print/type-parameters.js
#	yarn.lock
2023-02-08 12:37:23 +08:00
Riad Krim f602be5a47 Update embeddedLanguageFormatting option documentation (#14048) 2023-01-31 08:16:17 +08:00
fisker Cheung 9411aa2e47 Merge branch 'main' into next
# Conflicts:
#	changelog_unreleased/typescript/13764.md
#	package.json
#	scripts/release/yarn.lock
#	src/language-js/parse/postprocess/typescript.js
#	yarn.lock
2022-11-18 14:27:23 +08:00
fisker Cheung ae4d85ab3c Update description of vueIndentScriptAndStyle option (#13781) 2022-11-04 11:14:12 +08:00
fisker CheungandGeorgii Dolzhykov 0b9cb96f58 Remove support for custom parser api (#13250)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2022-08-08 01:09:10 +08:00
Georgii Dolzhykov 67efa96da6 Custom parser API: deprecation notice (#13252) 2022-08-07 14:12:17 +03:00
fisker Cheung 83400d19b4 Change default value of trailingComma to "all" (#11479) 2022-08-01 11:05:17 +08: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
fisker Cheung 9691e7bc37 Add acorn parser (#12172) 2022-01-28 15:25:30 +08:00
Joel Bradshawandfisker Cheung 38b5b98393 Clarify documentation around proseWrap (#12134)
* Clarify documentation around proseWrap

These docs were a bit misleading, describing never as "opt-out" when it in fact can result in massive changes in an existing wrapped file is confusing, and referring to the default behavior as "wrapping as-is" is confusing, because Prettier isn't actually doing any wrapping - it's just leaving it as-is. Hopefully this is clearer.

* Update stable version docs

Co-authored-by: fisker Cheung <lionkay@gmail.com>
2022-01-26 00:33:05 +09:00
fisker Cheung 011672669e Merge branch 'main' into next
# Conflicts:
#	package.json
#	yarn.lock
2021-12-07 15:15:42 +08:00
Jere Kankaanrantaandfisker Cheung 82e6937d50 Added changelog and updated the "first available in" version for singleAttributePerLine (#11934)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2021-12-07 14:13:26 +08:00
Jere Kankaanranta 0e42acb49b feat: added singleAttributePerLine option (#5501) (#6644) 2021-12-02 11:46:11 +03:00
fisker Cheung 0d6d47b30a Merge branch 'main' into next
# Conflicts:
#	package.json
#	yarn.lock
2021-12-01 16:35:15 +08:00
Chris Midgley 2160e11061 docs: add docs for editorconfig to configuration and options (#11883) 2021-11-30 16:24:07 -03:00
fisker Cheung beba6fa88c Merge branch 'next' of github.com:prettier/prettier into next
# Conflicts:
#	package.json
#	yarn.lock
2021-09-08 12:54:17 +08: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 85fc1fa017 Merge branch 'main' into next
# Conflicts:
#	package.json
#	src/language-css/printer-postcss.js
#	yarn.lock
2021-03-29 19:47:56 +08:00
Georgii Dolzhykov 33ab1fccc8 Clarify docs about pragma (#10500) 2021-03-10 03:40:15 +02:00
fisker Cheung d3c58df606 Merge branch 'main' into next
# Conflicts:
#	package.json
#	src/language-css/utils.js
#	yarn.lock
2021-03-08 17:38:10 +08:00
Georgii Dolzhykov aef9277ada Print trailing comma for TS type parameters but not type arguments (#10353) 2021-02-20 12:47:56 +02:00
Georgii Dolzhykov 3a73f48a0e Don't use smart quotes for JSON5 with --quote-props=preserve (#10323) 2021-02-15 19:13:33 +02:00
Cyrille David 5aa057b40b Handlebars: Default --html-whitespace-sensitivity to strict (#10201)
* Handlebars: Default --html-whitespace-sensitivity to strict

* Record tests other than handlebars

* Trim trailing newlines

* Record tests

* Fix rebase

* Record all tests not only hbs

* Fix the idempotency issue

Adjust dedent for the last child node

* Fix the annoying trailing whitespace

* Trim isolated leading newline
2021-02-11 15:43:07 +02:00
Georgii Dolzhykov 343d372845 Document that Prettier never unquotes numeric properties in TS and Flow (#10126)
* Document that Prettier never unquotes numeric properties in TS and Flow

* Add Angular

* Mention Vue
2021-01-26 20:17:30 +02:00
sosukesuzuki 8436923960 Merge branch 'master' into next 2021-01-23 13:15:50 +09:00
Cyrille DavidandGeorgii Dolzhykov 949c36190f Document --htmlWhitespaceSensitivity option for Handlebars (#10079)
* Document htmlWhitespaceSensitivity for Handlebars

* Update options.md

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2021-01-19 16:49:19 +02:00
fisker fdfb6ff312 Merge branch 'master' into next
# Conflicts:
#	docs/options.md
#	package.json
#	scripts/build/bundler.js
#	src/language-css/printer-postcss.js
#	yarn.lock
2021-01-11 14:26:20 +08:00
fisker CheungandSosuke Suzuki 6df49ad078 Fix link to babel website (#9856)
Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2020-12-12 23:10:01 +02:00
fisker 114fe2e6cc Fix typo 2020-11-20 13:34:43 +08:00
fisker 81303dab8c Docs: Add missing meriyah parser 2020-11-20 13:24:02 +08:00
fisker Cheung 8616182e95 Revert #9500 (#9584) 2020-11-09 16:47:12 +08:00
Sosuke Suzukiandfisker f7554c62a2 Revert breaking changes related to adding pure css parser for minor releasing (#9500)
* revert without tests

* Downgrade postcss-scss and postcss-less

* Fix tests

* Revert "Make `isSCSS*` function stricter (#9093)"

This reverts commit 01f986bea9.

* Revert "Remove `css` parser from `isLessParser` check (#9092)"

This reverts commit c0bca1805d.

* Revert "Add pure css parser (#7933)"

This reverts commit 589ebf670b.

* Disable `parser-postcss.js` minify

* Try to fix build script

* Update fs.mjs

* Update fs.mjs

* Style

Co-authored-by: fisker <lionkay@gmail.com>
2020-10-31 22:22:35 +09:00
fisker CheungandChris Brody 73e3976c34 Add espree parser (#9000)
Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
2020-10-13 09:14:02 +08:00
fisker Cheung 589ebf670b Add pure css parser (#7933) 2020-08-28 13:07:49 +08:00
Ted Mokeandfisker Cheung 7348a9de14 Docs: Fix links (#8850)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
2020-07-28 20:19:10 +08:00
554b15473d Document recommended setup and improve docs overall (#8510)
Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-06-28 09:47:29 +08:00