Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unused-es6

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unused-es6

Check for unused ES6 module imports.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

unused

Build Status

Report unused ES6 imports in JS / JSX files. Supports output of vim commands that highlight all unused imports. unused exits with code 1 when unused imports were found.

Sample output:

$ cat test.js
import foo from 'bar';
import { foo as fooz } from 'bar';

//fooz.execute(foo);
//foo.fooz();
fooz.foo();
$ unused test.js
foo      (test.js 1:7)
  total 1

There is also a raw mode which outputs json:

$ unused --raw=true test.js
[ { start: { line: 1, column: 7 },
    end: { line: 1, column: 10 },
    name: 'foo' } ]

Vim output mode:

$ unused -v true test.js
:call matchadd('Error', '\%1l\%<11v.\%>8v')

Usage

Install via npm:

npm install -g unused-es6

Add the following to your ~/.vimrc file:

"" Highlight unused imports, first saves, clears previous matches
nnoremap <leader>ji :w<CR>:call clearmatches()<CR>:let cmd = system('unused -v true ' . expand('%'))<CR>:exec cmd<CR>

Press <leader>ji to highlight all unused imports in your current file.

demo

Keywords

FAQs

Package last updated on 07 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc