This rule forbids using another component's prop types unless they are explicitly imported/exported. This allows people who want to use babel-plugin-transform-react-remove-prop-types to remove propTypes from their components in production builds, to do so safely.
In order to ensure that imports are explicitly exported it is recommended to use the "named" rule in eslint-plugin-import in conjunction with this rule.
This rule checks all objects and ensures that the propTypes
property is not used.
The following patterns are considered warnings:
import SomeComponent from './SomeComponent';
SomeComponent.propTypes;
var { propTypes } = SomeComponent;
SomeComponent['propTypes'];
The following patterns are not considered warnings:
import SomeComponent, {propTypes as someComponentPropTypes} from './SomeComponent';
This rule aims to make a certain production optimization, removing prop types, less prone to error. This rule may not be relevant to you if you do not wish to make use of this optimization.