How to disable ESLint react/prop-types rule in a file?

后端 未结 5 825
无人及你
无人及你 2020-12-13 11:37

I\'m using React and ESLint with eslint-plugin-react.

I want to disable the prop-types rule in one f

5条回答
  •  佛祖请我去吃肉
    2020-12-13 12:25

    I had to wrap the whole component with the eslint ignore comments.

    var React = require('react'); 
    var Model = require('./ComponentModel');
    
    /* eslint-disable react/prop-types */
    var Component = React.createClass({
    
        propTypes: Model.propTypes,
    
        render: function () {
            return (
                
    {this.props.title}
    ); } }); /* eslint-enable react/prop-types */

提交回复
热议问题