https://github.com/interviewstreet/codemod-proptypes-to-flow
Forked codemod
https://github.com/interviewstreet/codemod-proptypes-to-flow
Last synced: over 1 year ago
JSON representation
Forked codemod
- Host: GitHub
- URL: https://github.com/interviewstreet/codemod-proptypes-to-flow
- Owner: interviewstreet
- License: mit
- Created: 2018-07-24T07:18:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:40:57.000Z (over 3 years ago)
- Last Synced: 2025-02-07T23:27:06.779Z (over 1 year ago)
- Language: JavaScript
- Size: 1.74 MB
- Stars: 2
- Watchers: 80
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# codemod-proptypes-to-flow [](https://travis-ci.org/billyvg/codemod-proptypes-to-flow) [](https://codecov.io/gh/billyvg/codemod-proptypes-to-flow)
Removes `React.PropTypes` and attempts to transform to [Flow](http://flow.org/).
### Setup & Run
* `npm install -g jscodeshift`
* `git clone https://github.com/billyvg/codemod-proptypes-to-flow`
* `jscodeshift -t codemod-proptypes-to-flow/src/index.js `
* Use the `-d` option for a dry-run and use `-p` to print the output
for comparison
#### Options
Behavior of this codemod can be customized by passing options to jscodeshift e.g.:
```
jscodeshift -t codemod-proptypes-to-flow/src/index.js --flowComment=line
```
Following options are accepted:
##### flowComment
`--flowComment=` - type of flow comment. Defaults to `block`.
```
--flowComment=block: /* @flow */
--flowComment=line: // @flow
```
##### propsTypeSuffix
`--propsTypeSuffix=` - used to customize the type names generated by the codemod. Provided string will be used alone or appended to Component's name when defining props type. Defaults to `Props`.
Default:
```
type Props = {...}
type MyComponentProps = {...}
```
With `--propsTypeSuffix=PropsType`:
```
type PropsType = {...}
type MyComponentPropsType = {...}
```
### Not working/Implemented yet
* Custom validators
* `React.createClass`
* Use of importing PropTypes
### Contributors
* Thanks to [@skovhus](https://github.com/skovhus) for adding support for functional components and modernizing the codebase a bit (a lot)