Git Product home page Git Product logo

Comments (12)

lijunle avatar lijunle commented on August 23, 2024 1

@eckdanny I understand that, it is very hard to detect all dynamic dependencies. However, our principle is to try to enable one more, and one more detector.

For this particular issue (gulp-load-plugins), there are three levels of supports:

  • When seeing gulp-load-plugins package, all gulp-* dependencies are considered in use. 👉 #127
  • Recognize the dynamic reference (the packages are lazy loaded). 👉 #127
  • Recognize the gulp-load options, the gulp pattern from options is used.

From my estimate, the first feature will cover 80% user cases - although it will miss some unused dependencies. Besides the second feature, it will cover ~90% cases.

The first one should be easy, the second is hard - I will make a try. We won't consider the third feature until someone comes back and request a third feature.

from depcheck.

SgtPooki avatar SgtPooki commented on August 23, 2024

Can confirm. I am using a yeoman project along with the common

$ = require('gulp-load-plugins')();

syntax, and each of those gulp plugins are firing as unused deps. I may not be using all of them, but I am using more than enough to know that this is breaking.

To reproduce, use the https://github.com/yeoman/generator-gulp-webapp, start a new project, and simply run depcheck on it. It should fire even though many (if not all) of the gulp-plugin packages are being used.

from depcheck.

rumpl avatar rumpl commented on August 23, 2024

Hey guys, thanks for the interest in depcheck :)

Internally, depcheck handles this kind of things with its ignoreMatches option but I couldn't find a way to put it on the command line.

I started a new repo for a grunt plugin, as soon as it's released I will start working on a gulp plugin too, with these plugins you will be able to set the ignoreMatches option.

At one time I was thinking about an rc file, something like .depcheckrc where you could put all the options you want. What do you guys thinks about that ?

from depcheck.

SgtPooki avatar SgtPooki commented on August 23, 2024

@rumpl I think rc files are good, but I also think building a command line tool that can be passed all the options is the most versatile and future proof solution. If you add a .depcheckrc file that would be nice solution for some I am sure. I am starting to dislike rc files, because the last project I inherited had about 10 rc files in the project root.

from depcheck.

lijunle avatar lijunle commented on August 23, 2024

Hi, all.

I am taking care of this project. Could anybody tell me if he still has this problem with version 0.5.9? Is it worth to worth on this?

from depcheck.

lijunle avatar lijunle commented on August 23, 2024

I looked into this problem. The false alerts are caused by gulp-load-plugins loading dependencies with its own way.

from depcheck.

eckdanny avatar eckdanny commented on August 23, 2024

@lijunle I don't think dynamic loaders (e.g.; gulp-load-plugins, require-dir, ...) should be in scope for depcheck. Includes silliness like:

var pkg = 'f' + 'o' + 'o';
var foo = require(pkg);

Maybe just me, but I don't expect this behavior to be supported in a tool like this.

from depcheck.

eckdanny avatar eckdanny commented on August 23, 2024

@staxmanade re jshint-stylish: sol'n that made most sense to me was to explitize dependency with a require:

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var styllish = require('jshint-stylish'); // <== 

gulp.task('default', function () {
   gulp.src(['file.js'])
      .pipe(jshint('.jshintrc'))
      // .pipe(jshint.reporter('jshint-stylish'));
      .pipe(jshint.reporter(stylish));
});

from depcheck.

nfantone avatar nfantone commented on August 23, 2024

Came here for this.

depcheck on my project lists a lot of false positives (mostly, gulp related):

# nfantone at thelonious in ~/Development/js/2pv/floating-bar on git:bug/8106-yargs-missing ✖︎ [20:26:57]
→ depcheck
Unused devDependencies
* eslint
* gulp-autoprefixer
* gulp-changed
* gulp-clean-css
* gulp-concat
* gulp-debug
* gulp-declare
* gulp-eslint
* gulp-gzip
* gulp-handlebars
* gulp-htmlmin
* gulp-if
* gulp-iife
* gulp-imagemin
* gulp-inject
* gulp-install
* gulp-istanbul
* gulp-mocha
* gulp-plumber
* gulp-print
* gulp-replace-task
* gulp-rev
* gulp-rev-replace
* gulp-robots
* gulp-sequence
* gulp-sonar
* gulp-strip-debug
* gulp-tar
* gulp-uglify
* gulp-useref
* gulp-util
* gulp-webserver
* pre-commit
  • All gulp-* are used through gulp-load-plugins.
  • pre-commit has no explicit require and is used through a declaration in package.json itself, like:
  "pre-commit": [
    "validate"
  ]
  • eslint is used as the project's linter and installing locally avoids the need for a global dep and ensures equal versions all around.

from depcheck.

lijunle avatar lijunle commented on August 23, 2024

Hi, @nfantone thanks for reporting this. Could you please open a issue to track you requirements.

Besides, for the gulp-load-plugins, I have ideas and actively develop it here. Hope it can resolve most of your cases. :)

from depcheck.

lijunle avatar lijunle commented on August 23, 2024

Version 0.6.2 will be released soon to recognize the lazy loaded gulp plugins via gulp-load-plugins package. (Check this list)

From my offline testing, a yoeman generated web-app has 99% support. The only exception is babel-core, which I am not sure it is a false alert or really useless dependency.

I am closing this issue. If you get new false alerts, please open a new issue. Thanks for reporting!


Update: Version 0.6.2 is out.

from depcheck.

nfantone avatar nfantone commented on August 23, 2024

Nice!

from depcheck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.