Skip to content

Instantly share code, notes, and snippets.

@dguo
Last active July 11, 2017 21:27
Show Gist options
  • Save dguo/7114c4feb70a890424ea8c4006c1d39c to your computer and use it in GitHub Desktop.
Save dguo/7114c4feb70a890424ea8c4006c1d39c to your computer and use it in GitHub Desktop.
Hacky codeshift to use React's prop-types package
# https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes
# I didn't feel like downloading their codeshift.
#
# in all files in current directory, replace:
# import React, {Component, PropTypes} from 'react';
#
# with:
# import React, {Component} from 'react';
# import PropTypes from 'prop-types';
perl -pi -e "s/import React, \{Component, PropTypes\} from 'react';/import React, \{Component\} from 'react';\nimport PropTypes from 'prop-types';/g;" *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment