refactor: 💡 modular file architecture (first pass)#832
Conversation
hoorayimhelping
left a comment
There was a problem hiding this comment.
Do all types go in the $component.types.ts file? What if they're not meant to be exported from a component?
What we have multiple files in a directory and only one of them makes use of the type? Does that type need to be moved to a separate file? Can't it just be exported directly from the index.ts file with the same effect?
My concern is that rigid expectations will create a lot of work and boilerplate. If we only have a single component in a directory, having a separate file for types is nice for consistency, but it splits up all the context among multiple files somewhat needlessly
If that helps. So, if you're declaring a types file, that'd be component.types.ts and not types.ts. At the moment, we shouldn't have cross-type imports, unless I miss something in this pass, let me know if you found something. For internal exports, you have control over the types you want exposed in the ./index.js. If you'd find a situation where a particular type is shared (which I found in a few cases like that), you'd probably be interested in
At the component level, you're not allowed to import from ./index that's related to the safeguards for circular dependencies. I'm not sure if I'd block your PR because of an inline or local type? But if you do create a types file, that should be component.types.ts and not types.ts, e.g. we have component.test.ts, component.stories.ts, we'll have something similar for styles
That's fine, if you don't need a types file and wish to declare it inline or locally. But as the project grows, and you need one then I guess for consistency you'd use component.types.ts. |
…ar-file-architecture
…ar-file-architecture
|
Claude finished @punkbit's task in 2m 59s —— View job Code ReviewGreat structural work here — the modular file pattern is clean, consistent, and aligns with how major component libraries organize their code. The migration is well-scoped as a first pass and the new 🚨 Must Fix
💡 Suggestions (non-blocking)
Overall this is a well-executed, careful refactor. The one |
… exported ContextMenuItemProps interface and remove duplicate
|
Claude finished @punkbit's task in 1m 59s —— View job Code ReviewGreat structural work — the modular file pattern is clean, consistent, and well-executed for a first pass. The architecture makes components much easier to navigate. 🙌 🚨 Must Fix
💡 Suggestions (non-blocking)
Overall this is a clean, well-scoped refactor. The one residual issue with duplicate |
|
Claude finished @punkbit's task in 1m 10s —— View job Code ReviewGreat iteration — the issues flagged in previous reviews have been addressed cleanly. The 🚨 Must Fix
💡 Suggestions (non-blocking)
Architecture direction is solid and consistent across all 100 files. One small duplication to clean up in |
…ared twice in the same file
|
Claude finished @punkbit's task in 1m 32s —— View job Code ReviewGreat structural work overall — the modular file pattern is consistent and well-executed across all 100 files. The previous issues (ContextMenu duplicate types, Button 🚨 Must Fix
💡 Suggestions (non-blocking)
|
…definitions from Flyout.tsx
|
Claude finished @punkbit's task in 1m 45s —— View job Code Review
All previously flagged issues have been resolved across the review iterations: ContextMenu duplicate type declarations, Flyout stale types, Flyout duplicate declarations, and the Button 💡 Suggestions (non-blocking)
✅ Architecture is clean and consistent across all 100 files. The modular |
|
Claude finished @punkbit's task in 1m 8s —— View job
Code ReviewAll previously flagged issues have been resolved cleanly across this review cycle. The architecture is consistent, the type declarations are correct, and the changeset documents every fix. 🙌 Resolved in this iteration:
💡 Suggestions (non-blocking, carry-forward notes for future passes)
✅ Architecture is clean and consistent across all 100 files. The modular |
📚 Storybook Preview Deployed✅ Preview URL: https://click-nghyjyv0w-clickhouse.vercel.app Built from commit: |
Why?
Provide an elegant file architecture pattern inspired by major component libraries. It has a main component, whose name serves as a namespace for types, styles, tests, stories (storybook) and a public export file. This is a first pass; further passes and iterations will be required, which is done to lower the risk of breaking changes.
🤖 TODO: once #798 merged change base to main branch
It aims to provide the following:
How?
Preview?
Button
Primary card
Toast