codemod-proptypes-to-flow

Removes React.PropTypes and attempts to transform to flowtypes

  • 所有者: billyvg/codemod-proptypes-to-flow
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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)

主要指标

概览
名称与所有者billyvg/codemod-proptypes-to-flow
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2016-04-21 22:53:50
推送于2018-09-06 21:26:01
最后一次提交2018-07-03 16:03:39
发布数0
用户参与
星数163
关注者数4
派生数28
提交数99
已启用问题?
问题数10
打开的问题数6
拉请求数12
打开的拉请求数1
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?