[英]create-react-app doesn't apply eslint rules that are in place like `button-has-type` and `boolean-prop-naming`
I have generated a React app using create-react-app
. 我已经使用create-react-app
生成了一个React应用create-react-app
。 The generated app comes with eslint and eslint rules like button-has-type
and boolean-prop-naming
. 生成的应用带有eslint和eslint规则,例如button-has-type
和boolean-prop-naming
。 However, when I run npm start
, I don't see any errors that am expecting. 但是,当我运行npm start
,没有看到预期的任何错误。
Using above eslint rules I expect the following code to fail 使用上述eslint规则,我希望以下代码失败
<button>Hello</button>
and 和
App.propTypes = {
enabled: PropTypes.bool
};
Thanks 谢谢
you can install npm i -s prop-types
and use prop-types. 您可以安装npm i -s prop-types
并使用prop-types。
import { PropTypes } from 'prop-types';
App.propTypes = {
enabled: PropTypes.bool
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.