-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Support Prettier 3 #14566
Support Prettier 3 #14566
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Interesting! CI is unhappy, but exciting nonetheless 😃 This does essentially what https://github.com/prettier/prettier-synchronized does, right? I tried to use it in #14311, but hit prettier/prettier-synchronized#4 (comment) |
Yes! (Except for a little non-public API🤦♂️) cc @fisker Do you have any suggestions? Also I found out that the E2E tests are using Prettier 3, which means as long as the CI is green, everything should be fine. |
bedb87e
to
ce00c5b
Compare
ce00c5b
to
a1ce469
Compare
Since we removed custom parser support in v3, yes, it's difficult to modify ast. I don't have a better idea. |
writeFiles(DIR, { | ||
'jest.config.js': ` | ||
module.exports = {prettierPath: require.resolve('prettier-2')}; | ||
module.exports = {prettierPath: require.resolve('prettier')}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should running against the prettier/index.cjs
, maybe better run against prettier/index.mjs
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since require
will be called on the main thread anyway, I will use index.cjs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome stuff, thanks!
writeFiles(DIR, { | ||
'jest.config.js': ` | ||
module.exports = {prettierPath: require.resolve('prettier-2')}; | ||
module.exports = {prettierPath: require.resolve('prettier/index.cjs')}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just prettier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is @fisker 's suggestion, perhaps to avoid unexpected use of Prettier 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I mean both index.cjs
and index.mjs
both should be tested, since user can pass prettier path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use require
to load it, so ESM will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug apis was actually missing in commonjs version at first, I added in prettier/prettier#13731
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use
require
to load it, so ESM will fail
Al right, didn't know.
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Support Prettier 3
Fixes: #14305
Closes #14311
Test plan
CI green
I tried adding tests, but I failed when importing ESM's prettier.
In addition, the
import
inworker_threads
may be complicated.