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

babel-plugin-danger-remove-unused-import

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-danger-remove-unused-import - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

lib/utils/matchRule.js

11

lib/index.js

@@ -10,2 +10,3 @@ 'use strict';

var getSpecImport = require('./utils/getSpecImport');
var matchRule = require('./utils/matchRule');

@@ -33,3 +34,4 @@ var _require = require('../package.json'),

var locals = getSpecImport(path, { withPath: true });
data.opts.ignores = [];
var locals = getSpecImport(path, { withPath: true, ignore: data.opts.ignore });
if (locals) {

@@ -85,2 +87,3 @@ locals.forEach(function (pathData, index, all) {

var allNames = Object.keys(this.runtimeData);
warn(allNames);
allNames.forEach(function (name) {

@@ -99,5 +102,7 @@ var _runtimeData$name = _this2.runtimeData[name],

})) {
parent.remove();
parent.__removed = true;
!parent.__removed && parent.remove();
} else {
data.path.remove();
data.path.__removed = true;
!data.path.__removed && data.path.remove();
}

@@ -104,0 +109,0 @@ });

@@ -12,3 +12,3 @@ 'use strict';

*/
var match = require('../utils/matchRule');
var t = require('babel-core').types;

@@ -55,3 +55,5 @@

var _opts$withPath = opts.withPath,
withPath = _opts$withPath === undefined ? false : _opts$withPath;
withPath = _opts$withPath === undefined ? false : _opts$withPath,
_opts$ignore = opts.ignore,
ignore = _opts$ignore === undefined ? false : _opts$ignore;

@@ -62,3 +64,3 @@ var source = path.get('source');

if (t.isImportDeclaration(path)) {
if (t.isStringLiteral(source)) {
if (t.isStringLiteral(source) && (!ignore || !match(ignore, source.node.value))) {
if (specifiers && specifiers.length > 0) {

@@ -65,0 +67,0 @@ return getSpecifierIdentifiers(specifiers, withPath);

{
"name": "babel-plugin-danger-remove-unused-import",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

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