Open
Description
π Search Terms
organizeImports import sort rename
β Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
β 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
- What do you want to use this for? Easier refactoring that doesn't make linters mad
- What shortcomings exist with current approaches? They require me to do a lot of tedious clicking around
- 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