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

gulp-eslint

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-eslint - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

49

index.js
'use strict';
var map = require('map-stream'),
var through = require('through2'),
BufferStreams = require('bufferstreams'),
PluginError = require('gulp-util').PluginError,

@@ -28,6 +29,6 @@ eslint = require('eslint').linter,

return map(function (file, output) {
return through.obj(function(file, enc, cb) {
// remove base path from file path before calling isPathIgnored
if (util.isPathIgnored(file, linter.options) || file.isNull()) {
output(null, file);
cb(null, file);

@@ -37,11 +38,11 @@ } else if (file.isStream()) {

// replace content stream with new readable content stream
file.contents = file.contents.pipe(util.wait(function (contents) {
file.eslint = verify(file.path, contents);
output(null, file);
file.contents = file.contents.pipe(new BufferStreams(function(none, buf, done) {
file.eslint = verify(file.path, String(buf));
cb(null, file);
done(null, buf);
}));
} else {
file.eslint = verify(file.path, file.contents.toString('utf8'));
output(null, file);
file.eslint = verify(file.path, file.contents.toString());
cb(null, file);
}

@@ -55,9 +56,9 @@ });

*/
gulpEslint.failOnError = function () {
gulpEslint.failOnError = function() {
return map(function (file, output) {
return through.obj(function(file, enc, output) {
var messages = file.eslint && file.eslint.messages || [],
error = null;
messages.some(function (message) {
messages.some(function(message) {
if (util.isErrorMessage(message)) {

@@ -84,8 +85,8 @@ error = new PluginError(

*/
gulpEslint.failAfterError = function () {
gulpEslint.failAfterError = function() {
var errorCount = 0;
return map(function (file, output) {
return through.obj(function(file, enc, cb) {
var messages = file.eslint && file.eslint.messages || [];
messages.forEach(function (message) {
messages.forEach(function(message) {
if (util.isErrorMessage(message)) {

@@ -95,5 +96,5 @@ errorCount++;

});
output(null, file);
cb(null, file);
}).once('end', function () {
}).once('end', function() {
// Only format results if files has been lint'd

@@ -115,3 +116,3 @@ if (errorCount > 0) {

*/
gulpEslint.format = function (formatter, writable) {
gulpEslint.format = function(formatter, writable) {
var results = [];

@@ -121,9 +122,9 @@ formatter = util.resolveFormatter(formatter);

return map(function (file, output) {
return through.obj(function(file, enc, cb) {
if (file.eslint) {
results.push(file.eslint);
}
output(null, file);
cb(null, file);
}).once('end', function () {
}).once('finish', function() {
// Only format results if files has been lint'd

@@ -141,7 +142,7 @@ if (results.length) {

*/
gulpEslint.formatEach = function (formatter, writable) {
gulpEslint.formatEach = function(formatter, writable) {
formatter = util.resolveFormatter(formatter);
writable = util.resolveWritable(writable);
return map(function (file, output) {
return through.obj(function(file, enc, cb) {
var error = null;

@@ -155,3 +156,3 @@ if (file.eslint) {

}
output(error, file);
cb(error, file);
});

@@ -158,0 +159,0 @@ };

{
"name": "gulp-eslint",
"version": "0.3.0",
"version": "0.4.0",
"description": "A gulp plugin for processing files with eslint",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/adametry/gulp-eslint"
},
"homepage": "http://github.com/adametry/gulp-eslint",
"bugs": "https://github.com/adametry/gulp-eslint/issues",
"repository": "adametry/gulp-eslint",
"files": [
"index.js",
"util.js"
],
"directories": {

@@ -17,2 +15,3 @@ "example": "example",

"scripts": {
"pretest": "jscs *.js test/*.js && eslint *.js test/*.js",
"test": "mocha",

@@ -39,22 +38,32 @@ "gulp": "gulp",

],
"engines": {
"node": ">=0.9"
},
"files": [
"index.js",
"util.js"
"author": "Adametry",
"contribtutor": "Shinnosuke Watanabe <snnskwtnb@gmail.com> (https://github.com/shinnn)",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/adametry/gulp-eslint/blob/master/LICENSE"
}
],
"author": "Adametry",
"license": "MIT",
"dependencies": {
"eslint": "^0.13.0",
"bufferstreams": "0.0.2",
"eslint": "^0.14.0",
"gulp-util": "^3.0.1",
"map-stream": "^0.1.0",
"through": "^2.3.4"
"through2": "^0.6.3"
},
"devDependencies": {
"gulp": "*",
"jscs": "^1.11.0",
"mocha": "*",
"should": "^4.0.4"
"should": "^4.6.5",
"through": "^2.3.6"
},
"jscsConfig": {
"preset": "google",
"validateIndentation": "\t",
"disallowMultipleVarDecl": null,
"maximumLineLength": {
"value": 98,
"allowComments": true
}
}
}

@@ -1,4 +0,5 @@

# gulp-eslint [![Build Status](https://travis-ci.org/adametry/gulp-eslint.png)](https://travis-ci.org/adametry/gulp-eslint)
> A [Gulp](https://github.com/wearefractal/gulp) plugin for [eslint](http://eslint.org/).
# gulp-eslint [![Build Status](https://travis-ci.org/adametry/gulp-eslint.svg)](https://travis-ci.org/adametry/gulp-eslint)
> A [gulp](http://gulpjs.com/) plugin for [ESLint](http://eslint.org/).
## Usage

@@ -5,0 +6,0 @@

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

gutil = require('gulp-util'),
through = require('through'),
CLIEngine = require('eslint').CLIEngine,

@@ -25,19 +24,5 @@ IgnoredPaths = require('eslint/lib/ignored-paths'),

/**
* Variation on event-stream's "wait" method that returns a "reset" stream.
*/
exports.wait = function wait(cb) {
var content = new Buffer([]);
return through(function bufferData(data) {
content = Buffer.concat([content, data]);
this.queue(data);
}, function releaseData() {
cb(content.toString());
this.emit('end');
});
};
/**
* Mimic the CLIEngine.isPathIgnored, but resolve .eslintignore based on file's directory rather than process.cwd()
*/
exports.isPathIgnored = function (file, options) {
exports.isPathIgnored = function(file, options) {
var filePath;

@@ -61,6 +46,6 @@ if (!options.ignore) {

*/
exports.loadPlugins = function (pluginNames) {
exports.loadPlugins = function(pluginNames) {
// WARNING: HACK AHEAD!
// We can either process text/file, or create a new CLIEngine instance to make use of the internal plugin cache.
// Creating a new CLIEngine is probably the cheapest approach.
// Creating a new CLIEngine is probably the cheapest approach.
return pluginNames && new CLIEngine({

@@ -130,3 +115,3 @@ plugins: pluginNames

*/
exports.isErrorMessage = function (message) {
exports.isErrorMessage = function(message) {
var level = message.fatal ? 2 : message.severity;

@@ -143,3 +128,3 @@ if (Array.isArray(level)) {

*/
exports.resolveFormatter = function (formatter) {
exports.resolveFormatter = function(formatter) {
if (!formatter) {

@@ -176,3 +161,3 @@ // default formatter

*/
exports.resolveWritable = function (writable) {
exports.resolveWritable = function(writable) {
if (!writable) {

@@ -189,3 +174,3 @@ writable = gutil.log;

*/
exports.writeResults = function (results, formatter, writable) {
exports.writeResults = function(results, formatter, writable) {
var config;

@@ -196,3 +181,3 @@ if (!results) {

// get the first result config
results.some(function (result) {
results.some(function(result) {
config = result && result.config;

@@ -199,0 +184,0 @@ return config;

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