Skip to content

Upgrade wp-prettier to 3.9.6 - #82731

Merged
jsnajdr merged 5 commits into
trunkfrom
upgrade/prettier-3.9.6.beta.1
Sep 16, 2026
Merged

jsnajdr merged 5 commits into
trunkfrom
upgrade/prettier-3.9.6.beta.1

Conversation

@jsnajdr

@jsnajdr jsnajdr commented Sep 10, 2026

Copy link
Copy Markdown
Member

I updated the wp-prettier fork from 3.0.3 (3 years old version) to the latest 3.9.6 version. It took Cursor 2 hours to rebase the patch across 2600 upstream commits 🙂 And I published it to NPM as beta (2) so that we can test it before publishing the final version.

This PR upgrades the Gutenberg repo. If we later switch to Biome or something else, at least we'll be upgrading from the latest version of a mainstream formatter.

Main formatting changes I noticed:

  • Markdown lists don't insert an extra spaces when indenting
  • when formatting nested ternary expressions, there is a tab instead of spaces before a closing paren
  • long assigment expressions (const a = ...) break lines immediately after the =
  • typeof import( 'foo' ) used as a type inserts missing spaces
  • long && chains no longer have extra indentiation level
  • long union types (a | b | c | d) are broken into multiple lines
  • long A extends B type expressions are broken into multiple lines

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: -31 B (0%)

Total Size: 8.21 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 328 kB -33 B (-0.01%)
build/styles/theme/design-tokens-rtl.css 3.15 kB +1 B (+0.03%)
build/styles/theme/design-tokens.css 3.15 kB +1 B (+0.03%)

23b5403 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 4b77771 trunk % Change
timeToFirstByte 55.6 ms +14.66% -3.51% 56.25 ms +13.07% -4.27% -1.16%
largestContentfulPaint 96 ms +2.08% -8.33% 94 ms +4.26% -6.38% 2.13%
lcpMinusTtfb 34.35 ms +11.21% -3.78% 34.45 ms +15.82% -5.95% -0.29%
wpBeforeTemplate 27.96 ms +18.78% -2.43% 28 ms +17.14% -3.46% -0.14%
wpTemplate 23.85 ms +3.86% -3.56% 24.19 ms +4.84% -3.89% -1.41%
wpTotal 52.08 ms +14.02% -3.69% 52.79 ms +12.12% -4.49% -1.34%
wpMemoryUsage 7.53 MB +0% -0% 7.49 MB +0% -0% 0.46%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 4b77771 trunk % Change
timeToFirstByte 41.4 ms +6.16% -1.57% 46.75 ms +4.49% -2.35% -11.44%
largestContentfulPaint 88 ms +9.09% -0% 100 ms +4% -0% -12%
lcpMinusTtfb 47.45 ms +6.64% -1.79% 54.25 ms +2.03% -1.84% -12.53%
wpBeforeTemplate 25.29 ms +2.49% -0.67% 25.57 ms +4.73% -1.88% -1.1%
wpTemplate 13.28 ms +6.33% -1.28% 17.83 ms +3.48% -1.79% -25.52%
wpTotal 38.77 ms +5.29% -1.55% 43.6 ms +5.07% -2.04% -11.08%
wpMemoryUsage 6.01 MB +0% -0% 6.11 MB +0% -0% -1.66%
wpDbQueries 10 +0% -0% 14 +0% -0% -28.57%

media-processing

Metric 4b77771 trunk % Change
mediaProcessingJpeg 394.38 ms +0.9% -0.64% 394.04 ms +1.65% -0.69% 0.09%
mediaProcessingAvif 6065.57 ms +0.17% -0.17% 6058.2 ms +0.27% -0.03% 0.12%
mediaProcessingJpegToAvif 4208.84 ms +0.01% -0.19% 4182.34 ms +0.15% -0.15% 0.63%

media-upload

Metric 4b77771 trunk % Change
jpegUploadProcessing 1447.71 ms +34.02% -1.37% 1404.33 ms +1.56% -0.39% 3.09%
pngUploadProcessing 202.06 ms +5.75% -1.91% 203.89 ms +2.54% -2.24% -0.9%
largeJpegUploadProcessing 1401.06 ms +1.1% -0.99% 1399.06 ms +0.55% -0.13% 0.14%
multipleImageUploadProcessing 1547.47 ms +1.74% -0.4% 1517.29 ms +1.12% -0.42% 1.99%

post-editor

