cuadraman cuadraman - 15 days ago 7
React JSX Question

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

Answer

Just put this on top of your file:

/* eslint react/prop-types: 0 */