1.1.0 • Published 5 years ago
depcheck-babel-parser v1.1.0
depcheck-babel-parser
A depcheck babel parser that uses an existing babel config instead of a fixed set of plugins.
Install
# NPM
$ npm install depcheck-babel-parser
# Yarn
$ yarn add depcheck-babel-parser
Usage
Start by creating a .babelrc.json
file with your babel config, if needed.
Custom parsers are currently only supported when using depcheck
via the Node.js API. Simply add the parser to your parser config and run depcheck:
import depcheck from 'depcheck'
import babelParser from 'depcheck-babel-parser'
const options = {
parsers: {
'*.js': babelParser,
},
}
depcheck('/path/to/your/project', options, (unused) => {
console.log(unused.dependencies); // an array containing the unused dependencies
console.log(unused.devDependencies); // an array containing the unused devDependencies
console.log(unused.missing); // a lookup containing the dependencies missing in `package.json` and where they are used
console.log(unused.using); // a lookup indicating each dependency is used by which files
console.log(unused.invalidFiles); // files that cannot access or parse
console.log(unused.invalidDirs); // directories that cannot access
})
License
Unless stated otherwise all works are:
Copyright © Sebastian Landwehr info@dword-design.de
and licensed under:
1.1.0
5 years ago