Metric 4b77771 trunk % Change
serverResponse 386.68 ms +8.01% -1.89% 422.03 ms +4.06% -10.26% -8.38%
firstPaint 225.95 ms +21.8% -15.81% 215.11 ms +15.85% -17.38% 5.04%
domContentLoaded 1085.17 ms +2.32% -2.36% 1077.63 ms +0.86% -1.12% 0.7%
loaded 1086.51 ms +2.31% -2.36% 1079.06 ms +0.84% -1.11% 0.69%
firstContentfulPaint 446.26 ms +5.34% -10.88% 444.97 ms +2.16% -1.91% 0.29%
firstBlock 3143.57 ms +0.86% -0.57% 3155.77 ms +0.36% -1.56% -0.39%
type 21.49 ms +2.89% -5.3% 21.72 ms +5.89% -4.88% -1.06%
typeWithoutInspector 20.74 ms +6.65% -4.73% 21.67 ms +1.57% -3.97% -4.29%
typeWithTopToolbar 26.01 ms +5.27% -5.88% 25.94 ms +6.94% -2.81% 0.27%
typeContainer 8.75 ms +10.63% -4% 8.78 ms +4.56% -5.81% -0.34%
focus 72.82 ms +2.33% -3.3% 70.93 ms +5.68% -4% 2.66%
firstFocus 203.89 ms +0% -0% 205.81 ms +0% -0% -0.93%
selectAll 493.52 ms +3.56% -1.06% 505.94 ms +0.17% -3.06% -2.45%
listViewOpen 70.61 ms +2.48% -12.12% 72.46 ms +6.22% -6.51% -2.55%
inserterOpen 24.69 ms +2.19% -6.44% 23.77 ms +14.3% -10.77% 3.87%
inserterHover 2.86 ms +10.14% -8.39% 3.13 ms +10.22% -7.03% -8.63%
inserterSearch 8.31 ms +2.77% -8.54% 8.37 ms +5.73% -5.26% -0.72%
loadPatterns 650.86 ms +2.59% -4.08% 640.74 ms +5.97% -5% 1.58%
wpTotal 375.27 ms +8.31% -1.96% 410.58 ms +4.15% -10.42% -8.6%
wpMemoryUsage 13.07 MB +0% -0% 13.03 MB +0% -0% 0.28%
wpDbQueries 54 +0% -0% 54 +0% -1.85% 0%

site-editor

Metric 4b77771 trunk % Change
serverResponse 304.94 ms +4.64% -6.22% 310.79 ms +1.02% -9.31% -1.88%
firstPaint 187.5 ms +10.07% -4.88% 176.22 ms +30.41% -17.14% 6.4%
domContentLoaded 861.58 ms +0.78% -0.98% 851.92 ms +1.37% -0.59% 1.13%
loaded 862.55 ms +0.77% -0.99% 852.8 ms +1.38% -0.58% 1.14%
firstContentfulPaint 338.51 ms +6.06% -1.42% 346.43 ms +1.04% -2.78% -2.29%
firstBlock 3079.34 ms +1.39% -0.22% 3045.2 ms +0.59% -0.95% 1.12%
type 16.01 ms +2.12% -6.68% 15.55 ms +5.72% -1.99% 2.96%
navigate 106.59 ms +0.86% -6.72% 103.28 ms +0.83% -2.18% 3.2%
loadPatterns 1037.25 ms +5.15% -10.29% 995.83 ms +11.32% -3.92% 4.16%
loadPages 1028.55 ms +3.46% -1.17% 1021.82 ms +3.19% -1.63% 0.66%
wpTotal 296.7 ms +4.66% -6.33% 302.4 ms +1.1% -9.56% -1.88%
wpMemoryUsage 12.02 MB +0% -0% 11.97 MB +0% -0% 0.41%
wpDbQueries 44 +0% -2.27% 44 +0% -2.27% 0%

23b5403 Run

@github-actions github-actions Bot added [Package] Element /packages/element [Package] Date /packages/date [Package] Data /packages/data [Package] Server Side Render /packages/server-side-render [Package] A11y /packages/a11y [Package] Autop /packages/autop [Tool] Babel preset /packages/babel-preset-default [Package] DOM ready /packages/dom-ready [Package] i18n /packages/i18n [Tool] Jest console /packages/jest-console [Tool] WP Scripts /packages/scripts labels Sep 10, 2026
@Mamaduka

Copy link
Copy Markdown
Member

A merge conflict surface area would be smaller here than with some PRs (JSX filename change) we've shipped recently.

If we later switch to Biome or something else, at least we'll be upgrading from the latest version of a mainstream formatter.

I hear that cool kids are using Oxfmt; it might be worth checking the compatibility with our custom rules.

