How to use the depcheck.parser 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 ckeditor / ckeditor5-dev / packages / ckeditor5-dev-tests / bin / check-dependencies.js View on Github external
const fs = require( 'fs' );
const path = require( 'path' );
const glob = require( 'glob' );
const depCheck = require( 'depcheck' );
const chalk = require( 'chalk' );

const cwd = process.cwd();
const packageJson = require( path.join( cwd, 'package.json' ) );
const nonExistingCSSFiles = [];

const depCheckOptions = {
	// We need to add all values manually because if we modify it, the rest is being lost.
	parsers: {
		'*.css': parsePostCSS,
		'*.js': depCheck.parser.es6,
		'*.jsx': depCheck.parser.jsx,
		'*.ts': depCheck.parser.typescript,
		'*.vue': depCheck.parser.vue
	},
	ignoreDirs: [ 'docs', 'build' ],
	ignoreMatches: [ 'eslint', 'eslint-plugin-ckeditor5-rules', 'husky', 'lint-staged', 'webpack-cli' ]
};

if ( Array.isArray( packageJson.depcheckIgnore ) ) {
	depCheckOptions.ignoreMatches.push( ...packageJson.depcheckIgnore );
}

console.log( 'Checking dependencies...' );

depCheck( cwd, depCheckOptions )
	.then( unused => {
github ckeditor / ckeditor5-dev / packages / ckeditor5-dev-tests / bin / check-dependencies.js View on Github external
const path = require( 'path' );
const glob = require( 'glob' );
const depCheck = require( 'depcheck' );
const chalk = require( 'chalk' );

const cwd = process.cwd();
const packageJson = require( path.join( cwd, 'package.json' ) );
const nonExistingCSSFiles = [];

const depCheckOptions = {
	// We need to add all values manually because if we modify it, the rest is being lost.
	parsers: {
		'*.css': parsePostCSS,
		'*.js': depCheck.parser.es6,
		'*.jsx': depCheck.parser.jsx,
		'*.ts': depCheck.parser.typescript,
		'*.vue': depCheck.parser.vue
	},
	ignoreDirs: [ 'docs', 'build' ],
	ignoreMatches: [ 'eslint', 'eslint-plugin-ckeditor5-rules', 'husky', 'lint-staged', 'webpack-cli' ]
};

if ( Array.isArray( packageJson.depcheckIgnore ) ) {
	depCheckOptions.ignoreMatches.push( ...packageJson.depcheckIgnore );
}

console.log( 'Checking dependencies...' );

depCheck( cwd, depCheckOptions )
	.then( unused => {
		const missingPackages = groupMissingPackages( unused.missing, packageJson.name );
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') ||
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 (
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
const depcheckOptions = {
    ignoreDirs: [ 'node_modules' ],
    ignoreMatches: [
      '@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 {
github thenativeweb / roboter / lib / steps / dependencies / checkForUnusedDependencies.js View on Github external
throw new Error('Directory is missing.');
  }

  const depcheckOptions = {
    ignoreDirs: [ 'node_modules' ],
    ignoreMatches: [
      '@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
    ]
  };

depcheck

Check dependencies in your node module

MIT
Latest version published 1 year ago

Package Health Score

81 / 100
Full package analysis