Skip to content

Commit

Permalink
Add jshint
Browse files Browse the repository at this point in the history
  • Loading branch information
hdgarrood committed Nov 30, 2015
1 parent e3412ae commit bc17e6f
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 36 deletions.
26 changes: 26 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"bitwise": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"funcscope": true,
"futurehostile": true,
"globalstrict": true,
"latedef": true,
"noarg": true,
"nocomma": true,
"nonew": true,
"notypeof": true,
"singleGroups": true,
"undef": true,
"unused": true,
"eqnull": true,
"globals": {
"exports": true,
"process": true,
"console": false,
"require": false,
"__dirname": false,
"__filename": false
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"pulp": "output/pulp.js"
},
"scripts": {
"build": "pulp build --to output/pulp.js",
"build": "jshint src && pulp build --to output/pulp.js",
"test": "mocha test-js --compilers js:babel/register"
},
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions src/Main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// module Main

"use strict";

exports.logStack = function logStack(err) {
return function() {
console.log(err.stack);
};
};
5 changes: 2 additions & 3 deletions src/Pulp/Args/Help.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// module Pulp.Args.Help

"use strict";

exports.pad = function pad(n) {
return new Array(n + 1).join(" ");
}
};

exports.wrap = function wrap(s) {
return function(indent) {
Expand All @@ -13,4 +12,4 @@ exports.wrap = function wrap(s) {
return cols ? require("wordwrap")(indent, cols)(s).slice(indent) : s;
};
};
}
};
4 changes: 1 addition & 3 deletions src/Pulp/Bower.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

// module Pulp.Bower

"use strict";

exports.requireResolve = function requireResolve(path) {
return function() {
return require.resolve(path);
}
};
};
4 changes: 2 additions & 2 deletions src/Pulp/Browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"use strict";

exports["browserifyBundle'"] = function browserifyBundle$prime(opts, callback) {
var stringStream = require("string-stream");
var StringStream = require("string-stream");
var browserify = require("browserify");

var b = browserify({
basedir: opts.basedir,
entries: new stringStream(opts.src)
entries: new StringStream(opts.src)
});
if (opts.transform) b.transform(opts.transform);
b.bundle().pipe(opts.out).on("close", callback);
Expand Down
6 changes: 2 additions & 4 deletions src/Pulp/Exec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

// module Pulp.Exec

"use strict";

exports["concatStream'"] = function concatStream$prime(stream, callback) {
Expand All @@ -12,8 +10,8 @@ exports["concatStream'"] = function concatStream$prime(stream, callback) {

var onError = function(err) {
callback(err, null);
}
};

stream.on('error', onError);
stream.pipe(concat(onSuccess));
}
};
2 changes: 1 addition & 1 deletion src/Pulp/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

exports["glob'"] = function glob$prime(pat, callback) {
require("glob")(pat, {}, callback);
}
};
4 changes: 1 addition & 3 deletions src/Pulp/Init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

// module Pulp.Init

"use strict";

exports.bowerFile = function bowerFile(name) {
Expand All @@ -18,4 +16,4 @@ exports.bowerFile = function bowerFile(name) {
"purescript-console": "^0.1.0"
}
}, null, 2) + "\n";
}
};
4 changes: 2 additions & 2 deletions src/Pulp/Server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// module Pulp.Server
"use strict";

exports.__dirname = __dirname;

Expand Down Expand Up @@ -35,4 +35,4 @@ exports.makeDevServer = function makeDevServer(config) {

exports["listen'"] = function listen$prime(server, host, port, callback) {
server.listen(port, host, callback);
}
};
14 changes: 7 additions & 7 deletions src/Pulp/System/Ansi.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@

exports.ansi = function ansi(stream) {
return require("ansi")(stream);
}
};

exports.castToNodeStream = function castToNodeStream(stream) {
return stream;
}
};

exports["col'"] = function col$prime(stream, c, callback) {
stream[c](); callback();
}
};

exports["bgCol'"] = function bgCol$prime(stream, c, callback) {
stream.bg[c](); callback();
}
};

exports["bold'"] = function bold$prime(stream, callback) {
stream.bold(); callback();
}
};

exports["underline'"] = function underline$prime(stream, callback) {
stream.underline(); callback();
}
};

exports["reset'"] = function reset$prime(stream, callback) {
stream.reset(); callback();
}
};
10 changes: 5 additions & 5 deletions src/Pulp/System/ChildProcess.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

// module Pulp.System.ChildProcess
"use strict";

exports["spawn'"] = function spawn$prime(cmd, args, env, stdio) {
return function() {
var opts = { env: env, stdio: stdio };
return require("child_process").spawn(cmd, args, opts);
}
}
};
};

exports["wait'"] = function wait$prime(child, callback) {
child.on("exit", function(r) {
callback(null, r)
callback(null, r);
});
}
};
2 changes: 1 addition & 1 deletion src/Pulp/System/FFI.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports["runNode'"] = function runNode$prime(error, success, fn) {
if (err) { error(err)(); } else { success(val)(); }
});
};
}
};

exports.unsafeInspect = function unsafeInspect(obj) {
return require('util').inspect(obj);
Expand Down
6 changes: 3 additions & 3 deletions src/Pulp/System/Process.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.exit = function exit(code) {

exports.getEnvironment = function getEnvironment() {
return require('util')._extend({}, process.env);
}
};

exports.getPlatform = function getPlatform() {
return process.platform;
Expand All @@ -25,12 +25,12 @@ exports.getPlatform = function getPlatform() {
exports.chdir = function chdir(dir) {
return function() {
process.chdir(dir);
}
};
};

exports.cwd = function cwd() {
return process.cwd();
}
};

exports.getEnvNullable = function getEnvNullable(envvar) {
return function() {
Expand Down
2 changes: 1 addition & 1 deletion src/Pulp/System/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

exports.writeToNodeStream = function writeToNodeStream(stream, data, callback) {
stream.write(data, callback);
}
};

0 comments on commit bc17e6f

Please sign in to comment.