Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sibelius/react-hot-loader-codemod
https://github.com/sibelius/react-hot-loader-codemod
codemod react react-hot-loader
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sibelius/react-hot-loader-codemod
- Owner: sibelius
- Created: 2019-02-10T19:19:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-02-10T19:23:00.000Z (over 5 years ago)
- Last Synced: 2024-10-19T19:54:10.244Z (20 days ago)
- Topics: codemod, react, react-hot-loader
- Language: TypeScript
- Size: 86.9 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-codemods - react-hot-loader-codemod
README
# React Hot Loader Codemod
## Usage of RHL codemod
First you need to install jscodeshift, and then run it using our transformer
```bash
npm i -g jscodeshiftjscodeshift -t src/reactHotLoaderTransformer.ts PATH_TO_FILES
```## Why do you need this codemod
RHL changed the hot api to be simpler (4.5.0+), from this one:
```jsx
import { hot } from 'react-hot-loader';const Sample = () => (
ok
);export default hot(module)(Sample)
```to this one:
```jsx
import { hot } from 'react-hot-loader/root';const Sample = () => (
ok
);export default hot(Sample);
```Doing find and replace in pure strings does not scale well, and can cause troubles
Using AST transformer you can make sure the code will be refactor properly.