-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to Prettier v3 #156
Conversation
This is still in draft because I am seeing this error when attempting to run Jest:
There may still be an incompatibility between Jest and Prettier v3. I saw a few tracking issues for this, though this error wasn't referenced in those discussions as far as I could tell. |
Prettier uses jest-light-runner, you may want try. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
7d4b7e0
to
6785aef
Compare
This is probably in good shape now! I'd like to do more testing before merging. For anyone following this PR, if you were looking for a way to help, testing would be appreciated! You can test this by:
Then in your project (which should be using Prettier v3 and |
4443d56
to
75f37d9
Compare
Prettier has been updated to v3. We now use types from Prettier directly, so the types package has been dropped as well. This plugin was affected by three changes mentioned in the changelog [1]: * `parse` now has one less parameter. The `parsers` parameter (which wasn't being used by this plugin) was removed. * The Babel parser is now located at `prettier/plugins/babel`. * Prettier now expects parsers to be async A change was also required due to a seemingly-undocumented change to the output of the Prettier JSON parser. The AST is now returned wrapped in a `JsonRoot` node, which was not the case in v2. `eslint-plugin-prettier` has been updated to v5, which is compatible with Prettier v3. fixes #119 [1]: https://prettier.io/blog/2023/07/05/3.0.0.html
Hello @Gudahtt, I just tested on one of my project with the following config /** @type {import("prettier").Config} */
module.exports = {
plugins: [
require.resolve('prettier-plugin-tailwindcss'),
require.resolve('prettier-plugin-sort-json')
],
trailingComma: 'all',
tabWidth: 4,
printWidth: 120,
semi: false,
singleQuote: true,
bracketSameLine: true,
arrowParens: 'avoid',
jsonRecursiveSort: true,
} with those versions :
And everything went well, the tested json files where correctly reformatted 👍 |
Tested on our projects and looks good. Nice work 🚀 |
Thanks for the help @bmichotte and @vlapo ! I've tested this myself as well, and it seems to work. I'll prepare a v3 release now. |
This has been published as v3: https://github.com/Gudahtt/prettier-plugin-sort-json/releases/tag/v3.0.0 |
Thank you @Gudahtt |
Prettier has been updated to v3. We now use types from Prettier directly, so the types package has been dropped as well.
This plugin was affected by three changes mentioned in the changelog 1:
parse
now has one less parameter. Theparsers
parameter (which wasn't being used by this plugin) was removed.prettier/plugins/babel
.A change was also required due to a seemingly-undocumented change to the output of the Prettier JSON parser. The AST is now returned wrapped in a
JsonRoot
node, which was not the case in v2.eslint-plugin-prettier
has been updated to v5, which is compatible with Prettier v3.Fixes #119