grunt-import-clean
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "grunt-import-clean", | ||
"description": "identify unused imports in es6 modules", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/elnarddogg/grunt-import-clean", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -25,5 +25,4 @@ module.exports = function( grunt ) { | ||
var testAdaptor = options.test ? new TestAdaptor( __dirname ) : testAdaptor; | ||
var force = options.force !== undefined ? options.force : true; | ||
grunt.option( 'force' , options.force !== undefined ? options.force : true ); | ||
var files = data.reduce(function( prev , current ) { | ||
@@ -59,14 +58,25 @@ return prev.concat( | ||
var result = aggregate( files ); | ||
var msg; | ||
if (options.test) { | ||
testAdaptor.write( that.target , result ); | ||
util.puts( ('\ntest output written to tmp/' + that.target + '.json').yellow ); | ||
msg = '\ntest output written to tmp/' + that.target + '.json'; | ||
util.puts( msg.yellow ); | ||
} | ||
else if (result.foundFiles) { | ||
print( result.unused ); | ||
grunt.fail.warn( | ||
'found ' + result.foundImports + | ||
msg = 'found ' + result.foundImports + | ||
' unused imports in ' + result.foundFiles + | ||
' file' + (result.foundFiles > 1 ? 's' : '') + '.' | ||
); | ||
' file' + (result.foundFiles > 1 ? 's' : '') + '.'; | ||
// grunt.option( 'force' , true ) will force all subsequent tasks. | ||
// this handles the force option politely. | ||
if (force) { | ||
util.puts(( 'Warning: ' + msg ).yellow ); | ||
} | ||
else { | ||
grunt.fail.warn( msg ); | ||
} | ||
} | ||
@@ -73,0 +83,0 @@ else { |
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
26204
857