How to find the reason for the warning: PropTypes has been moved to a separate package

If I get the warning "Warning: PropTypes has been migrated to a separate package." How can I find which npm package is still using it? The warning does not provide any details about which file or package calls it.

enter image description here

+4
source share
2 answers

Reacting is not recommended using propTypesfrom the main package, so you cannot use React.PropTypes. When you use React.PropTypes, you get a warning, but when you use propTypesout prop-types, you are good.

What is it:)

You can use this knowledge to find a list of npm packages that use it with the following command.

find ./node_modules -type f -print0 | xargs -0 grep 'PropTypes' | cut -d/ -f3 | sort | uniq | xargs -I{} grep -L 'prop-types' ./node_modules/{}/package.json

npm, propTypes , , package.json , , prop-types . prop-types , .

PS: bash, . ( npm, propTypes)

enter image description here

PPS: , Unix-.

+7

, , npm ls . , , prop-types. .

npm ls

npm ls [[<@scope>/]<pkg> ...]

aliases: list, la, ll

, , , .

0

Source: https://habr.com/ru/post/1686687/


All Articles