codemod-proptypes-to-flow

Removes React.PropTypes and attempts to transform to flowtypes

  • Owner: billyvg/codemod-proptypes-to-flow
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

codemod-proptypes-to-flow Build Status codecov

Removes React.PropTypes and attempts to transform to Flow.

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 <path>
  • 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 <path>

Following options are accepted:

flowComment

--flowComment=<block, line> - type of flow comment. Defaults to block.

--flowComment=block:  /* @flow */
--flowComment=line:   // @flow
propsTypeSuffix

--propsTypeSuffix=<suffix> - 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 for adding support for functional components and modernizing the codebase a bit (a lot)

Main metrics

Overview
Name With Ownerbillyvg/codemod-proptypes-to-flow
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2016-04-21 22:53:50
Pushed At2018-09-06 21:26:01
Last Commit At2018-07-03 16:03:39
Release Count0
用户参与
Stargazers Count163
Watchers Count4
Fork Count28
Commits Count99
Has Issues Enabled
Issues Count10
Issue Open Count6
Pull Requests Count12
Pull Requests Open Count1
Pull Requests Close Count2
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private