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

doesn't seem to detect require('os') in source #294

Closed
marcjordan opened this issue Oct 9, 2018 · 1 comment
Closed

doesn't seem to detect require('os') in source #294

marcjordan opened this issue Oct 9, 2018 · 1 comment

Comments

@marcjordan
Copy link

Bug Description

In my code, I have:

const os = require('os');

Yet depcheck seems to think the os module is unused. Also, if I have not installed the 'os' module in package.json, I don't get the missing package warning

Code snippets

Where the dependency is used:

/* eslint-disable no-unused-vars */

const optimist = require('good');
const os = require('os');

Where the dependency is listed in package.json:

{
  "dependencies": {
    "good": "0.0.1",
    "os": "^0.1.1"
  }
}

Versions

  • node -v: 6.14.3
  • npm -v: 6.4.1
  • depcheck -v: 0.6.11

Extra info

The example above was just using the good package from the depcheck/depcheck-test-e2e repo on GitHub.

@rumpl
Copy link
Member

rumpl commented Oct 9, 2018

Hi @marcjordan,

The os package is a nodejs core module and shouldn't be installed, see here.

Depcheck filters all the builtin modules that you require or import in your code and hence it will tell you that the package is unused, meaning you don't really need to install it (see the source code of node-os, it just exports the core os module).

@rumpl rumpl closed this as completed Oct 9, 2018
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