Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request migrates the code's parsing logic from using Babel-based tools to utilizing the official TypeScript compiler API (typescript library). This change enhances the reliability, type safety, and ease of maintenance when processing TypeScript and JSX/TSX files.
Additionally this pull request includes significant updates to the project configuration, codebase, and documentation. The changes focus on integrating Biome for linting and formatting, refactoring TypeScript components, updating dependencies, and improving documentation.
Key Changes:
Switch to TypeScript Compiler (typescript):
TransformationContext and ts.visitEachChild instead of Babel’s traversal and
transformation methods.
Improved Type Handling:
Property Removal Logic:
File Output Optimization:
If no changes are detected, the file is left untouched, improving performance and reducing unnecessary writes.
Configuration and Dependencies:
biome.jsonc
: Added Biome configuration to enable import organization, linting, and formatting rules.package.json
: Removed Babel dependencies and added Biome as a new dependency.Code Refactoring:
example/_clean.tsx
: ReplacedTestComponent
with a newTypeScriptComponent
that includes TypeScript typing and a sample function.src/index.ts
: Refactored to replace Babel with TypeScript for parsing and transforming files, and updated the command-line interface options. [1] [2]Documentation:
readme.md
: Updated to reflect the support for TypeScript React Native projects and added a warning about code formatting during the cleaning process. [1] [2]Testing:
test/index.test.ts
: Added new test cases for TypeScript files and updated existing tests to reflect the changes in the codebase. [1] [2] [3]