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

chore(deps): remove unused JS deps #11630

Merged
merged 3 commits into from
Aug 24, 2023

Conversation

agilgur5
Copy link
Member

Motivation

None of these deps are used -- note how the yarn.lock had no changes

  • Less to install, less to update. No real security benefits as none of these made it into the bundle (just potential install security benefits)

Modifications

  • Remove json-merge-patch and react-moment from deps
  • Remove copyfiles, glob, and webfonts-generator from devDeps

Verification

  • Confirmed that yarn.lock had no changes after yarn install
  • Searched the codebase and confirmed that none of these are used in the current revision
  • Install still succeeds, build still passes

- none of these are used -- note how the `yarn.lock` had no changes

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 added type/dependencies PRs and issues specific to updating dependencies area/ui javascript Pull requests that update Javascript dependencies labels Aug 20, 2023
Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything similar to go mod tidy but for typescript?

@agilgur5
Copy link
Member Author

agilgur5 commented Aug 20, 2023

Not built-in like that, unfortunately. npm isn't even part of the language, the way deps can be implicitly used (e.g. loaders are referenced but not imported in webpack.config.js) complicates things a lot, and all the compile-to-JS languages (e.g. TS, Vue, Svelte, etc) make it even harder (not to mention ambient types in TS).

The closest thing are a few external packages that try their best but can absolutely have false positives:

  • depcheck is the most popular one, but it hasn't had a release in a few years. It also has a good amount of false positives in the issues (some due to outdated nature)
  • knip is a recent one that is currently well maintained.

That being said, I have never used either and nor have I ever really needed something like that. Usually once you stop using a dep, you remove it from the package.json as well.
It happens that someone forgets, but pretty infrequently in my experience. I could try adding something like the above external packages, but at this point I think it's not worth the effort. If this happens more frequently, we can certainly reconsider.

@agilgur5
Copy link
Member Author

agilgur5 commented Aug 20, 2023

Related, I am adding yarn-deduplicate in a separate PR. It has some vague similarities to go mod tidy but for the lockfile specifically (go.sum / yarn.lock), not for the main dependency manifest (go.mod / package.json).

EDIT: See #11637 which adds it

Signed-off-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
@terrytangyuan terrytangyuan merged commit 12a3313 into argoproj:master Aug 24, 2023
22 checks passed
@agilgur5 agilgur5 deleted the deps-remove-unused-js branch October 10, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui javascript Pull requests that update Javascript dependencies type/dependencies PRs and issues specific to updating dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants