Skip to content

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

Closed
@jakebailey

Description

@jakebailey

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions