You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This branch keeps the non-high-priority `react-codemod` transforms as a legacy jscodeshift snapshot under [`codemods/legacy/transforms/`](./codemods/legacy/transforms/).
3
+
The following jscodeshift-based codemods from the original [`react-codemod`](https://github.com/reactjs/react-codemod) project are available under [`codemods/legacy/transforms/`](./codemods/legacy/transforms/).
4
4
5
-
The legacy snapshot is preserved for source reference, upstream-style tests, and branch preview parity with the structure of `reactjs/react-codemod`.
5
+
These codemods are preserved for compatibility and can be run directly with jscodeshift.
Copy file name to clipboardExpand all lines: PARITY_STATUS.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,26 @@
1
-
# Legacy Parity Status
1
+
# Parity Status
2
2
3
3
Last updated: 2026-04-15
4
4
5
5
Status meanings:
6
6
7
-
-`Certified`: replacement-grade rollout confidence. Strict/default package tests are green, public test posture is portable, and there are no known rollout-blocking logic gaps versus the legacy jscodeshift codemod. `Certified` may include intentional safe extensions on legacy-unsupported edge cases, as long as intentional legacy behavior remains unbroken.
8
-
-`Legacy Snapshot`: preserved as upstream jscodeshift source and tests on this branch, but not promoted as part of the active JSSG replacement surface.
7
+
-`Certified`: replacement-grade confidence. Tests are green, public test posture is portable, and there are no known logic gaps versus the original jscodeshift codemod. May include safe extensions on edge cases the original did not handle, as long as original behavior remains unbroken.
8
+
-`Legacy`: available as a jscodeshift codemod under `codemods/legacy/`. Not yet ported to JSSG.
9
9
10
-
## Active JSSG Surface
10
+
## JSSG Codemods
11
11
12
-
These are the only codemods promoted as active replacements on this branch.
13
-
14
-
| Codemod | Legacy Source | Status | Notes |
12
+
| Codemod | Original Source | Status | Notes |
15
13
| --- | --- | --- | --- |
16
-
|`replace-use-form-state`|`replace-use-form-state.ts`|`Certified`|Legacy fixture surface plus added multi-import regression coverage are green. Collection-wide replacement on matching `react-dom` imports fixes a real parity gap, and the broader multi-import handling is treated as an acceptable safe extension where legacy only partially migrated files. |
17
-
|`replace-act-import`|`replace-act-import.ts`|`Certified`|Legacy fixture surface plus added multi-import regression coverage. This closes a real parity gap, and the mixed test-utils partial-removal path is an acceptable safe extension that does not break intentional legacy behavior. |
18
-
|`replace-string-ref`|`replace-string-ref.ts`|`Certified`|Legacy fixture surface plus added namespace/default-export/multi-ref coverage are green, and the direct-superclass guard restores the intended direct-superclass behavior by avoiding the prior mixin false positive. |
19
-
|`replace-reactdom-render`|`replace-reactdom-render.ts`|`Certified`|Legacy fixtures plus added multi-alias regression coverage are green. The extra multi-alias handling is an acceptable safe extension over legacy implementation limits; it preserves intentional legacy behavior while covering additional valid cases. |
20
-
|`react-proptypes-to-prop-types`|`React-PropTypes-to-prop-types.js`|`Certified`| Full legacy fixture surface is green, targeted mixed-import validation is aligned, and no JSSG-specific rollout blocker was found in the audit. No additional extension beyond the legacy behavior is currently relied on for certification. |
21
-
|`use-context-hook`|`use-context-hook.ts`|`Certified`|Legacy fixture surface plus added multi-import regression coverage are green. The multi-import handling goes beyond the legacy implementation, but it is treated as an acceptable safe extension because it preserves intentional legacy behavior while covering additional valid cases. |
14
+
|`replace-use-form-state`|`replace-use-form-state.ts`|`Certified`|Full fixture coverage plus multi-import regression tests are green. Collection-wide replacement on matching `react-dom` imports fixes a real parity gap. |
15
+
|`replace-act-import`|`replace-act-import.ts`|`Certified`|Full fixture coverage plus multi-import regression tests. Mixed test-utils partial-removal path is a safe extension. |
16
+
|`replace-string-ref`|`replace-string-ref.ts`|`Certified`|Full fixture coverage plus namespace/default-export/multi-ref tests are green. Direct-superclass guard restores intended behavior. |
17
+
|`replace-reactdom-render`|`replace-reactdom-render.ts`|`Certified`|Full fixture coverage plus multi-alias regression tests are green. |
18
+
|`react-proptypes-to-prop-types`|`React-PropTypes-to-prop-types.js`|`Certified`| Full original fixture surface is green. No JSSG-specific rollout blocker found. |
19
+
|`use-context-hook`|`use-context-hook.ts`|`Certified`|Full fixture coverage plus multi-import regression tests are green. |
22
20
23
-
## Legacy Snapshot Surface
21
+
## Legacy Codemods
24
22
25
-
These codemods remain available only as an upstream jscodeshift snapshot under [`codemods/legacy/transforms/`](./codemods/legacy/transforms/):
23
+
These codemods are available as jscodeshift transforms under [`codemods/legacy/transforms/`](./codemods/legacy/transforms/):
This branch is a React-facing preview of how this repo should look as a replacement-style home for `react-codemod`.
3
+
This repository contains a collection of codemods to help update React apps.
4
4
5
-
It promotes 6 audited JSSG codemods as the active surface and preserves the remaining upstream jscodeshift codemods as a legacy snapshot.
5
+
All codemods are free and open source, with the source code available in this repository.
6
6
7
-
## Active JSSG Transforms
7
+
## Usage
8
8
9
-
These transforms are the active replacement surface on this branch. They are source-first JSSG codemods and are not described here as Codemod Registry entries unless they are actually published.
9
+
Run a codemod from this directory using the [Codemod CLI](https://go.codemod.com/cli-docs):
10
10
11
-
-[`use-context-hook`](./codemods/jssg/use-context-hook/) — replace `useContext` usage with `use`
12
-
-[`replace-act-import`](./codemods/jssg/replace-act-import/) — move `act` from `react-dom/test-utils` to `react`
13
-
-[`replace-string-ref`](./codemods/jssg/replace-string-ref/) — replace deprecated string refs with callback refs
14
-
-[`replace-use-form-state`](./codemods/jssg/replace-use-form-state/) — rename `useFormState` to `useActionState`
15
-
-[`replace-reactdom-render`](./codemods/jssg/replace-reactdom-render/) — replace `ReactDOM.render` with `createRoot(...).render(...)`
16
-
-[`react-proptypes-to-prop-types`](./codemods/jssg/react-proptypes-to-prop-types/) — replace `React.PropTypes` with `prop-types`
11
+
```bash
12
+
pnpm dlx codemod@latest jssg run --language tsx --target <path> ./codemods/jssg/<transform>/scripts/codemod.ts
13
+
```
14
+
15
+
-`<transform>` — name of the codemod (see available codemods below)
16
+
-`<path>` — files or directory to transform
17
+
18
+
## Available Codemods
19
+
20
+
### `use-context-hook`
21
+
22
+
Replaces usages of `React.useContext(...)` with `React.use(...)`.
23
+
24
+
See [`use-context-hook`](./codemods/jssg/use-context-hook/) for details.
25
+
26
+
### `replace-act-import`
27
+
28
+
Updates `act` import path from `react-dom/test-utils` to `react`.
29
+
30
+
See [`replace-act-import`](./codemods/jssg/replace-act-import/) for details.
31
+
32
+
### `replace-string-ref`
33
+
34
+
Replaces deprecated string refs with callback refs.
35
+
36
+
See [`replace-string-ref`](./codemods/jssg/replace-string-ref/) for details.
37
+
38
+
### `replace-use-form-state`
39
+
40
+
Replaces usages of `useFormState()` with `useActionState()`.
17
41
18
-
## Legacy Codemods
42
+
See [`replace-use-form-state`](./codemods/jssg/replace-use-form-state/) for details.
19
43
20
-
All non-priority transforms are preserved as an upstream-style legacy jscodeshift snapshot under [`codemods/legacy/`](./codemods/legacy/).
44
+
### `replace-reactdom-render`
21
45
22
-
See [LEGACY.md](./LEGACY.md) for the legacy catalog and testing notes.
46
+
Replaces usages of `ReactDOM.render()` with `createRoot(node).render()`.
47
+
48
+
See [`replace-reactdom-render`](./codemods/jssg/replace-reactdom-render/) for details.
49
+
50
+
### `react-proptypes-to-prop-types`
51
+
52
+
Replaces `React.PropTypes` references with the `prop-types` package and adds the appropriate import statement.
53
+
54
+
See [`react-proptypes-to-prop-types`](./codemods/jssg/react-proptypes-to-prop-types/) for details.
55
+
56
+
### Legacy Codemods
57
+
58
+
Additional jscodeshift-based codemods from the original `react-codemod` project are available under [`codemods/legacy/`](./codemods/legacy/). See [LEGACY.md](./LEGACY.md) for the full catalog.
23
59
24
60
## Development
25
61
@@ -28,15 +64,28 @@ pnpm install
28
64
pnpm run ci
29
65
```
30
66
31
-
Run active JSSG checks only:
67
+
Run tests:
68
+
69
+
```bash
70
+
pnpm test
71
+
```
72
+
73
+
Run type checking:
32
74
33
75
```bash
34
-
pnpm run test:active
35
-
pnpm run check-types:active
76
+
pnpm run check-types
36
77
```
37
78
38
-
Run the legacy snapshot test harness:
79
+
Run legacy codemod tests:
39
80
40
81
```bash
41
82
pnpm run test:legacy
42
83
```
84
+
85
+
## Support and Contributing
86
+
87
+
If you want to contribute, you're welcome to submit a pull request.
0 commit comments