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
chore: upgrade prettier to 3.2.5 (poc for dynamic imports of pure esm) #19876
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: 0 B Total Size: 2.39 MB ℹ️ View Unchanged
|
Co-authored-by: Alexandre BODIN <alexandrebodin@users.noreply.github.com>
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.
just a conflcit but looks good to me
@@ -61,6 +60,9 @@ const saveDefinitionToFileSystem = async (dir, file, content) => { | |||
* @returns {Promise<string>} | |||
*/ | |||
const format = async (content) => { | |||
// eslint-disable-next-line node/no-unsupported-features/es-syntax | |||
const prettier = await import('prettier'); // ESM-only |
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.
Did you test that the auto type gen still works well?
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.
I did now
I've found a tooling related issue with this, so I'm holding off on merging until I get some opinions. If you check out this PR in VS Code, it updates to use prettier v3. If you then switch back to |
it happens to me with a lot of extensions incl eslint & prettier. consider everyone has practicaly switch on v5 I would not bother |
What does it do?
await import('prettier')
for each place that was changed)prettier:write
and updated 100+ files because apparently prettier v3 treats all warnings as errors, or at least changes the process exit code so CI was failingWhy is it needed?
Upgrading prettier isn't really needed. However, the node ecosystem as a whole is shifting towards esm-only and almost every module we use that has major version upgrades all require esm.
We need a strategy to work around it, at least until Node fixes the problem which is on the horizon.
Prettier seems a safe enough place to experiment with using it, it would be easy to downgrade later if we need to without any breaking changes.
How to test it?
Provide information about the environment and the path to verify the behaviour.
Related issue(s)/PR(s)
DX-1273