jscheid / prettier.el

Prettier code formatting for Emacs.
GNU General Public License v3.0
172 stars 12 forks source link

Support for Prettier 3 #124

Closed asbish closed 1 year ago

asbish commented 1 year ago

Closes https://github.com/jscheid/prettier.el/issues/125

Prettier will probably not support the 2.x from now on, but at this stage, I think there are some projects still using the 2.x so I'd like to provide support it for some period of time. Also, I've made changes to enable multiple versions of Prettier test. The root of workspace is now set in test-stable and test-v2 respectively to prevent package hoisting.

With the increased number of test cases, I'm considering the possibility of removing some external plugin tests in the modes. So far, the following modes(plugins) are not included in test-stable.

Ref: https://prettier.io/blog/2023/07/05/3.0.0.html#api-1

Tasks:

jscheid commented 1 year ago

Amazing @asbish , thank you! It was on my list as well but I haven't found the time yet, so glad you're taking a stab at this.

I'm going to be traveling for the next 3-4 weeks and I might not be very responsive during this time.

asbish commented 1 year ago

Good! I've made it public so that anyone who needs or wants to use it can access it. I think it will take a while it to be open and I'll add some changes to the commits. However this PR will work in Prettier version 2.8.8, 3.0.0 and 3.0.0(Yarn PnP). It is noted that there is one issue for Yarn PnP at the moment, but yarn unplug prettier can solve it.

Update: This PR's status is Open now.

bard commented 1 year ago

@jscheid is the following from https://github.com/jscheid/prettier.el/blob/master/RELEASING.md#installing-prs still true?

A tarball is generated for every pull request. It can be downloaded by going to the Github pull request page, clicking on "Details" for the topmost check (called something like "build (26.3)"), then on "Artifacts" and finally on "prettier.tar".

I wanted to start using this but I couldn't see "Artifacts" on https://github.com/jscheid/prettier.el/actions/runs/5646979357/job/15296088996?pr=124 anywhere.

asbish commented 1 year ago

@bard Thank you for trying to use it. You can download the artifact at the very bottom of this page.

bard commented 1 year ago

Thanks @asbish! It's working great.

veelenga commented 1 year ago

Can confirm that the artifact installed through M-x package-install-file fixes the original issue in https://github.com/jscheid/prettier.el/issues/125 for me.

Thank you @asbish

jscheid commented 1 year ago

@asbish thanks again for your effort here, and to everyone for testing. I'm back and going to try and review the changes in the next few days. Looks like solid work ❤️

ikapo commented 1 year ago

Any progress on this? It's working great for me Thanks ❤️

jscheid commented 1 year ago

Sorry all, I've been moving house and had a number of other distractions. Taking a look now.

SamuelBanya commented 1 year ago

Question regarding Prettier.el via MELPA.

The 'TypeError: n.resolveConfig.sync is not a function' error won't be fixed until this PR is merged, is that correct?

asbish commented 1 year ago

The fail build is caused by lsp-mode and markdown-mode in Mepla. The packages are changed into what requires emacs-27.1 package. I tried using melpa-stable but no luck. consult-lsp also requires emacs-27.1 package... I think that it’ll be better to stop using Emacs 26 in the CI.

jscheid commented 1 year ago

I think that it’ll be better to stop using Emacs 26 in the CI.

I agree, please remove it. We should add Emacs 29 but can do that in a separate PR.

jscheid commented 1 year ago

@asbish could you rebase this please, also would you mind bumping the package version to 1.4.0 (in prettier.el)? I'll merge then as soon as the tests pass.

jscheid commented 1 year ago

Actually, let me merge as-is. We can still bump the version later after it's had a bit more exposure.

asbish commented 1 year ago

@jscheid I've got it. Thank you!

bard commented 1 year ago

@jscheid @asbish thanks so much both of you, prettier.el has become an indispensable piece of kit for me and I'm sure for others, too!

jscheid commented 1 year ago

Definitely all credit here must go to @asbish , thanks once more for all your work on this!