简体   繁体   English

create-react-app不应用诸如“ button-has-type”和“ boolean-prop-naming”之类的eslint规则。

[英]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-typeboolean-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.

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