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.
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.
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?
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
Fine with me, we鈥檒l make the update on our side
Seems like this issue still remains, unless this fix will come with another version?
@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.
Has there been any activity on this issue since late April? It's not a showstopper, but it's a little annoying.
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
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/[email protected] requires a peer of @typescript-eslint/parser@^1.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/[email protected] requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @typescript-eslint/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/[email protected] requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
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.
and another funny thing is that @typescript-eslint/[email protected]
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?
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
It would be great if this could get fixed.
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'
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
Very quiet here, do we have any update or even a hack to suppress this warning in the meantime?
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
@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.
I see several options:
create-react-app
for typescript, e.g. ts-create-react-app
and remove typescript from the main onepeerDependenciesMeta
/optional
) to suppress warningsIt 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
I think react-scripts should just depend on TypeScript, as there鈥檚 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)
I would go with:
make ts-related packages optional (peerDependenciesMeta/optional) to suppress warnings
Most helpful comment
It would be great if this could get fixed.