Socket
Book a DemoInstallSign in
Socket

js-unused-exports

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-unused-exports

Tool for identifying and reporting unused exports found in ECMAScript/JavaScript code

1.2.1
latest
Source
npmnpm
Version published
Weekly downloads
11
Maintainers
1
Weekly downloads
 
Created
Source

Unused Exports

Tool for identifying and reporting unused exports found in ECMAScript/JavaScript code.

You may think of it as ESLint no-unused-vars rule, but for the whole project scope.

Tool uses Babel parser to parse source code. You can provide custom parser options using config file.

Instalation

npm install -g js-unused-exports

Usage

Usage: js-unused-exports [options]
 E.g.: js-unused-exports --config "unused-exports-config.json"

Options:
  -v, --version        output the version number
  -c, --config [path]  path to the JSON config file
  -o --out-dir [path]  path to print scan results as JSON
  -f, --fix            automatically remove "export" directive where possible
  -h, --help           output usage information

Screenshot

Configuration

{
  // Root project directory or CWD (default)
  projectRoot: '',

  // Source paths relative to project root
  sourcePaths: ['src/**/*.js'],

  // Patterns for files that should be ignored
  ignorePaths: [],

  // Test file patterns
  testPaths: [
    'src/**/*.spec.js'
  ],

  // Import patterns to ignore
  ignoreImportPatterns: [ '(png|gif|jpg|jpeg|css|scss)$' ],

  // Export patterns to ignore
  ignoreExportPatterns: [ '(stories)' ],

  // If you use alias in you codebase you can specify them here, e.g.:
  aliases: {
    components: 'src/components'
  },

  // @babel/parser options for parsing source code
  // https://babeljs.io/docs/en/babel-parser
  parserOptions: {
    sourceType: 'module',
    plugins: [
      'objectRestSpread',
      'jsx',
      'flow',
      'classProperties',
      'decorators-legacy',
      'exportDefaultFrom'
    ]
  }
}

Keywords

linting

FAQs

Package last updated on 28 May 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.