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

react-scripts v3 via npm requires a peer of typescript@* #6834

Open
kjg opened this issue Apr 17, 2019 · 25 comments
Open

react-scripts v3 via npm requires a peer of typescript@* #6834

kjg opened this issue Apr 17, 2019 · 25 comments
Assignees
Milestone

Comments

@kjg
Copy link

kjg commented Apr 17, 2019

The inclusion of @typescript-eslint/eslint-plugin and @typescript-eslint/parser in react-scripts means there are now a lot of warnings about typescript being an unmet peer dependency when part of a project not using typescript.

I understand it is just a warning and I know I can ignore it, but I still wanted to bring it up. So many warnings coming from this package makes it harder to pull out the warnings I do want to fix.

@iansu
Copy link
Contributor

iansu commented Apr 17, 2019

That's a good point. I'm not sure if there's anything we can do about it unfortunately but we'll look into it.

@iansu iansu self-assigned this Apr 17, 2019
@iansu iansu added this to the 3.0 milestone Apr 17, 2019
@ianschmitz ianschmitz self-assigned this Apr 17, 2019
@ianschmitz
Copy link
Contributor

We ran into the same issue way back when adding TypeScript support when we added fork-ts-checker-webpack-plugin as a dependency. We solved it by working with their team to remove the peer dependency on typescript.

/cc @bradzacher do you think it would be reasonable to remove the peer dep on typescript in your packages?

@bradzacher
Copy link

I feel a good solution is that everyone should just use typescript 😄

But seriously, I don't think it's a huge deal if we remove them, considering we have it set to *.
Unless someone else on the core team has a problem, I'm happy to remove it.

cc @JamesHenry, @j-f1, @armano2

@JamesHenry
Copy link

Fine with me, we’ll make the update on our side

@ianschmitz
Copy link
Contributor

JamesHenry pushed a commit to typescript-eslint/typescript-eslint that referenced this issue Apr 20, 2019
@iansu iansu modified the milestones: 3.0, 3.x Apr 22, 2019
@jrock2004
Copy link

Seems like this issue still remains, unless this fix will come with another version?

image

@bradzacher
Copy link

@jrock2004 - this issue is open, and the attached PR #6859 hasn't been merged yet.
So it's probably safe to assume that it hasn't been fixed and released yet.

@DylanSp
Copy link

DylanSp commented Jul 8, 2019

Has there been any activity on this issue since late April? It's not a showstopper, but it's a little annoying.

@trollepierre
Copy link

trollepierre commented Jul 23, 2019

Some projects are not using typescript. That's annoying to add a package that is not necessary!

If I don't you flowtype or typescript, I should not have them inside a warning. => remove them from the peer dept

Capture d’écran 2019-07-23 à 14 29 41

@edmondburnett
Copy link

edmondburnett commented Sep 3, 2019

A related issue it the typescript-eslint dependencies (v1.13.0) are now out of date. Using eslint 6 with react-scripts 3.1.1 causes various circular dependency issues. Newer typescript-eslint releases are available that support eslint 6.

This is in a non-Typescript project.

npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of @typescript-eslint/parser@^1.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.0.1 requires a peer of @typescript-eslint/parser@1.x but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.

@nickserv
Copy link
Contributor

nickserv commented Sep 11, 2019

The usage of typescript as a peer dependency in react-scripts and eslint-config-react-app is incorrect, as they don't always require TypeScript. TypeScript and all related dependencies should be removed from these packages, then another pair of packages should be made that add the peer dependencies when used with create-react-app --typescript. If this makes sense I can propose a pull request.

@lostfields
Copy link

and another funny thing is that @typescript-eslint/eslint-plugin@1.13.0 requires eslint@^5 but eslint-config-react-app has a peerDependency of eslint@^6.

Maybe upgrade to @typescript-eslint/eslint-plugin@^2 when you are at it?

sugyan added a commit to sugyan/image-dataset that referenced this issue Sep 19, 2019
react-script 3.1 cannot run eslint well...
facebook/create-react-app#6834
@trivikr
Copy link

trivikr commented Sep 29, 2019

Maybe upgrade to @typescript-eslint/eslint-plugin@^2 when you are at it?

This upgrade happened in #7540, and it was released in v3.1.2

@tobireif
Copy link

tobireif commented Dec 5, 2019

It would be great if this could get fixed.

@damien-git
Copy link

Please add this test for future builds:

npx create-react-app test
cd test
./node_modules/.bin/eslint .
Error: Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'

@brandonmay687
Copy link

I'm getting this warning and create-react-app isn't creating the src or public files. It only creates node_modules, pavkage.json and package-lock.json. Nothing else is installed and once done it says "found 0 vulnerabilities". I've tried every possible walkaround and cannot get create-react-app to actually create a react app. Getting really frustrating

@AlexKvazos
Copy link

Very quiet here, do we have any update or even a hack to suppress this warning in the meantime?

@brandonmay687
Copy link

I finally found a fix. Aparently there was something in my npm cache preventing me from moving forward. Using npm cache delete cleared my cache and fixed the issue

@verheyenkoen
Copy link

@battleb2014 That didn't work for me. I have yarn installed so it is using that but yarn cache clear also didn't do the trick. Also I'm installing using npx but I guess that shouldn't make any difference.

@Vanuan
Copy link

Vanuan commented May 28, 2020

I see several options:

  • give up and install typescript for all users even though it's not used (add typescript to dependencies)
  • publish a separate distribution of create-react-app for typescript, e.g. ts-create-react-app and remove typescript from the main one
  • make ts-related packages optional (peerDependenciesMeta/optional) to suppress warnings

It looks like there's a PR to make @typescript-eslint optional: #8376
But it fails. I've tried to fix it here: #9078


But still, it would fail if there are any .ts files (#8936).
So the shared eslint-config-react-app needs to know whether typescript is being used of not. Which defeats the purpose of the shared config.
Maybe it makes more sense to create the derived eslint-config-react-app-ts rather than trying to configure the config

@nickserv
Copy link
Contributor

I think react-scripts should just depend on TypeScript, as there’s already plenty of other optional tools in it and the architecture seems to be coupled to TypeScript template support (meaning react-scripts itself depends on TypeScript, not just cra-template-typescript)

@trollepierre
Copy link

I would go with:

make ts-related packages optional (peerDependenciesMeta/optional) to suppress warnings

@tobireif
Copy link

Still getting

warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.20.0" has unmet peer dependency
"typescript@>=2.8.0 || >= 3.2.0-dev [...]".

@rohitgurudasani
Copy link

use npm instead of yarn and also upgrade node, npm versions and clean cache.
npx create-react-app reactjs-app --use-npm

upgrade node
nvm install 14.18.1

upgrade npm
npm install -g npm@latest

clean npm cache
npm cache clean -f

@rickstaa
Copy link

rickstaa commented Dec 19, 2021

use npm instead of yarn and also upgrade node, npm versions and clean cache. npx create-react-app reactjs-app --use-npm

upgrade node nvm install 14.18.1

upgrade npm npm install -g npm@latest

clean npm cache npm cache clean -f

@rohitgurudasani's work around works for me. Thanks a lot! I however have to clear the cache every now again to remove the warnings.

nightsky108 pushed a commit to nightsky108/typescript-eslint that referenced this issue Dec 21, 2021
@ianschmitz ianschmitz removed their assignment May 16, 2023
eliot-akira pushed a commit to expreva/tstree that referenced this issue Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.