mxcube / mxcubeweb

MXCuBE-Web
http://mxcube.github.io/mxcubeweb/
GNU Lesser General Public License v3.0
20 stars 37 forks source link

Some unused and some missing Javascript dependencies? #1242

Closed fabcor-maxiv closed 5 days ago

fabcor-maxiv commented 4 weeks ago

Seems like we might have a bunch of unused Javascript dependencies and some that are missing (!?), see below. Maybe we could investigate further and tidy up.

$ pnpx depcheck
Packages: +126
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 126, reused 76, downloaded 50, added 126, done
Unused dependencies
* @fortawesome/react-fontawesome
* dustjs-helpers
* dustjs-linkedin
* everpolate
* history
* jsmpeg
* liform-react
* plotly.js
* popper.js
* react-clipboard.js
* react-plotly.js
* react-router
* react-sticky
* shortid
* underscore
* ws
Unused devDependencies
* @testing-library/react
* @testing-library/user-event
* babel-preset-react-app
* concurrently
* less
* less-watch-compiler
* sass
* wait-on
* webpack
* webpack-dev-server
Missing dependencies
* @babel/eslint-parser: ./.eslintrc.js
* eslint-plugin-unicorn: ./.eslintrc.js
* eslint-plugin-promise: ./.eslintrc.js
* eslint-plugin-sonarjs: ./.eslintrc.js
* eslint-plugin-simple-import-sort: ./.eslintrc.js
* eslint-plugin-react-hooks: ./.eslintrc.js
* eslint-plugin-jest-dom: ./.eslintrc.js
* eslint-plugin-testing-library: ./.eslintrc.js
* eslint-plugin-jest-formatting: ./.eslintrc.js
fabcor-maxiv commented 4 weeks ago

What do you think @axelboc?

axelboc commented 4 weeks ago

It'd be good to do a bit of a clean-up, you're right.

I'd be very careful about this, though. I'm not sure how depcheck works, but identifying unused dependencies can be tricky. For instance, some of the dependencies reported are peer dependencies, like plotly.js (peer dep of react-plotly.js).

As a safety check, after removing a dependency, one can run pnpm install --resolution-only to make sure there aren't any peer dependency issues.

I'll see if I have time to take a look.

fabcor-maxiv commented 4 weeks ago

I'd be very careful about this, though. I'm not sure how depcheck works, but identifying unused dependencies can be tricky. For instance, some of the dependencies reported are peer dependencies, like plotly.js (peer dep of react-plotly.js).

Yes, I picked the depcheck tool at random, and I for sure do not know enough about this topic to judge its output. Definitely needs closer investigation. Not a high priority, obviously. There might be some low-hanging fruit in terms of cleaning. And maybe the "missing dependencies" part is an actual issue (I do not know).