chore(prettier): ignore ejected swizzles, not wrapped ones - #4617
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| @@ -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). | |||
There was a problem hiding this comment.
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.
Co-authored-by: Shane <shane@shanessite.net>
Issue URL:
What is the current behavior?
src/theme/README.mdsays swizzled components should be added to the prettier ignore so they stay diffable against@docusaurus/theme-classic, but onlyDocItemandDocRootwere listed.What is the new behavior?
.prettierignorelists the seven ejected components. Wrapped components (using@theme-original) are our own code, so they keep repo formatting:DocSidebar,TOC,MDXComponents/index.tsx, andDocRoot/Layout/Main.Does this introduce a breaking change?
Other information
N/A