I have generated a React app using create-react-app
. The generated app comes with eslint and eslint rules like button-has-type
and boolean-prop-naming
. However, when I run npm start
, I don't see any errors that am expecting.
Using above eslint rules I expect the following code to fail
<button>Hello</button>
and
App.propTypes = {
enabled: PropTypes.bool
};
Thanks
you can install npm i -s prop-types
and use prop-types.
import { PropTypes } from 'prop-types';
App.propTypes = {
enabled: PropTypes.bool
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.