shrimpit
v2.0.0
Published
A CLI analysis tool for checking unused JavaScript, JSX & Vue templates ES6 exports in your project.
Downloads
20
Maintainers
Readme
Shrimpit :fried_shrimp:
Shrimpit is a small CLI analysis tool for checking unused JavaScript, JSX & Vue templates ES6 exports in your project.
Install
npm
npm i -g shrimpit
yarn
yarn global add shrimpit
Usage
shrimpit path/to/your/files /another/path
Globbing patterns are also supported:
shrimpit test/**/*.js
Adding the --tree
flag will output the complete files tree with all the imports and the exports per file:
shrimpit --tree path/to/your/files
Please note that default unnamed exports are rendered as default (unnamed)
:
shrimpit test --tree
Shrimpit!
> Files tree
{ test:
{ core:
{ a:
{ 'a.js':
{ imports:
[ { location: 'test/core/b/b.js',
name: 'test',
unnamedDefault: true },
{ location: 'test/core/b/b.js',
name: 'a',
unnamedDefault: false },
{ location: 'test/core/c/c.js',
name: 'User',
unnamedDefault: true } ],
exports:
[ { location: 'test/core/a/a.js',
name: 'a',
unnamedDefault: false },
{ location: 'test/core/a/a.js',
name: 'c',
unnamedDefault: false },
{ location: 'test/core/a/a.js', name: 'd', unnamedDefault: true } ] } },
b:
{ 'b.js':
{ imports:
[ { location: 'test/core/c/c.js',
name: 'Cat',
unnamedDefault: false },
{ location: 'test/core/d/d.js',
name: 'unamedFunction',
unnamedDefault: true },
{ location: 'test/core/a/a.js',
name: 'a',
unnamedDefault: false },
{ location: 'test/core/a/a.js',
name: 'c',
unnamedDefault: false },
{ location: 'test/core/a/a.js', name: 'd', unnamedDefault: true } ],
exports:
[ { location: 'test/core/b/b.js',
name: 'a',
unnamedDefault: false },
{ location: 'test/core/b/b.js',
name: 'b',
unnamedDefault: false },
{ location: 'test/core/b/b.js',
name: 'default (unnamed)',
unnamedDefault: true } ] } },
c:
{ 'c.js':
{ imports:
[ { location: 'test/core/a/a.js',
name: 'a',
unnamedDefault: false },
{ location: 'test/core/a/a.js',
name: 'c',
unnamedDefault: false },
{ location: 'test/core/a/a.js',
name: 'd',
unnamedDefault: false },
{ location: 'test/core/b/b.js',
name: 'b',
unnamedDefault: false } ],
exports:
[ { location: 'test/core/c/c.js',
name: 'Cat',
unnamedDefault: false },
{ location: 'test/core/c/c.js',
name: 'User',
unnamedDefault: true } ] } },
d:
{ 'd.js':
{ imports: [],
exports:
[ { location: 'test/core/d/d.js',
name: 'test/core/d',
unnamedDefault: true } ] } } } } }
> Unused exports
All Clear Ahead, Captain.
Flow & Vue
Shrimpit supports Flow annotations and Vue templates out of the box!
TypeScript (experimental)
Since Babel 7, the TypeScript AST can directly be parsed. You can use the --typescript
flag to enable it:
shrimpit --tree --typescript path/to/your/files
Please note that the Flow and TypeScript parsers are mutually exclusive.
Linting
The code quality is checked by the JavaScript Standard Style.
License
Released under the MIT license by Davy Duperron.