Skip to content

chore(prettier): ignore ejected swizzles, not wrapped ones - #4617

Merged
thetaPC merged 3 commits into
mainfrom
swizzled-prettier
Aug 12, 2026
Merged

chore(prettier): ignore ejected swizzles, not wrapped ones#4617
thetaPC merged 3 commits into
mainfrom
swizzled-prettier

Conversation

@thetaPC

@thetaPC thetaPC commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Issue URL:

What is the current behavior?

src/theme/README.md says swizzled components should be added to the prettier ignore so they stay diffable against @docusaurus/theme-classic, but only DocItem and DocRoot were listed.

What is the new behavior?

  • .prettierignore lists the seven ejected components. Wrapped components (using @theme-original) are our own code, so they keep repo formatting: DocSidebar, TOC, MDXComponents/index.tsx, and DocRoot/Layout/Main.
  • The seven ejected files are reformatted to upstream's prettier settings.

Does this introduce a breaking change?

  • Yes
  • No

Other information

N/A

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview Aug 12, 2026 11:14pm

Request Review

@thetaPC
thetaPC marked this pull request as ready for review August 5, 2026 21:53
@thetaPC
thetaPC requested a review from a team as a code owner August 5, 2026 21:53
@thetaPC
thetaPC requested review from OS-jacobbell and ShaneK and removed request for OS-jacobbell August 5, 2026 21:53
@thetaPC thetaPC mentioned this pull request Aug 5, 2026
2 tasks

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Just some nits

Comment thread src/theme/README.md Outdated
@@ -3,4 +3,4 @@
This folder is used to override the base docusaurus theme. It houses [swizzled components](https://docusaurus.io/docs/swizzling). Components should NOT be swizzled unless absolutely necessary to allow for changes in future versions. If it is possible to shallow swizzle a component using the `@theme-original` alias, then that should be heavily considered. Swizzled components should be added to the prettier ignore and all code updates should be marked with comments to allow more seamless version updating. The styles file for components that have been unsafely swizzle should absolutely not be edited. All styling should be done from the [component partials](/src/styles/components).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this line needs to move with the PR. Right now it says all swizzled components go in the prettier ignore, but the new rule is only the ejected ones, with wrapped ones deliberately left on repo formatting. The comment block you added in .prettierignore points here by name, so it's sending people to the one place that still describes the old behavior.

Worth getting right because the per-file list is manual now. Nothing in CI covers src/theme, so if someone ejects a component and forgets the entry, lint just reformats it and they commit the diff without noticing.

Something like: wrapped components import from @theme-original and are our own code, so they follow the repo's Prettier config. Ejected components are full copies of upstream, so each one gets added to .prettierignore by path to keep upstream's formatting and stay diffable against @docusaurus/theme-classic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread src/theme/README.md Outdated
@thetaPC
thetaPC merged commit 9bd623f into main Aug 12, 2026
4 checks passed
@thetaPC
thetaPC deleted the swizzled-prettier branch August 12, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants