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 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
.Add Cookie Path To All Methods
This codemod adds
{ path: '/' }
to allcookies
method calls in your TypeScript project. It ensures that cookies are set, deleted, or serialized with the correct path specified, which helps in consistent cookie handling across different environments.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.Event Handling On Change
This codemod automates the update of your
onChange
event handler function to support the newDescendant[]
type and selection handling introduced in version 0.104.With React Integration
This codemod transforms the usage of
withReact(createEditor())
into auseMemo
-based structure, which wraps the editor creation and introduces an inline-checking function (isInline
) for the editor instance. This transformation optimizes the creation of the editor object by memoizing it.Cursor Selection Handling
This codemod shows how to migrate cursor and
selection
handling from Slate v0.88 to v0.104, including the Preventing runtime errors from null selections.Editor Has Path
This guide covers the migration of
Editor.hasPath
usage from Slate.js v0.88 to v0.104. The API has changed from a property-based check to a function call pattern, requiring updates to existing code.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 Import STL Types
This codemod updates deprecated Deno typescript interfaces in your codebase. It automatically imports the necessary typscript interfaces from the standard library
Webpack To Rspack/Migrate Update Babel Loader To Swc Loader
Using builtin:swc-loader offers better performance compared to the babel-loader and the external swc-loader, as it avoids frequent communication between JavaScript and Rust.
Remix Js/V2/Migration Recipe
This recipe is a set of codemods that will help migrate to Remix.js v2.
Remix Js/V2/Typescript 2 Update Links Function And Property Names
Route links properties should all be the React camelCase values instead of HTML lowercase values.
Styledictionary/4/Type
What Changed
TypeScript/V5.6/Arrow Function Condition To Binary Expression
Identify cases where an arrow function is mistakenly used instead of a comparison operator (e.g., x => 0 instead of x >= 0) and convert the arrow function expressions to proper comparison operations.
TypeScript/V5.6/Add Test For Regex In Conditional
Add .test() to regex literals in conditionals
Typescript/Remove Console
This codemod removes all
console
statements from your TypeScript and JavaScript filesReact/19/Migration Recipe
This recipe is a set of codemods that will fix some of React 19 breaking changes.
Codemod verified
Regularly tested and maintained by our engineers and codemod expert community