-
Notifications
You must be signed in to change notification settings - Fork 15
refactor: 💡 resolve component path redundancy #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
hoorayimhelping
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly prefer we don't do this. Having a bunch of files named index open in your editor and not being able to tell at a glance which index maps to which file is way worse than having redundancy in imports within the click-ui project (which consumers of Click-UI won't ever see). See screenshot.
When I think about day to day work, I'm much more likely to switch between tabs and be confused by which index tab is which file than I am to actually notice an import path. To me, this convention in the industry feels like prioritizing the aesthetics of not having redundant paths over having contextual information conveyed through filenames.
|
Couldn't we get the same experience on the import side by re-exporting a component from the |
@DreaminDani @hoorayimhelping This a8c8db4#diff-88cf62b736c97cedd374c8c0eaea996c92364a1cb36bcd91368f39f3efa34931R1 would look better for you? |
See PR attached video demo "LSP Direct to source" |
Why?
To reduce redundancy found in component import statements, e.g. "@/components/Badge/Badge" requires "Badge" twice. We can omit the second one by leveraging the default resolution, e.g., index, since the directory name is the component name. Consequently, we shorten long paths into an elegant or concise import statement.
🤖 TODO: Once #773 is merged, switch base branch to main.
How?
Preview?
LSP Direct to source
demo-lsp-editor-direct-source.mov
Lint warn to import local leaf