+1 to merge as soon as possible.

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once beta testing is done, should we publish wp-prettier@3.9.6 and update the manifests and lockfile off 3.9.6-beta.2? The stable npm tag is still 3.0.3, apparently

Comment on lines +96 to +106
extensions: [
'cjs',
'js',
'json',
'jsx',
'mjs',
'ts',
'tsx',
'yml',
'yaml',
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include .cts and .mts here too? (optionally cover the four module extensions in a focused test)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do this, but eventually gave up because not even our linter configs don't match these extensions. And we don't really have any .cts and .mts files. This might change with Node 24 and the built-in type stripping.

Let's do this as a standalone PR that adds support to all our tooling at once.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A follow-up works 👌

Up to you if you still want to add a test for .cjs and .mjs in @wordpress/scripts? The current tests do not cover wp-scripts format, so directory formatting for these files could break without CI noticing.

@ciampo

ciampo commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

I hear that cool kids are using Oxfmt

With Storybook and Vitest using Vite, we could start considering the move from Webpack to Vite for our main bundles too, and a general migration to the voidZero stack

@jsnajdr

jsnajdr commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

Once beta testing is done, should we publish wp-prettier@3.9.6 and update the manifests and lockfile off 3.9.6-beta.2? The stable npm tag is still 3.0.3, apparently

I want the fork version number to match exactly the upstream Prettier version from which it is derived. Which is 3.9.6 now. But that also means that we have no room for error. If wp-prettier@3.9.6 turns out to be buggy, we can't release 3.9.7, because that's reserved for the version that will be derived from future Prettier 3.9.7.

That's why I'm releasing only beta versions now. I'll try the same upgrade on Calypso, and if it works, then we can release 3.9.6 with the latest NPM tag.

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from minor feeback, LGTM 🚀

I guess next steps will be to rebase, solve/conflicts for the latest unformatted files, and merge ASAP before more conflicts appear.

If we struggle, we could resort to triggering a manual dispatch of the workflow that will force all PRs to rebase.

@manzoorwanijk

Copy link
Copy Markdown
Member

Can we please wait a bit before we merge this PR? I think this needs the Require PR update and I am trying to improve that workflow right now.

@jsnajdr

jsnajdr commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

Can we please wait a bit before we merge this PR?

I'm certainly not in a hurry: I'd like to release the final 3.9.6 before merging and then wait 24 hours for min-release-age. The conflicts that keep coming are all from @ciampo Vitest migrations, and they are easy to resolve.

To make sure we don't have any bugs, I'm also upgrading Calypso in Automattic/wp-calypso#114274.

@manzoorwanijk

Copy link
Copy Markdown
Member

I'm certainly not in a hurry: I'd like to release the final 3.9.6 before merging and then wait 24 hours for min-release-age. The conflicts that keep coming are all from @ciampo Vitest migrations, and they are easy to resolve.

To make sure we don't have any bugs, I'm also upgrading Calypso in Automattic/wp-calypso#114274.

Thanks

@manzoorwanijk

Copy link
Copy Markdown
Member

#82767 is the improvement I was referring to.

@jsnajdr

jsnajdr commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

@manzoorwanijk I'd like to merge the Prettier upgrade today. Do I just add the Required PR update label and everything else is done automatically by the action workflows?

@manzoorwanijk

Copy link
Copy Markdown
Member

@manzoorwanijk I'd like to merge the Prettier upgrade today. Do I just add the Required PR update label and everything else is done automatically by the action workflows?

Yes, that is correct. The label is already added and we are good.

Comment thread packages/prettier-config/package.json
@manzoorwanijk

Copy link
Copy Markdown
Member

@manzoorwanijk I'd like to merge the Prettier upgrade today. Do I just add the Required PR update label and everything else is done automatically by the action workflows?

FYI, here is the CI run (with summary) post-merge, to show how many PRs needed a force update.

@talldan

talldan commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

It looks like there are some failures in trunk.

This should fix it - Fix prettier lint issues after prettier upgrade

edit: now merged

@manzoorwanijk

Copy link
Copy Markdown
Member

It looks like there are some failures in trunk.

Those checks actually failed in this PR as well, but I guess it was merged before the run finished.

@jsnajdr

jsnajdr commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Those checks actually failed in this PR as well, but I guess it was merged before the run finished.

Oh, I apologize for that. I didn't want to wait 30 minutes for irrelevant performance and e2e tests. Also the next 30 minutes would likely bring further trunk conflicts 🙂

Thanks for sorting it out quickly ❤️

wp-prettier@3.9.6 is now stable. May be we should update it in a follow up?

I thought I upgraded the package to the final version but apparently I didn't. Fixing in #83026. That PR also adds the landed trunk commit hash to .git-blame-ignore-revs.

@aduth

aduth commented Oct 7, 2026

Copy link
Copy Markdown
Member

We don't really have anything that enforces that all Markdown files are formatted with Prettier, but historically I've been able to rely on my editor's "format on save" option with Markdown files with little disruption. Since these updates I've had to be a lot more careful as formatting existing files usually brings a lot of changes. I wonder if we should make another big formatting pass on all of the .md files and perhaps consider enforcing Prettier formatting on them as well? Otherwise, the inconsistency of people applying or not applying formatting can cause some toil.

Or we could do nothing and continue to let Markdown be a free-for-all 😄

@manzoorwanijk

Copy link
Copy Markdown
Member

I would love that. I always have to choose Save without formatting for Markdown files.

@talldan

talldan commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

I'd also be supportive of reformatting everything and simplifying the setup. backport-changelog files might require some care because I think they may need a specific format. I'm not sure if prettier will try to reformat them, something to check.

If it's an opportunity to remove markdownlint, that might also be good. I had some issue previously because my editor (nvim) used markdownlint-cli2, but it doesn't support gutenberg's markdownlintignore file, so it always tried fixing files that are ignored. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] A11y /packages/a11y [Package] Abilities /packages/abilities [Package] Admin UI /packages/admin-ui [Package] API fetch /packages/api-fetch [Package] Autop /packages/autop [Package] Blob /packages/blob [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Blocks /packages/blocks [Package] Boot /packages/boot [Package] Commands /packages/commands [Package] Components /packages/components [Package] Compose /packages/compose [Package] Core commands /packages/core-commands [Package] Core data /packages/core-data [Package] Data Controls /packages/data-controls [Package] Data /packages/data [Package] DataViews /packages/dataviews [Package] Date /packages/date [Package] Deprecated packages/deprecated [Package] Design System MCP /packages/design-system-mcp [Package] DOM ready /packages/dom-ready [Package] DOM /packages/dom [Package] E2E Tests /packages/e2e-tests [Package] Edit Post /packages/edit-post [Package] Edit Site /packages/edit-site [Package] Edit Widgets /packages/edit-widgets [Package] Editor /packages/editor [Package] Element /packages/element [Package] Escape HTML /packages/escape-html [Package] Fields /packages/fields [Package] Grid /packages/grid [Package] Hooks /packages/hooks [Package] HTML entities /packages/html-entities [Package] i18n /packages/i18n [Package] Image Cropper Related to packages/image-cropper [Package] Interactivity Router /packages/interactivity-router [Package] Interactivity /packages/interactivity [Package] Interface /packages/interface [Package] Keyboard Shortcuts /packages/keyboard-shortcuts [Package] Keycodes /packages/keycodes [Package] Lazy import /packages/lazy-import [Package] Media Utils /packages/media-utils [Package] Notices /packages/notices [Package] Patterns /packages/patterns [Package] Plugins /packages/plugins [Package] Preferences /packages/preferences [Package] Priority Queue /packages/priority-queue [Package] Project management automation /packages/project-management-automation [Package] React i18n /packages/react-i18n [Package] Redux Routine /packages/redux-routine [Package] Rich text /packages/rich-text [Package] Server Side Render /packages/server-side-render [Package] Style Engine /packages/style-engine [Package] Sync /packages/sync [Package] Theme /packages/theme [Package] Token List /packages/token-list [Package] UI /packages/ui [Package] Url /packages/url [Package] Viewport /packages/viewport [Package] Views /packages/views [Package] Warning /packages/warning [Package] Widget Dashboard /packages/widget-dashboard [Package] Widget primitives /packages/widget-primitives [Package] Word count /packages/wordcount [Package] wp-build /packages/wp-build Require PR update Forces open PRs to update from trunk [Tool] Babel preset /packages/babel-preset-default [Tool] Create Block /packages/create-block [Tool] Dependency Extraction Webpack Plugin /packages/dependency-extraction-webpack-plugin [Tool] Docgen /packages/docgen [Tool] E2E Test Utils /packages/e2e-test-utils-playwright [Tool] Env /packages/env [Tool] ESLint plugin /packages/eslint-plugin [Tool] Jest console /packages/jest-console [Tool] Prettier config /packages/prettier-config [Tool] Readable JS Assets Webpack Plugin /packages/readable-js-assets-webpack-plugin [Tool] WP Scripts /packages/scripts [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants