create-react-app: Cannot read property 'ScopeType' of undefined
karlhorky opened this issue · comments
When using create-react-app
with the following setup instructions, the error below occurs:
Instructions:
yarn create react-app my-app
cd my-app
CI=true npx install-peerdeps@latest --yarn --dev @upleveled/eslint-config-upleveled
cp node_modules/@upleveled/eslint-config-upleveled/templates/{*,.eslint*} .
touch .gitignore && grep -Fxq ".eslintcache" .gitignore || echo ".eslintcache" >> .gitignore
yarn upgrade react-scripts
Error:
Failed to compile
Error while loading rule '@typescript-eslint/naming-convention': Cannot read property 'ScopeType' of undefined
Occurred while linting /Users/k/p/my-app/src/index.js
This seems to be caused by the following dependency chain: react-scripts@4.0.3 > eslint-plugin-testing-library@^3.9.2 > @typescript-eslint/experimental-utils@^3.10.1
I am facing the same issue. What is the solution?
We are addressing it with Yarn Resolutions, by adding a resolution like the following in our package.json
:
"resolutions": {
"eslint-plugin-testing-library": "4.12.4"
}
This will force the version 4.12.4
of the package eslint-plugin-testing-library
to be installed, regardless of what versions other packages are depending on.
See our change here:
This is a workaround and may break things.
There is also a pull request to upgrade this dependency in react-scripts
itself: facebook/create-react-app#10817
This error happened to me out of nowhere.
Removing node_modules
and installing packages again fixes it.
This error happened to me out of nowhere. Removing
node_modules
and installing packages again fixes it.
This has been causing me issues for a while now... I found a weird solution where saving an unchanged css modules file allowed a watched build to succeed and the error goes away until I edit a ts file... then save an unchanged css module and the watcher builds and so on...
Turns out I too needed to remove the node_modules and install again and the problem is now solved.. thank you for this solution!