Failed to compile after install eslint locally (propTypes is not defined)
See original GitHub issueIf you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
Yes, on OSX Sierra.
Description
create-react-app test
cd test/
yarn add eslint
yarn start
Expected behavior
Should compile successfully.
Actual behavior
yarn start
failed to compile, showing error: propTypes is not defined
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected):
test@0.1.0 /Users/dinhquangtrung/Desktop/test
└── react-scripts@1.0.7
node -v
:
v8.1.0
npm -v
:
5.0.3
Then, specify:
- Operating system: OSX Sierra
- Browser and version: (any)
Reproducible Demo
Repo: https://github.com/trungdq88/create-react-app-issue Travis Build: https://travis-ci.org/trungdq88/create-react-app-issue/builds/242429125
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (14 by maintainers)
Top Results From Across the Web
'Proptypes' is not defined - Stack Overflow
I'm receiving the following linting error 'PropTypes' is not defined. (no-undef) . Here is the code that is causing the issue: import React,...
Read more >[Solved]-'Proptypes' is not defined-Reactjs - appsloveworld
According to this issue comment. It appears to be because you have installed eslint 4.x when you should just use the eslint version...
Read more >Resolve types from React 'prop-types' : WEB-26418 - YouTrack
I have Webstorm 2018.2 EAP, React 16.4.0, "prop-types" package installed locally (15.6.1), have invalidated caches, add the PropTypes type definitions and ...
Read more >How To Customize ESLint Rules with an Ejected Create React ...
In this article, you will explore the reasons why we should utilize a linter like ESLint and how to customize it in a...
Read more >eslint-plugin-react - npm
It is also possible to install ESLint globally rather than locally (using npm install eslint --global). However, this is not recommended, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@trungdq88 React removed
PropTypes
since version 15.5, see here you can use prop-types package for it.I got that same error on a
state
variable defined at class level. I guess it is the same issue, isn’t it ?