How to use the depcheck.detector 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 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);
github urbanjs / urbanjs-tools / packages / urbanjs-tool-check-dependencies / src / tool.ts View on Github external
return new Promise((resolve, reject) => {
      const depcheckOptions = {
        withoutDev: false,
        ignoreBinPackage: false,
        ignoreMatches: [],
        ignoreDirs: [],
        detectors: [
          depcheck.detector.requireCallExpression,
          depcheck.detector.importDeclaration
        ],
        specials: [],
        parsers: {}
      };

      gulp.src(config.files)
        .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,
github urbanjs / urbanjs-tools / packages / urbanjs-tool-check-dependencies / src / tool.ts View on Github external
return new Promise((resolve, reject) => {
      const depcheckOptions = {
        withoutDev: false,
        ignoreBinPackage: false,
        ignoreMatches: [],
        ignoreDirs: [],
        detectors: [
          depcheck.detector.requireCallExpression,
          depcheck.detector.importDeclaration
        ],
        specials: [],
        parsers: {}
      };

      gulp.src(config.files)
        .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,
github urbanjs / urbanjs-tools / packages / urbanjs-tools / legacy / tasks / check-dependencies / index.js View on Github external
function checkMissingPackages(packageFile, files) {
  const depcheck = require('depcheck');
  const parser = require('./depcheck-parser');
  const options = {
    withoutDev: false,
    ignoreBinPackage: false,
    ignoreMatches: [],
    ignoreDirs: [],
    detectors: [
      depcheck.detector.requireCallExpression,
      depcheck.detector.importDeclaration
    ],
    specials: [],
    parsers: {}
  };

  return new Promise((resolve, reject) => {
    gulpSrc(files)
      .on('data', (file) => {
        options.parsers[file.path] = [
          parser,
          depcheck.special.babel,
          depcheck.special.bin,
          depcheck.special.eslint,
          depcheck.special.webpack
        ];
      })
github urbanjs / urbanjs-tools / packages / urbanjs-tools / legacy / tasks / check-dependencies / index.js View on Github external
function checkMissingPackages(packageFile, files) {
  const depcheck = require('depcheck');
  const parser = require('./depcheck-parser');
  const options = {
    withoutDev: false,
    ignoreBinPackage: false,
    ignoreMatches: [],
    ignoreDirs: [],
    detectors: [
      depcheck.detector.requireCallExpression,
      depcheck.detector.importDeclaration
    ],
    specials: [],
    parsers: {}
  };

  return new Promise((resolve, reject) => {
    gulpSrc(files)
      .on('data', (file) => {
        options.parsers[file.path] = [
          parser,
          depcheck.special.babel,
          depcheck.special.bin,
          depcheck.special.eslint,
          depcheck.special.webpack
        ];
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
'@types/*',
      'react',
      'roboter',
      'semantic-release-configuration',
      '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
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
'react',
      'roboter',
      'semantic-release-configuration',
      '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);
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);

depcheck

Check dependencies in your node module

MIT
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis