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

Missing and unused dependencies #69

Open
javagl opened this issue Sep 28, 2020 · 2 comments
Open

Missing and unused dependencies #69

javagl opened this issue Sep 28, 2020 · 2 comments

Comments

@javagl
Copy link
Contributor

javagl commented Sep 28, 2020

When running depcheck in the main directory (after a yarn global add depcheck), there are some unused and missing dependencies reported:

Unused dependencies
* @types/jest
* @types/node
Missing dependencies
* eslint-config-react-app: .\package.json
* babel-eslint: .\package.json
* eslint-plugin-import: .\package.json
* eslint-plugin-flowtype: .\package.json
* eslint-plugin-jsx-a11y: .\package.json
* eslint-plugin-react: .\package.json
* eslint-plugin-react-hooks: .\package.json
* @redux-saga/core: .\src\index.tsx

(Where one of the "unused" dependencies caused some issues in another context).

Can somebody who is more familiar with dependency management confirm that

  1. the unused dependencies can safely be removed
  2. it makes sense to add the missing dependencies

?

(The missing ones don't seem to be strictly necessary, that's why I'm not sure...)

@weegeekps
Copy link
Contributor

The unused dependencies are type packages for TypeScript. @types/jest is for the Jest unit test stuff which we aren't using much of, and @types/node is the typical node stuff. Including each isn't necessarily a bad thing, although both could be moved to devDependencies.

I believe the eslint missing dependencies are due to the fact that depcheck checks against the package.json, and all of the linter configuration is within the react-scripts package. I'm not sure why it's also flagging @redux-saga/core as a missing dependency as the project wouldn't build without that.

We probably can do a little cleanup of the package.json file. I see a bunch of things under dependencies that should probably be moved to devDependencies for the sake of the CI build process. Ultimately, the production builds are only including what is actually being used by the code under /src given how react-scripts configures webpack.

@weegeekps
Copy link
Contributor

Recently the new version of React and Create React App came out, which I'll be upgrading us to soon. When I do so I will audit the dependencies and move those that should be moved to devDependencies.

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

2 participants