如何禁用文件中的ESLint react/prop-types规则? [英] How to disable ESLint react/prop-types rule in a file?
本文介绍了如何禁用文件中的ESLint react/prop-types规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将 React
和 ESLint
与 eslint-plugin-react
一起使用.
I'm using React
and ESLint
with eslint-plugin-react
.
我想在一个文件中禁用
prop-types
规则.
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>
);
}
});
推荐答案
只需将其放在文件顶部:
Just put this on top of your file:
/* eslint-disable react/prop-types */
这篇关于如何禁用文件中的ESLint react/prop-types规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文