-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Prettier: Use prettier-plugin-organize-imports #899
base: master
Are you sure you want to change the base?
Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
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.
When I try this, it deletes imports if I paste them in:
Screen.Recording.2022-06-01.at.20.00.58.mov
Do you have "format on save" enabled? See: simonhaenisch/prettier-plugin-organize-imports#37 I'm a bit torn on that. I very much enjoy that it deletes unused imports (though I guess, ESLint would complain about that anyway?) but having that triggered on paste is a bit annoying. |
The way I see it, this is clearly a bug. None of the imports were supposed to be deleted, but it deletes them anyhow. I do have "format on save" enabled, but I also want to keep it that way. An yes, ESLint already takes care of unused imports. If you care a lot about those, we can compromise on increasing the severity of unused imports in ESLint so that the commit test fails for them. But this plugin is counterintuitve and, frankly, buggy. |
This PR is 1.5 years old and 0.5 years stale. I vote for it to be CLOSED. You may want to experiment with latest version (4.3.0), as this PR was done with 2.3.4 |
As we discussed, inconsistent import ordering and having to think about stuff like that are way too annoying. In #898, I didn't agree with where you put the type imports and that finally pushed me over the edge and I went looking for a solution. :D
I personally would have sorted the imports differently than this plugin but it uses the official TypeScript language service API and I much prefer not having to think about the imports at all.
If we actually do care about controlling the sort order (I don't think I do), there's also https://github.com/trivago/prettier-plugin-sort-imports.