Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create-react-app: Cannot read property 'ScopeType' of undefined #56

Closed
karlhorky opened this issue Jun 21, 2021 · 5 comments
Closed

create-react-app: Cannot read property 'ScopeType' of undefined #56

karlhorky opened this issue Jun 21, 2021 · 5 comments

Comments

@karlhorky
Copy link
Member

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

Screen Shot 2021-06-21 at 11 05 27

@karlhorky
Copy link
Member Author

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

@pedrosimao
Copy link

I am facing the same issue. What is the solution?

@karlhorky
Copy link
Member Author

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:

069f62d

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

@mimoid-prog
Copy link

This error happened to me out of nowhere.
Removing node_modules and installing packages again fixes it.

@brenmoss
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants