Skip to content

Commit e6963a3

Browse files
committed
jshint warnings
1 parent 6b6263b commit e6963a3

File tree

7 files changed

+28
-35
lines changed

7 files changed

+28
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
*.iml
33
.idea
44
.DS_Store
5+
*.log

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ gulp.task('verify-solutions', function() {
2323
{cwd: __dirname + '/tests'}))
2424

2525
.on('error', function (err) {
26+
console.error(err)
2627
process.exit(-1)
2728
})
2829
})

nodebot-workshop.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env node
22

33
const workshop = require('workshopper-adventure')({
4-
appDir: __dirname,
5-
languages: ['en', 'ja'],
6-
menu: {fg: 'black', bg: /^win/.test(process.platform) ? 'yellow' : 220},
7-
header: require('workshopper-adventure/default/header'),
8-
footer: require('workshopper-adventure/default/footer')
4+
appDir : __dirname
5+
, languages : ['en', 'ja']
6+
, menu : {fg: 'black', bg: /^win/.test(process.platform) ? 'yellow' : 220}
7+
, header : require('workshopper-adventure/default/header')
8+
, footer : require('workshopper-adventure/default/footer')
99
})
1010

1111
workshop.addAll(require('./exercises/menu.json'))

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "nodebot-workshop.js",
66
"scripts": {
77
"start": "./nodebot-workshop.js",
8-
"test": "gulp"
8+
"test": "gulp",
9+
"lint": "jshint exercises tests stubs *.js"
910
},
1011
"bin": {
1112
"nodebot-workshop": "./nodebot-workshop.js"
@@ -51,6 +52,10 @@
5152
"gulp-jshint": "^2.0.0",
5253
"gulp-shell": "^0.5.1",
5354
"jshint": "^2.8.0",
54-
"jshint-stylish": "^2.1.0"
55-
}
55+
"jshint-stylish": "^2.1.0",
56+
"pre-commit": "^1.1.2"
57+
},
58+
"pre-commit": [
59+
"lint", "test"
60+
]
5661
}

stubs/io-stub.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
var sinon = require('sinon'),
2-
EventEmitter = require('events').EventEmitter,
32
util = require('util'),
43
IOBoard = require('ioboard');
54

65
// an IO plugin for Johnny-Five that looks like an Arduino UNO
76
// https://github.com/rwaldron/johnny-five/wiki/IO-Plugins
8-
IO = function(path, callback) {
7+
var IO = function(path, callback) {
98
IOBoard.call(this, {quiet: true});
109

1110
// pretend we've connected to firmata
1211
setTimeout(function() {
13-
this.emit("connected");
12+
this.emit('connected');
1413

1514
// would now query the board's capabilities
1615
setTimeout(function() {
@@ -51,7 +50,7 @@ IO = function(path, callback) {
5150
});
5251
}
5352

54-
this.emit("ready");
53+
this.emit('ready');
5554

5655
callback();
5756
}.bind(this), 200);
@@ -62,7 +61,7 @@ util.inherits(IO, IOBoard);
6261
module.exports = {
6362
Board: function(port, callback) {
6463
if(module.exports.singleton) {
65-
throw new Error("Board already created");
64+
throw new Error('Board already created');
6665
}
6766

6867
var singleton = new IO(port, callback);

stubs/serialport-stub.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
var sinon = require('sinon');
22

3-
SerialPort = function() {
3+
var SerialPort = function() {
44

55
}
66

7-
SerialPort.list = sinon.stub();
7+
SerialPort.list = sinon.stub()
88
SerialPort.list.callsArgWithAsync(0, null, [{
99
// has to match the regex /usb|acm|^com/i
10-
comName: "/dev/cu.usbserial-FAKEID"
11-
}]);
10+
comName: '/dev/cu.usbserial-FAKEID'
11+
}])
1212

13-
module.exports = sinon.spy(SerialPort);
13+
module.exports = sinon.spy(SerialPort)

tests/verify-solutions.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,13 @@ const workshopper = require('workshopper-adventure')
2020
, path = require('path')
2121
, fs = require('fs')
2222
, menu = require('../exercises/menu')
23-
, name = 'nodebot-workshop'
24-
, title = 'Nodebot Workshop'
25-
, subtitle = '\x1b[23mSelect an exercise and hit \x1b[3mEnter\x1b[23m to begin'
26-
27-
function fpath (f) {
28-
return path.join(__dirname, f)
29-
}
3023

3124
workshopper.prototype.printMenu = function () {
3225
// snap it off
3326
}
3427

3528
var nodebot = workshopper({
36-
name : name
37-
, title : title
38-
, subtitle : subtitle
39-
, exerciseDir : fpath('../exercises/')
40-
, appDir : __dirname + '/..'
41-
, helpFile : fpath('help.txt')
42-
, menuItems : []
43-
, menu : {fg: "black", bg: 220}
29+
appDir : __dirname + '/..'
4430
, menuFactory: {
4531
options: {},
4632
create: function () {
@@ -60,9 +46,10 @@ function testSolution(name) {
6046
return name
6147
}
6248

63-
var exercise = nodebot.loadExercise(name)
49+
nodebot.loadExercise(name)
6450

65-
var solution = path.relative(__dirname, path.join(__dirname, '..', 'exercises', workshopperUtils.dirFromName(name), 'solution', 'solution.js'))
51+
var solution = path.relative(__dirname,
52+
path.join(__dirname, '..', 'exercises', workshopperUtils.dirFromName(name), 'solution', 'solution.js'))
6653

6754
nodebot.execute(['select', name])
6855
nodebot.execute(['verify', solution])

0 commit comments

Comments
 (0)