Bump Prettier to v3
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 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.
References
Prerequisite to https://github.com/MetaMask/core/pull/4261.
Changelog
(N/A)
Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
New dependencies detected. Learn more about Socket for GitHub ↗︎
| Package | New capabilities | Transitives | Size | Publisher |
|---|---|---|---|---|
| npm/[email protected] | None | 0 |
20.8 kB | lydell |
| npm/[email protected] | None | 0 |
33.9 kB | jounqin |
| npm/[email protected] | environment, filesystem, unsafe | 0 |
8.39 MB | prettier-bot |
| npm/[email protected] | environment | 0 |
54.5 kB | jounqin |
Sigh.
Upgrading to Prettier 3 isn't possible to do right now because when running tests for scripts/create-package I get this error:
Error: You need to run with a version of node that supports ES Modules in the VM API. See https://jestjs.io/docs/ecmascript-modules
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.