Search code examples
reactjseslint

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


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

I want to disable the prop-types rule in one file.

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>
        );
    }
});

Solution

  • Just put this on top of your file:

    /* eslint-disable react/prop-types */