Skip to content

Update import/export specifier sort on renameΒ #57975

Open

Description

πŸ” Search Terms

organizeImports import sort rename

βœ… Viability Checklist

⭐ Suggestion

Renaming an exported function that is imported as one of many named imports can make that list of import specifiers become unsorted. When we execute auto-imports, we try to detect how/whether an existing list of named imports is currently sorted and insert the new specifier in the correct spot. We could do something similar when updating an import or export specifier during a Rename command.

πŸ“ƒ Motivating Example

We have an eslint rule that enforces import sort order. I just renamed a function impliedNodeFormatForEmit to getImpliedNodeFormatForEmit, and afterwards I had to go fix the eslint rule failure in 6 different files. It would be nice not to have to do that.

πŸ’» Use Cases

  1. What do you want to use this for? Easier refactoring that doesn't make linters mad
  2. What shortcomings exist with current approaches? They require me to do a lot of tedious clicking around
  3. What workarounds are you using in the meantime? A lot of tedious clicking around
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions