forbid-foreign-prop-types
Configuration
Rule Details
This rule forbids using another component's prop types unless they are
explicitly imported / exported. It allows tools such as
babel-plugin-transform-react-remove-prop-types
to safely strip propTypes from production builds.
To ensure imports are explicitly exported, pair this rule with the
named rule in eslint-plugin-import.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
allowInPropTypes
If true, the rule does not report foreign propTypes usage when it
appears inside a propTypes declaration. The declaration may be either
an assignment to <Component>.propTypes or a static propTypes class
field.
Examples of correct code with { "allowInPropTypes": true }:
When Not To Use It
This rule helps make removing propTypes from production code safe.
Skip it if you don't strip propTypes in production. Higher-order
components that hoist a wrapped component's propTypes may also need
this rule disabled.