-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: Opinionated import order #1332
Comments
I think I'm in favor of this. It's something I have in all of my non trivial projects. We would need to make it work with the custom base path, but that should be doable. I guess the argument against is "user can add it", and we tend to stay away from opinionated linting/formatting by default. Curious to see what others think. |
I'd love to see that! It made managing imports in my projects 100 times better and the only reason I usually don't have it in them is that I'm too lazy to install it 🤷 |
I'm very pleased with ianvs sorter. Works a lot better than trivago, especially if you take into account "use client" / "use server" directives in upcoming RSC and Server Actions. |
I think cta turbo indoctrinationated me here since I add this to all my projects. Re the custom paths. Maybe we could read the file replace a certain string in the file and write the file back out. E.g
|
We wouldn't need to do a custom sort order, the default from ianvs is enough and if devs want their own they can add themselves. Just having the plugin and some basic rules (like no duplicates etc) goes a long way for consistency and keeping git diffs small |
Oh that's true tbf |
I like prettier-plugin-organize-imports. It uses TypeScript LSP to sort imports. |
I'd definitely like to see this added :) |
Is someone doing this, i see a couple of prs but not much movement. i can bash a pr out today if people want? |
So something i forgor was that the default cta app does not incude prettier. so do we only want to include this if they chose tailwind? |
not technically closed yet. |
Is your feature request related to a problem? Please describe.
Is there any plans on creating an opinionated prettier import auto-sorter for the t3 base template?
Describe the solution you'd like to see
Something like @trivago/prettier-plugin-sort-imports or @ianvs/prettier-plugin-sort-imports would be very nice to have already set-up.
Describe alternate solutions
Import order structure example:
Additional information
No response
The text was updated successfully, but these errors were encountered: