How to use the depcheck.special function in depcheck

To help you get started, we’ve selected a few depcheck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scimusmn / stele / scripts / depcheck.js View on Github external
'url-loader',
    'webpack-cli',
    'webpack-dev-server',
    'yarn',
  ],
  // skip calculation of missing dependencies
  skipMissing: true,
  ignoreDirs: [
    'dist',
    'dll',
    'release',
    'src/dist',
  ],
  // the target special parsers
  specials: [
    depcheck.special.babel,
    depcheck.special.eslint,
    depcheck.special.webpack,
  ],
};

depcheck(path.join(__dirname, '..'), options, (unused) => {
  const unusedDependencies = _.get(unused, 'dependencies', null);
  const unusedDevDependencies = _.get(unused, 'devDependencies', null);
  if (!_.isEmpty(unusedDependencies)) {
    console.log(chalk.yellow.bold('Unused dependencies'));
    console.log(chalk.yellow(_.join(unusedDependencies, '\n')));
  }
  if (!_.isEmpty(unusedDevDependencies)) {
    console.log(chalk.yellow.bold('Unused devDependencies'));
    console.log(chalk.yellow(_.join(unusedDevDependencies, '\n')));
  }
github edj-boston / simple-mesh / gulpfile.js View on Github external
'clean',
        'lint',
        'scripts',
        'cover',
        'test'
    )(done);
});


// Examine package.json for unused deps (except for frontend and gulp)
gulp.task('depcheck', g.depcheck({
    ignoreMatches : [
        'babel-preset-es2015'
    ],
    specials : [
        depcheck.special['gulp-load-plugins']
    ]
}));


// What to do when you run `$ gulp`
gulp.task('default', done => {
    g.sequence(
        [ 'david', 'depcheck' ],
        'build',
        'watch'
    )(done);
});
github thenativeweb / roboter / lib / tasks / universal / unused-dependencies / index.js View on Github external
gulp.task('_unused-dependencies', done => {
    gulpDepcheck({
      ignoreDirs: configuration.exclude,
      ignoreMatches: [ 'roboter-client', 'roboter-server' ],
      parsers: {
        '*.js': depcheck.parser.es6,
        '*.jsx': depcheck.parser.jsx
      },
      detectors: [
        depcheck.detector.requireCallExpression,
        depcheck.detector.importDeclaration
      ],
      specials: [
        depcheck.special.babel,
        depcheck.special.eslint,
        depcheck.special.mocha,
        depcheck.special.webpack
      ]
    })().
      then(done).
      catch(err => {
        if (
          err.message.includes('You have unused dependencies') ||
          err.message.includes('You have missing dependencies')
        ) {
          gutil.log(err.message);

          return done();
        }
github thenativeweb / roboter / lib / tasks / universal / unused-dependencies / index.js View on Github external
gulpDepcheck({
      ignoreDirs: configuration.exclude,
      ignoreMatches: [ 'roboter-client', 'roboter-server' ],
      parsers: {
        '*.js': depcheck.parser.es6,
        '*.jsx': depcheck.parser.jsx
      },
      detectors: [
        depcheck.detector.requireCallExpression,
        depcheck.detector.importDeclaration
      ],
      specials: [
        depcheck.special.babel,
        depcheck.special.eslint,
        depcheck.special.mocha,
        depcheck.special.webpack
      ]
    })().
      then(done).
      catch(err => {
        if (
          err.message.includes('You have unused dependencies') ||
          err.message.includes('You have missing dependencies')
        ) {
          gutil.log(err.message);

          return done();
        }

        done(err);
      });
  });
github urbanjs / urbanjs-tools / packages / urbanjs-tools / legacy / tasks / check-dependencies / index.js View on Github external
.on('data', (file) => {
        options.parsers[file.path] = [
          parser,
          depcheck.special.babel,
          depcheck.special.bin,
          depcheck.special.eslint,
          depcheck.special.webpack
        ];
      })
      .on('end', (err) => {
github urbanjs / urbanjs-tools / packages / urbanjs-tool-check-dependencies / src / tool.ts View on Github external
.on('data', (file: { path: string }) => {
          depcheckOptions.parsers[file.path] = [
            (content: string, filename: string) => {
              return babylon.parse(
                this.transpileService.transpile(content, filename),
                {sourceType: 'module'}
              );
            },
            depcheck.special.babel,
            depcheck.special.bin,
            depcheck.special.eslint,
            depcheck.special.webpack
          ];
        })
        .on('end', (err: Error) => {
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
'tsconfig-paths',
      'typescript'
    ],
    parsers: {
      '*.js': depcheck.parser.es6,
      '*.jsx': depcheck.parser.jsx,
      '*.ts': depcheck.parser.typescript,
      '*.tsx': depcheck.parser.typescript
    },
    detectors: [
      depcheck.detector.requireCallExpression,
      depcheck.detector.importDeclaration
    ],
    specials: [
      depcheck.special.babel,
      depcheck.special.bin,
      depcheck.special.eslint,
      depcheck.special.mocha,
      depcheck.special.webpack
    ]
  };

  const {
    invalidDirs,
    invalidFiles,
    dependencies,
    devDependencies
  } = await depcheck(directory, depcheckOptions);

  if (invalidFiles.length > 0) {
    throw new errors.FileParsingFailed(`Unable to parse some files: ${invalidFiles.join(', ')}`);
  }
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
'ts-node',
      'tsconfig-paths',
      'typescript'
    ],
    parsers: {
      '*.js': depcheck.parser.es6,
      '*.jsx': depcheck.parser.jsx,
      '*.ts': depcheck.parser.typescript,
      '*.tsx': depcheck.parser.typescript
    },
    detectors: [
      depcheck.detector.requireCallExpression,
      depcheck.detector.importDeclaration
    ],
    specials: [
      depcheck.special.babel,
      depcheck.special.bin,
      depcheck.special.eslint,
      depcheck.special.mocha,
      depcheck.special.webpack
    ]
  };

  const {
    invalidDirs,
    invalidFiles,
    dependencies,
    devDependencies
  } = await depcheck(directory, depcheckOptions);

  if (invalidFiles.length > 0) {
    throw new errors.FileParsingFailed(`Unable to parse some files: ${invalidFiles.join(', ')}`);
github urbanjs / urbanjs-tools / packages / urbanjs-tools / legacy / tasks / check-dependencies / index.js View on Github external
.on('data', (file) => {
        options.parsers[file.path] = [
          parser,
          depcheck.special.babel,
          depcheck.special.bin,
          depcheck.special.eslint,
          depcheck.special.webpack
        ];
      })
      .on('end', (err) => {
github dylang / npm-check / lib / in / get-unused-packages.js View on Github external
        .map((special) => depcheck.special[special])
        .filter(Boolean);

depcheck

Check dependencies in your node module

MIT
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis