reactjs - ESLint - 如何禁用反应/禁止外国道具类型?
问题描述
在我的 Chrome 控制台中,我看到以下警告:
Module Warning (from /Users/me/sites/site/node_modules/react-scripts/node_modules/eslint-loader/index.js):
Line 365:16: Using propTypes from another component is not safe because they may be removed in production builds react/forbid-foreign-prop-types
Line 365:45: Using propTypes from another component is not safe because they may be removed in production builds react/forbid-foreign-prop-types
根据文档,我尝试通过将以下内容添加到导致警告的文件顶部来禁用此警告:
/* eslint-disable no-underscore-dangle, forbid-foreign-prop-types */
这对使警告静音无效。我究竟做错了什么?
解决方案
弄清楚了:
/* eslint-disable react/forbid-foreign-prop-types */