Use case
Framework
Owner
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
.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.