Use case
Framework
Owner
Correct Ts Specifiers
This package transforms import specifiers in source-code from the broken state TypeScript's compiler (
tsc
) required (prior TypeScript v5.7 RC) into proper ones. This is useful when source-code is processed by standards-compliant software like Node.js. This is a one-and-done process, and the updated source-code should be committed to your version control (ex git); thereafter, source-code import statements should be authored compliant with the ECMAScript (JavaScript) standard.Sveltekit Vite Preprocess Migration
This codemod updates import paths and ensures compatibility with changes in library structures. In this example, it modifies the import statement for vitePreprocess to reflect updates in the library's API.
Sveltekit Import And Path Simplification
This codemod simplifies the import statements and path resolution in your SvelteKit project. It replaces the usage of
resolvePath
and concatenation withbase
by using theresolveRoute
function from$app/paths
. This results in cleaner and more readable code.Goto To Location Href
Codemod Description
This codemod is designed to replace specific patterns in TypeScript files with updated code logic. It transforms instances of
goto($A)
intowindow.location.href = $A;
when the$A
value is a URL starting withhttp://
orhttps://
. This refactor makes external navigation more explicit by usingwindow.location.href
.Dynamic To Static Env Transformer
This codemod transforms import {$A} from '$env/dynamic/public'; and import {$A} from '$env/dynamic/private'; into their static counterparts, replacing them with import {$A} from '$env/static/public'; and import {$A} from '$env/static/private';, respectively. It ensures compatibility for prerendered pages and static deployments.
Add Status To Error Handling
This codemod improves error handling in SvelteKit by updating the way errors are returned in the load function. In SvelteKit 1, errors were handled inconsistently, often missing the status property or failing to trigger the handleError hook. SvelteKit 2 standardizes error handling by automatically including the status and message properties in error responses.
Replace Throw With Error Call
This codemod simplifies error handling and redirects in your TypeScript project by replacing
throw error()
andthrow redirect()
statements with direct calls toerror()
andredirect()
. This change aligns with modern practices and results in cleaner, more readable code.React/Update React Imports
This codemod transforms React imports to use named imports instead of default or namespace imports. This helps reduce bundle size by allowing better tree-shaking of unused React exports.
Import Change Js To Ts Extensions
This codemod changes
.js
to.ts
file extension in relative, top-level imports. If no.js
file extension was previously used, it adds.ts
file extension instead.Import Add Js Extensions
This codemod adds
.js
file extension to relative, top-level imports.Custom Renderers
This codemod updates the
renderElement
function to include TypeScript typings and adds a default case for rendering unsupported element types.Deno Replace Import Assertions
This codemod helps migrate JavaScript/TypeScript files from using the deprecated import assertions syntax to the updated import attributes syntax. The change aligns with the updated proposal for import attributes and ensures compatibility with newer versions of runtimes like Deno 2 and modern browsers that have already removed support for import assertions.
Deno Remove Node:Process Import
This codemod removes redundant import process from 'node:process'; statements, as process is now globally available in Deno v2
Deno Import STL Types
This codemod updates deprecated Deno typescript interfaces in your codebase. It automatically imports the necessary typscript interfaces from the standard library
Deno Import Stl Functions
This codemod updates removed Deno function calls in Deno v2 to their new equivalents from the standard library It also automatically adds the necessary import statements from the appropriate modules.
Vue 2 To Vue 3 Refs And Methods
Example
This codemod turns X into Y. It also does Z. Note: this is a contrived example. Please modify it.
Remix/2/React Router/Upgrade
This codemod automates most of the manual steps outlined in the Remix to React Router upgrade guide.
React 17 Default Props To Params
Example
This codemod turns X into Y. It also does Z. Note: this is a contrived example. Please modify it.
React Router/6/UseHistory To UseNavigate
This codemod migrates
useHistory
touseNavigate
in React Router codebases. It replacesuseHistory
imports and updates all instances ofhistory.push
,history.replace
,go
,goBack
, andgoForward
to align with theuseNavigate
API.React Router/6/Switch To Routes
This codemod updates
Switch
components toRoutes
in React Router, in line with React Router v6 and newer. It also adjusts the imports, replacingSwitch
withRoutes
inreact-router-dom
import statements.