Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React: VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed

I recently built my React App (scaffolded using Create React App, using yarn build) using our CI server and got build error shown below:

Error: VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed      
  at Array.forEach (<anonymous>)
  at Array.forEach (<anonymous>)
  at Array.map (<anonymous>)

Dependencies:

"dependencies": {
    "core-js": "^3.0.1",
    "react": "^16.8.0",
    "react-dom": "^16.8.0",
    "prop-types": "^15.6.2",
    "react-router-dom": "^4.2.2"
  }
like image 413
Adhy Wiranata Avatar asked Jun 24 '19 09:06

Adhy Wiranata


2 Answers

You can downgrade "eslint-plugin-react" to 7.13.0 version to wait for fix in 7.14.0. It works for me.

like image 97
saggid Avatar answered Oct 16 '22 15:10

saggid


This is an issue with the newest version of eslint-plugin-react (version 7.14.0) . People are already working on a fix and this will probably be solved soon in a newer version. The code is already merged. For more you can check: https://github.com/yannickcr/eslint-plugin-react/issues/2319

For now as a work-around you can downgrade the eslint-plugin-react to 7.13.0 in order to temporary solve your problem till this is fixed.

Last Update: The issue is now fixed by releasing the version 7.14.1 with just this fix. If you are getting this error just update to the latest version and the issue and make sure that you have the version 7.14.1 or later and this will be solved.

like image 23
John Skoumbourdis Avatar answered Oct 16 '22 16:10

John Skoumbourdis