Greetings fellow TypeScript enthusiasts! I’m excited to introduce TSImportRefiner, a tool designed to simplify and optimize TypeScript import statements.
TSImportRefiner is a script that automates the refactoring of TypeScript import statements. It efficiently organizes imports based on path aliases from tsconfig.json, enhancing code readability and maintenance.
Before Refactoring
After Refactoring
Key Features:
Alias Conversion: Automatically converts module paths to defined aliases.
Sort Imports: Neatly organizes imports by line length.
Easy Integration: Easily integrates with existing TypeScript projects with minimal setup required.
Getting Started:
Install via npm:
Usage is straightforward:
where can be a single file or a directory.
Example Usage:
An example command:
which processes all .ts and .tsx files in the src directory.
Contributing:
Contributions are welcomed and appreciated. Whether it’s feature development, bug fixes, or suggestions, your input helps improve TSImportRefiner.
TSImportRefiner is here to make your TypeScript experience smoother and more efficient. I’m looking forward to your feedback and contributions. Let’s make TypeScript coding cleaner and more enjoyable together!
GitHub Repository: TSImportRefiner