score:92

Accepted answer

just put this on top of your file:

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

score:5

i had to do this in my .eslintrc config file to disable prop types validation error.

"rules": {
  "react/prop-types": "off"
}

score:8

sometimes i have small components in the same file as the major one. there proptypes seems overkill. then i usually do something like this

// eslint-disable-next-line react/prop-types
const rightarrow = ({ onpress, to }) => (<touchableopacity onpress={() => onpress(to)} style={styles.rightarrow}><chevrons.chevronright size={25} color="grey" /></touchableopacity>);

score:9

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 (
            <div classname="component">
                {this.props.title}
            </div>
        );
    }
});
/* eslint-enable react/prop-types */

score:34

i had to do:

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

this did not work for me:

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

to disable globally in your .eslintrc file (old version v6.0 or below):

{
    "rules": {
        "react/forbid-prop-types": 0
    }
}

to disable globally in your .eslintrc file (new version above v6.0):

{
    "rules": {
        "react/prop-types": 0
    }
}

score:223

if you have only one file you want to disable prop-type validation you can use:

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

in cases where you have multiple files you can add to your .eslintrc file in your root directory a rule to disable prop-type validation:

{
 "plugins": [
     "react"
  ],
  "rules": {
    "react/prop-types": 0
  }
}

for further rules you can checkout this link that solved my issue and for inconvenience you can also read up from eslint-plugin-react's github documentation about how to disable or enable it with various options.


Related Query

More Query from same tag