Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Audit unused dependencies #3537

Closed
pdehaan opened this issue Sep 19, 2017 · 6 comments · Fixed by #3869
Closed

Audit unused dependencies #3537

pdehaan opened this issue Sep 19, 2017 · 6 comments · Fixed by #3869

Comments

@pdehaan
Copy link
Collaborator

pdehaan commented Sep 19, 2017

Steps to reproduce:

$ npx depcheck

Unused dependencies
* classnames
* fancy-dedupe
* lodash.debounce
* moment
* object-sizeof
* page-metadata-parser
* react-json-inspector
* redux-logger
* redux-thunk
* redux-watch
* reselect
* tippy-top-sites

Was looking through a recent PR and noticed we didn't seem to be using classnames package anymore (but it still appears to be in the package.json). We may want to quickly troll through the possibly accurate list from depcheck and see if there are any other modules which we aren't using but still appear in package.json.

Note that there are some false-positives, such as tippy-top-sites which is used in a tippymc:* npm script in package.json (via yamscripts.yml).

@pdehaan
Copy link
Collaborator Author

pdehaan commented Sep 19, 2017

Results:

NOTE: I omitted CHANGELOG.md and package-lock.json results for readability.

$ git grep classnames
# package.json:    "classnames": "2.2.5",
$ git grep fancy-dedupe
# package.json:    "fancy-dedupe": "0.1.0",
$ git grep lodash.debounce
# package.json:    "lodash.debounce": "4.0.8",
$ git grep moment
# package.json:    "moment": "2.15.2",
$ git grep object-sizeof
# package.json:    "object-sizeof": "1.1.1",
$ git grep page-metadata-parser
# package.json:    "page-metadata-parser": "0.6.0",
$ git grep react-json-inspector
# package.json:    "react-json-inspector": "7.0.0",
$ git grep redux-logger
# package.json:    "redux-logger": "2.7.4",
$ git grep redux-thunk
# package.json:    "redux-thunk": "2.1.0",
# system-addon/vendor/Redux.jsm:   * example, see the documentation for the `redux-thunk` package. Even the
# system-addon/vendor/Redux.jsm: * See `redux-thunk` package as an example of the Redux middleware.
# system-addon/vendor/redux.js:      * example, see the documentation for the `redux-thunk` package. Even the
# system-addon/vendor/redux.js:    * See `redux-thunk` package as an example of the Redux middleware.
$ git grep redux-watch
# package.json:    "redux-watch": "1.1.1",
$ git grep reselect
# package.json:    "reselect": "2.5.4",
$ git grep tippy-top-sites
# package.json:    "tippy-top-sites": "1.3.1"
# package.json:    "tippymc:manifest": "cpx \"node_modules/tippy-top-sites/top_sites.json\" system-addon/data/content/tippytop",
# package.json:    "tippymc:images": "cpx \"node_modules/tippy-top-sites/images/**/*\" system-addon/data/content/tippytop/images",
# yamscripts.yml:    manifest: cpx "node_modules/tippy-top-sites/top_sites.json" system-addon/data/content/tippytop
# yamscripts.yml:    images: cpx "node_modules/tippy-top-sites/images/**/*" system-addon/data/content/tippytop/images

@5earle
Copy link

5earle commented Oct 4, 2017

I'm a student at Seneca college learning open source, and I was hoping to work on this bug for my course. However i am a first timer and might need some help with locating the files

@k88hudson
Copy link
Contributor

k88hudson commented Oct 10, 2017

@5earle sure, happy to help! In this case, you will need to remove any unused packages from package.json (i.e. dependencies that are installed with npm) by seeing if there are any places they are being used. Let me know if you have any questions!

@k88hudson
Copy link
Contributor

@5earle Here's an example of how you might search to see if a dependency is used:

First, let's pick a dependency to check in package.json – let's try "redux".

To see if "redux" is used anywhere in the system-addon/ subdirectory, I rungit grep \"redux\" -- system-addon in my terminal. This is what I see:

system-addon/content-src/lib/init-store.js:const {createStore, combineReducers, applyMiddleware} = require("redux");
system-addon/test/unit/content-src/lib/snippets.test.js:const {createStore, combineReducers} = require("redux");
system-addon/test/unit/lib/ActivityStreamMessageChannel.test.js:const {createStore, applyMiddleware} = require("redux");
system-addon/test/unit/lib/Store.test.js:const {createStore} = require("redux");
system-addon/vendor/Redux.jsm:this.EXPORTED_SYMBOLS = ["redux"];

Since I do get matches, we shouldn't remove this dependency. If I didn't get any matches, I could remove "redux" from package.json.

@k88hudson
Copy link
Contributor

@5earle were you able to get set up ok?

@Mardak Mardak assigned Mardak and unassigned k88hudson Nov 21, 2017
@Mardak
Copy link
Member

Mardak commented Nov 21, 2017

Sorry 5earle, I ended up grabbing this as part of fixing #2321.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants