Skip to content
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

Support customization of where type imports are placed in organize/sort imports #52820

Closed
jakebailey opened this issue Feb 17, 2023 · 0 comments · Fixed by #55269
Closed

Support customization of where type imports are placed in organize/sort imports #52820

jakebailey opened this issue Feb 17, 2023 · 0 comments · Fixed by #55269
Assignees
Labels
Domain: Organize Imports Issues with the organize imports feature Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript

Comments

@jakebailey
Copy link
Member

Filing this so I don't forget about it; after #52115, we allow (though, do not fully expose support for) the ability to customize the sort order used by organize/sort/auto imports.

The intent is that we are able to match commonly used linters / formatters, leading towards fewer errors and edits needed to reach the "final state" of a file. e.g., instead of inserting an import at the end, then needing a linter to move it, we could just put it in the right place. Or, if you accidentally (or intentionally!) run Organize Imports, it should be possible to configure it such that it doesn't do anything.

This is mostly working already, however, our sort always puts type imports at the end. This differs from eslint-plugin-simple-import-sort and dprint, which ignore the type keyword and sort things that way (lydell/eslint-plugin-simple-import-sort#124).

We should be able to add a new configuration which controls this behavior.

I have half a change for this sitting in a branch already, but it still needs some work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Organize Imports Issues with the organize imports feature Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants