我使用React和ESLint用eslint-plugin-react。
React
ESLint
eslint-plugin-react
我想disable在prop-types一个文件中的规则。
disable
prop-types
var React = require('react'); var Model = require('./ComponentModel'); var Component = React.createClass({ /* eslint-disable react/prop-types */ propTypes: Model.propTypes, /* eslint-enable react/prop-types */ render: function () { return ( <div className="component"> {this.props.title} </div> ); } });
只需将其放在文件顶部即可:
/* eslint react/prop-types: 0 */