Skip to content

Commit 79bf3d2

Browse files
committed
style: enforcing JSHint
Added .jshintrc and fixed index.js to pass. Test does not pass, because functions are being defined within a loop. Along with assignment in place of condition there were many basic syntax errors (lax commas, no space between keyword and parens, weak equalities, etc). There are even more issues with tests: repeated code, hardcoded paths. I may just toss it and start again.
1 parent 76e0375 commit 79bf3d2

File tree

3 files changed

+215
-183
lines changed

3 files changed

+215
-183
lines changed

.jshintrc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"node": true,
3+
"esnext": true,
4+
"bitwise": true,
5+
"camelcase": true,
6+
"curly": true,
7+
"eqeqeq": true,
8+
"immed": true,
9+
"indent": 4,
10+
"latedef": true,
11+
"newcap": true,
12+
"noarg": true,
13+
"quotmark": "double",
14+
"regexp": true,
15+
"undef": true,
16+
"unused": true,
17+
"strict": true,
18+
"trailing": true,
19+
"smarttabs": true,
20+
"white": true,
21+
"boss": true,
22+
"laxcomma": false
23+
}

index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ var cp = require("child_process"),
44
Stream = require("stream"),
55
gUtil = require("gulp-util");
66

7-
var PLUGIN_NAME = 'gulp-spawn';
7+
var PLUGIN_NAME = "gulp-spawn";
88

99
function gulpSpawn(options) {
10+
"use strict";
1011

1112
var stream = new Stream.PassThrough({objectMode: true});
1213

@@ -16,9 +17,9 @@ function gulpSpawn(options) {
1617
"command (\"cmd\") argument required");
1718
}
1819

19-
stream._transform = function(file, unused, cb) {
20+
stream._transform = function (file, unused, cb) {
2021

21-
if(file.isNull()) {
22+
if (file.isNull()) {
2223
stream.push(file);
2324
return cb();
2425
}
@@ -40,17 +41,17 @@ function gulpSpawn(options) {
4041
var errBuffer = new Buffer(0);
4142
program.stderr.on("readable", function () {
4243
var chunk;
43-
while(chunk = program.stderr.read()) {
44+
while (chunk = program.stderr.read()) {
4445
errBuffer = Buffer.concat([
4546
errBuffer,
4647
chunk
4748
], errBuffer.length + chunk.length);
4849
}
4950
});
5051
program.stderr.on("end", function () {
51-
if(errBuffer.length) {
52-
stream.emit('error', new gUtil.PluginError(PLUGIN_NAME,
53-
errBuffer.toString('utf-8')));
52+
if (errBuffer.length) {
53+
stream.emit("error", new gUtil.PluginError(PLUGIN_NAME,
54+
errBuffer.toString("utf-8")));
5455
}
5556
});
5657

@@ -63,7 +64,7 @@ function gulpSpawn(options) {
6364
// when program receives data add it to buffer
6465
program.stdout.on("readable", function () {
6566
var chunk;
66-
while(chunk = program.stdout.read()) {
67+
while (chunk = program.stdout.read()) {
6768
newBuffer = Buffer.concat([
6869
newBuffer,
6970
chunk

0 commit comments

Comments
 (0)