繁体   English   中英

ESLint - 如何禁用反应/禁止外国道具类型?

[英]ESLint - how to disable react/forbid-foreign-prop-types?

在我的 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 */

将此行放入.eslintrc

"react/prop-types": 0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM