Skip to content

chore: migrate from Prettier to oxfmt for code formatting - #11824

Merged
slorber merged 10 commits into
meta:mainfrom
yangshun:ys/oxfmt
May 7, 2026
Merged

slorber merged 10 commits into
meta:mainfrom
yangshun:ys/oxfmt

Conversation

@yangshun

@yangshun yangshun commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Replace Prettier with oxfmt as the code formatter
  • Add .oxfmtrc.json configuration and remove .prettierrc / .prettierignore
  • Update lint-staged config, CI workflows, and VS Code extensions accordingly
  • Reformat codebase with oxfmt

Test plan

  • Verify oxfmt formats all files correctly
  • Verify CI lint workflow passes
  • Verify lint-staged works on pre-commit

Notes on CI

  • Argos: 1 visual diff is reported and is intended — caused by oxfmt reflowing some MDX content (e.g. footnote spacing, list item spacing, ternary indentation in code blocks). Please approve the Argos build to accept the new baseline.
  • Lighthouse Report: failure is environmental (fork PRs lack pull-requests: write to post the sticky comment); the audit itself ran successfully.

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Mar 20, 2026
@socket-security

socket-security Bot commented Mar 20, 2026 •

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm entities is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: ? → npm/@docusaurus/[email protected] → npm/@docusaurus/[email protected] → npm/[email protected]

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm entities is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: ? → npm/@docusaurus/[email protected] → npm/@docusaurus/[email protected] → npm/[email protected]

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@netlify

netlify Bot commented Mar 20, 2026 •

Copy link
Copy Markdown

✅ [V2]

Name Link
🔨 Latest commit 296451d
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/69fc7a7dde7df70008572059
😎 Deploy Preview https://deploy-preview-11824--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@akshatsinha0

Copy link
Copy Markdown
Contributor

Great Idea. Was searching for something like this.

@yangshun
yangshun marked this pull request as ready for review April 8, 2026 15:14
@yangshun
yangshun marked this pull request as draft April 8, 2026 15:19
@slorber slorber added pr: maintenance This PR does not produce any behavior differences to end users when upgrading. Argos Add this label to run UI visual regression tests. See argos.yml GH action. labels Apr 8, 2026
@argos-ci

argos-ci Bot commented Apr 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 1 changed May 7, 2026, 11:49 AM

@slorber

slorber commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

@yangshun let me know if you want to update this PR. Now that we upgraded node it should pass CI.

@yangshun

Copy link
Copy Markdown
Contributor Author

Sorry I dropped the ball on this, I'll update this PR within the next few days. Or if you want to take over go ahead as well.

@yangshun
yangshun marked this pull request as ready for review April 29, 2026 10:37
@yangshun

yangshun commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor Author

@slorber updated to latest Oxlint and rebased against origin/main. I eyeballed the rest of the changes, they look fine.

  • Lighthouse failure: Seems to fail for all non-maintainer PRs
  • Argos failure: Intended as the formatting of some code blocks have changed, and the Argos screenshot captures that difference. I'm not sure how to update on my end. Can I trouble you to make the necessary updates?

@slorber

slorber commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks

I'll test a bit the Oxc plugin for Intellij soon to see if this isn't disruptive for me, and merge asap 👍

@socket-security

socket-security Bot commented May 7, 2026 •

Copy link
Copy Markdown

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👍

Additional notes:

Otherwise it looks good and fast 👍

"types": "src/plugin-ideal-image.d.ts",
"scripts": {
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"",
"build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.js && oxfmt \"lib/theme/**/*.js\"",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI I removed the --no-error-on-unmatched-pattern on purpose

lib files are usually generated/ignored, but for lib/theme we definitely want to format them well because it's what users will get when swizzling with JS. (for TS we swizzle from source so it's already formatted)

Comment thread .oxfmtrc.json
"packages/docusaurus-*/lib/*",

"packages/create-docusaurus/lib/*",
"!packages/docusaurus-*/lib/theme/**",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Needed to format js files for js swizzle CLI, otherwise we get an error without --no-error-on-unmatched-pattern because oxfmt doesn't format them

@slorber
slorber merged commit 190ef6f into meta:main May 7, 2026
36 of 39 checks passed
slorber added a commit that referenced this pull request Oct 15, 2026
…2650)

Add the Prettier to oxfmt migration (#11824), the 2019 Prettier run on
Markdown files (#2102) and a 2018 CRLF to LF line endings fix.

Co-authored-by: Claude Opus 5.5 <[email protected]>
slorber added a commit that referenced this pull request Oct 23, 2026
* chore: remove tooling config entries for paths that no longer exist (AI-assisted)

- jest/vendor (cspell, stylelint, oxfmt): removed with the Vitest migration, #12010
- packages/create-docusaurus/templates/facebook (ESLint): removed in #9026
- website/docusaurus.config.js (oxfmt): the config is TypeScript since #9317
- packages/docusaurus-migrate/lib (Vitest): package removed in #9400
- website/netlifyDeployPreview (.gitignore): removed in #4447
- .cache-loader (.gitignore): cache-loader removed with Webpack 5, #4089
- commented-out website/i18n/fr negations (.gitignore)
- ".svg" (oxfmt): typo for the "*.svg" pattern right below it

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(knip): treat configuration hints as errors, ignore the ideal-image fork internals (AI-assisted)

- Add treatConfigHintsAsErrors, and remove the 3 entries Knip reports as
  useless: the playwright binary, and the @docusaurus/plugin-css-cascade-layers
  and @mdx-js/react dependencies
- Don't treat the react-ideal-image fork modules as theme component entries,
  so that Knip reports the unused ones

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: remove unused test fixtures (AI-assisted)

- docs bad-id-site and bad-slug-on-doc-home-site: unused since #3245
- utils vcs simple-site: unused since #11512

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(website): fix the React-DOM version check of the bad package dogfood test (AI-assisted)

The second check tested ReactVersion again, so a bad React-DOM version
never threw. Introduced in #10391.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore: remove more stale config entries (AI-assisted)

- .gitignore types: nothing generates a types dir, even in #1490 where it
  was added, and it ignores any new types/ source folder
- .gitignore website/rspack-tracing.json: the Rspack trace is written to
  rspack-tracing.pftrace since #11290
- clear script --ignore docusaurus: protected the lib/ sources of the v1
  "docusaurus" package, removed in #4902
- ESLint __mocks__ ignore: converted from .eslintignore in #12024, it only
  matches a root __mocks__ dir that doesn't exist
- Syncpack type-alias group: only the exact @types/react version still
  needs it, the * ranges are gone since #12435 and the other dependencies
  use the catalog since #12696

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore: replace the Prettier and Jest leftovers (AI-assisted)

The monorepo formats with oxfmt since #11824 and tests with Vitest since #12010

- Devcontainer: format with the Oxc extension instead of Prettier, which
  formatted with its defaults, and remove the Jest extension
- README: remove the Prettier and Jest badges
- CONTRIBUTING: the formatter is oxfmt

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Argos Add this label to run UI visual regression tests. See argos.yml GH action. CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants