Codemod Registry
Explore community-led codemods to migrate, optimize, and transform your codebase.
Ready to contribute?
Build your own codemod and share it with the community.
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Explore community-led codemods to migrate, optimize, and transform your codebase.
React.forwardRef will be deprecated for Function Components in near future. This codemod removes forwardRef function. ### Before: ```jsx import { forwardRef } from "react"; const MyInput = forwardRef(function MyInput(props, ref) { // ... }); ``` ### After: ```tsx const MyInput = function MyInput({ ref, ...props }) { // ... }; ```
This codemod updates the usage of PiniaColada to ensure that the enabled and gcTime options are correctly placed under queryOptions. Previously, these options were directly passed as top-level properties, which is now deprecated. The codemod transforms these patterns into the new structure where enabled is nested under queryOptions. ## Changes Applied: - Moves enabled under `queryOptions` - Moves `gcTime` under `queryOptions` if present - Ensures PiniaColada is always called with a valid configuration object ## Before ``` app.use(PiniaColada, { plugins, enabled: () => true, pinia }); app.use(PiniaColada, { enabled: () => true, gcTime, pinia }); ``` ## After ``` app.use(PiniaColada, { plugins, queryOptions: { enabled: () => true }, pinia }); app.use(PiniaColada, { plugins, pinia, queryOptions: { enabled: () => true, gcTime } }); ``` ## Using this codemod You can run this codemod with the following command: ```bash npx codemod pinia-colada-0-14-migration-recipe ```
This is a [codemod](https://codemod.com) created with [```codemod init```](https://docs.codemod.com/deploying-codemods/cli#codemod-init). ## Using this codemod You can run this codemod with the following command: ```bash npx codemod json-breather ``` ### Before ```ts const toReplace = "hello"; ``` ### After ```ts const replacement = "hello"; ```
Moves HOC calls to the global scope ## Example ### Before ```ts <Router history={browserHistory}> <Switch> <Route path='/' render={(props) => ( <Route exact path='/a' component={HOC(PageComponent)} /> )} /> </Switch> </Router>; ``` ### After ```ts const HOCPageComponent = HOC(PageComponent); <Router history={browserHistory}> <Switch> <Route path='/' render={(props) => ( <Route exact path='/a' component={HOCPageComponent} /> )} /> </Switch> </Router>; ```
Build your own codemod and share it with the community.