Skip to content

Conversation

simison
Copy link
Contributor

@simison simison commented Nov 24, 2017

Fixes React-PropTypes-to-prop-types codemod transforming already migrated named imports incorrectly.

These:

import { PropTypes } from 'prop-types';
import { PropTypes as PT } from 'prop-types';

Were incorrectly transformed into this:

import 'prop-types';

This PR adds a check to transform only nodes importing from react, thus ignoring those importing from prop-types.

Previously this codemod would basically assume already migrated stuff to use default export:

import PropTypes from 'prop-types';

Also adds tests for both cases.

Fixes #187

@threepointone
Copy link
Contributor

Thanks for this!

@threepointone threepointone merged commit 036b16c into reactjs:master Jul 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React-PropTypes-to-prop-types codemod breaks migrated named import
2 participants