-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Bump Prettier to v3 #4264
base: main
Are you sure you want to change the base?
Bump Prettier to v3 #4264
Conversation
Prettier 3 has the ability to read from both `.gitignore` and `.prettierignore`. This allows us to finetune what we exclude from Prettier vs. Git in a consistent manner (using configuration files instead of passing arguments to `prettier`). We will make use of this in a future commit. However as v3 makes some backward-incompatible changes to the formatting rules, this commit applies fixes to all files so that they pass lint again.
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
@@ -2,6 +2,7 @@ | |||
* @type {import('prettier').Options} | |||
*/ | |||
module.exports = { | |||
plugins: ['prettier-plugin-packagejson'], |
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.
It appears that Prettier no longer autodetects plugins in v3. I couldn't find any mention of this in the release notes, but I found this necessary to add to format package.json
correctly.
Sigh. Upgrading to Prettier 3 isn't possible to do right now because when running tests for
This is happening because Prettier is now written in ESM and their CommonJS implementation mistakenly imports their ESM implementation. Modern versions of Node seems to be able to cope with this just fine, but not Jest. This is because Jest tests run in a VM, and their ES module support is still under an experimental flag (source). This is an ongoing issue that's being tracked here and to some extent here. Besides this, there's also an issue with snapshots. This will be resolved in Jest 30. |
Explanation
Prettier 3 has the ability to read from both
.gitignore
and.prettierignore
. This allows us to finetune what we exclude from Prettier vs. Git in a consistent manner (using configuration files instead of passing arguments toprettier
). We will make use of this in a future commit.However as v3 makes some backward-incompatible changes to the formatting rules, this commit applies fixes to all files so that they pass lint again.
References
Prerequisite to #4261.
Changelog
(N/A)
Checklist