in transforms/React-PropTypes-to-prop-types.js [216:239]
function removePropTypesImport(j, root) {
let hasModifications = false;
root
.find(j.Identifier)
.filter(
path =>
path.node.name === 'PropTypes' &&
path.parent.node.type === 'ImportSpecifier' &&
path.parent.parent.node.source.value === 'react'
)
.forEach(path => {
hasModifications = true;
localPropTypesName = path.parent.node.local.name;
const importDeclaration = path.parent.parent.node;
importDeclaration.specifiers = importDeclaration.specifiers.filter(
specifier =>
!specifier.imported || specifier.imported.name !== 'PropTypes'
);
});
return hasModifications;
}