Socket
Socket
Sign inDemoInstall

gulp-bootlint

Package Overview
Dependencies
4
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

96

index.js

@@ -20,61 +20,61 @@ /*

function gulpBootlint(options) {
options = options || {
disabledIds: []
};
var hasError = false;
options = options || {
disabledIds: []
};
var hasError = false;
// creating a stream through which each file will pass
var stream = through.obj(function (file, enc, cb) {
var errorCount = 0;
// creating a stream through which each file will pass
var stream = through.obj(function (file, enc, cb) {
var errorCount = 0;
if (file.isNull()) {
return cb(null, file);
}
if (file.isNull()) {
return cb(null, file);
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
return cb();
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
return cb();
}
var reporter = function (lint) {
var lintId = (lint.id[0] === 'E') ? chalk.bgRed.white(lint.id) : chalk.bgYellow.white(lint.id),
errorElementsAvailable = false;
var reporter = function (lint) {
var lintId = (lint.id[0] === 'E') ? chalk.bgRed.white(lint.id) : chalk.bgYellow.white(lint.id),
errorElementsAvailable = false;
if (lint.elements) {
lint.elements.each(function (_, element) {
var errorLocation = element.startLocation;
gutil.log(file.path + ":" + (errorLocation.line + 1) + ":" + (errorLocation.column + 1), lintId, lint.message);
errorElementsAvailable = true;
});
}
if (!errorElementsAvailable) {
gutil.log(file.path + ":", lintId, lint.message);
}
if (lint.elements) {
lint.elements.each(function (_, element) {
var errorLocation = element.startLocation;
gutil.log(file.path + ":" + (errorLocation.line + 1) + ":" + (errorLocation.column + 1), lintId, lint.message);
errorElementsAvailable = true;
});
}
if (!errorElementsAvailable) {
gutil.log(file.path + ":", lintId, lint.message);
}
++errorCount;
hasError = true;
file.bootlint.success = false;
file.bootlint.issues.push(lint);
};
++errorCount;
hasError = true;
file.bootlint.success = false;
file.bootlint.issues.push(lint);
};
gutil.log(chalk.gray('Linting file ' + file.path));
file.bootlint = { success: true, issues: [] };
bootlint.lintHtml(file.contents.toString(), reporter, options.disabledIds);
gutil.log(chalk.gray('Linting file ' + file.path));
file.bootlint = { success: true, issues: [] };
bootlint.lintHtml(file.contents.toString(), reporter, options.disabledIds);
if(errorCount > 0) {
gutil.log(chalk.red(errorCount + ' lint error(s) found in file ' + file.path));
} else {
gutil.log(chalk.green(file.path + ' is lint free!'));
}
if(errorCount > 0) {
gutil.log(chalk.red(errorCount + ' lint error(s) found in file ' + file.path));
} else {
gutil.log(chalk.green(file.path + ' is lint free!'));
}
return cb(null, file);
}, function(cb) {
if(hasError) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Lint errors found!'));
}
return cb(null, file);
}, function(cb) {
if(hasError) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Lint errors found!'));
}
return cb();
});
return cb();
});
return stream;
return stream;
};

@@ -81,0 +81,0 @@

{
"name": "gulp-bootlint",
"version": "0.2.0",
"version": "0.2.1",
"description": "A gulp wrapper for Bootlint, the HTML linter for Bootstrap projects",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,3 +21,3 @@ # gulp-bootlint

gulp.task('default', function() {
gulp.src('./index.html')
return gulp.src('./index.html')
.pipe(bootlint());

@@ -43,3 +43,3 @@ });

gulp.task('default', function() {
gulp.src('./index.html')
return gulp.src('./index.html')
.pipe(bootlint({

@@ -46,0 +46,0 @@ disabledIds: ['W009', 'E007']

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc