Skip to content

Commit d880fa1

Browse files
Merge pull request #959 from Workiva/update-note-about-migrator-companion
FED-3249 Update docs about migrator companion codemod
2 parents f0cbd99 + 7a6eec8 commit d880fa1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

doc/null_safety/null_safe_migration.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ dart pub global run over_react_codemod:null_safety_migrator_companion --yes-to-a
5151
```
5252

5353
This codemod will:
54-
- Add nullability hints to props/state that are defaulted/initialized in class components.
55-
- These hints will cause defaulted/initialized values to be migrated as "late required".
54+
- Add nullability hints to state mixin/class fields
55+
- These hints will cause defaulted/initialized values to be migrated as "late required" (the same thing is done for props in the [required props codemod](#required-props-codemod)).
5656
See our [prop requiredness and nullability](#prop-requiredness-and-nullability) docs for more details on whether you should keep them required following the migration.
57+
- All non-initialized state fields will have optional nullable hints.
58+
- Add nullable hints for callback ref types.
59+
- Add annotations to disable required prop validation for `connect` props. See [`connect` required props migration case](#wrapper-and-connected-components-and-required-props) for more info.
5760

5861
#### Required props codemod
5962

@@ -63,7 +66,9 @@ as a separate commit before proceeding with the rest of the migration.
6366
This is a two-step process involving two sub-commands:
6467

6568
1. `null_safety_required_props collect` - Collects requiredness data for all OverReact props based on usages in the specified packages and all their transitive dependencies.
66-
1. `null_safety_required_props codemod` - Adds null safety migrator hints to OverReact props using prop requiredness data from 'collect' command.
69+
1. `null_safety_required_props codemod` - Adds null safety migrator hints to OverReact props taking into account:
70+
1. Prop requiredness data from the 'collect' command.
71+
1. If the prop has a default in `defaultProps`, it will get "late required" hints.
6772

6873
Start with the `collect` command, following its help output for instructions:
6974
```shell
@@ -208,7 +213,7 @@ of the null safety and required props docs for instructions on how to handle the
208213

209214
For connect, either:
210215
- Disable validation using the instructions linked above
211-
- Note: for now, this must be done manually, but we'll be adding a codemod to help do this automatically for `connect`: https://github.com/Workiva/over_react_codemod/issues/295
216+
- Note: The [null safety migrator companion codemod](#companion-codemod) does this automatically for all `connect` props.
212217
- Refactor your component to instead utilize [OverReact Redux hooks](../over_react_redux_documentation.md#hooks),
213218
which avoid this problem by accessing store data and dispatchers directly in the component as opposed to passing it in via props.
214219

0 commit comments

Comments
 (0)