小编典典

如何禁用文件中的ESLint react / prop-types规则?

reactjs

我使用ReactESLinteslint-plugin-react

我想disableprop-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>
        );
    }
});

阅读 805

收藏
2020-07-22

共1个答案

小编典典

只需将其放在文件顶部即可:

/* eslint react/prop-types: 0 */
2020-07-22