P

sveltekit-import-and-path-simplification

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

Simplify SvelteKit Import and Path Usage

This codemod simplifies the import statements and path resolution in your SvelteKit project. It replaces the usage of resolvePath and concatenation with base by using the resolveRoute function from $app/paths. This results in cleaner and more readable code.

Transformations

This codemod performs the following transformations:

  • Import Statement: Transforms:

    typescript

    into

    typescript
  • Path Resolution: Transforms:

    typescript

    into

    typescript

Usage

To apply this codemod, run the workflow script on your TypeScript files. Ensure you have the necessary dependencies installed and your project is configured to use this codemod.

Example

Before

typescript

After

typescript

Ready to contribute?

Build your own codemod and share it with the community.