question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modules with same name as a built-in (e.g. 'path') are incorrectly identified as unused dependency

See original GitHub issue

It appears as though path is incorrectly identified as an unused dependency.

dmurray@ss9:...andbox/depcheck-path 0> npm run depcheckjson

> depcheck-path@1.0.0 depcheckjson /home/dmurray/sandbox/depcheck-path
> depcheck --json|json

{
  "dependencies": [
    "path"
  ],
  "devDependencies": [],
  "missing": {},
  "using": {
    "depcheck": [
      "/home/dmurray/sandbox/depcheck-path/package.json"
    ]
  },
  "invalidFiles": {},
  "invalidDirs": {}
}
dmurray@ss9:...andbox/depcheck-path 0> 

This is a trivial demo project, containing server.js which includes log.js, which uses path.

To reproduce:

  1. unpack depcheck-path.zip
  2. npm install
  3. npm run depcheckjson

depcheck-path.zip

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Berkmann18commented, Oct 23, 2018

@rumpl In my case, I’m here because of this issue where the dependency (lodash) was classified as unused… Which wasn’t.

Regarding using native modules (read dependencies that are already imported), I guess it would make sense to flag said dependencies as unneeded (note: the “unneeded” as opposed to the “unused”).

0reactions
stale[bot]commented, Mar 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing from builtin library when module with same name ...
The solution is "pick a different name". Your approach of not renaming is a bad idea. Why can't you rename your module? What's...
Read more >
Installation fails for @types/<dependency_name> packages
Attempt to initialise with the yarn command when there are @types/<dependency_name> dependencies in package.json , for example: { "name": "opus.
Read more >
Go Modules Reference - The Go Programming Language
A module is identified by a module path, which is declared in a go.mod file, together with information about the module's dependencies. The...
Read more >
How to fix "The following module is missing from the file ...
Then go to your admin>>modules, click the Uninstall Tab and uninstall all modules listed there. Some error may occur when uninstalling all at...
Read more >
Imports - checkstyle
To configure the check so that star imports from packages java.io and java.net are allowed: <module name="AvoidStarImport"> <property ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found