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

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.


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

Just put this on top of your file:

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

Tags:

Reactjs

Eslint