-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add @ianvs/prettier-plugin-sort-imports
#3029
Conversation
|
The cool thing is that it works w/ |
Nice! Can we also add 0a41422 to |
Sure! I was planning on doing that in a different PR, since I assume this will be squash merged & that git revision will no longer be accurate? |
What do you think is the best course @natemoo-re a. Merge this PR sans git revision hash and create a second PR that is based on the squash commit of this PR |
So what I mainly wanted to get out of #3013 was auto-removing unused imports, including TS types. Does this do that? Can you test to confirm? I can't tell based on the diff, since it adds more lines than it removes. I actually care about sort order much less than that. fwiw, if you read my comment in #3013, the side-effect imports issue will solve itself in the next TypeScript patch, where you can just place it above the others in its own group, which VSCode will respect. As long as this PR can auto-remove unused TS type imports AND unused named exports, then I'm pretty happy either way. Conceptually I like the idea of relying on TypeScript directly vs. a fork of an ESLint plugin, but I also wasn't super impressed with that TS CLI, so... 🤷 |
No, the prettier plugin does not remove imports or exports, and I wouldn't want to add that functionality to it either, as it is out-of-scope for its purpose and personally I would not want that behavior. Since it sounds like that's what you're looking for, I'd recommend closing this PR and waiting for the typescript tool. |
So this isn't an eslint plugin, it's a prettier plugin, so it runs with every I'd use |
I was working off your title 😅 |
my mistake! I misstyped
It's always worked for me over 4+ years (through VSCode), but if you can point to anything that would be good reason to hold off I'd love to see it. But yea, removing unused imports and consistently formatting the remaining imports are the two things that I wanted to tackle. If everyone is good for waiting a few more days, then that original PR should be good to reopen to tackle both (and I can reword it to be more clear). |
Changes
@ianvs/prettier-plugin-sort-imports
pnpm run format
organize-imports-cli
& I've had success w/ it. It's a fork of a trivago version that did not respect side effect imports.continuing #3013
cc @FredKSchott @IanVS
Testing
Docs