babel-plugin-danger-remove-unused-import
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8559
8
222
0