diff --git a/Makefile b/Makefile index f57046a..ed57320 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,20 @@ # Group targets -all: deps +all: deps lint # Install dependencies deps: @echo "Installing dependencies..." @npm install +# Lint JavaScript +lint: + @echo "Linting JavaScript..." + @./node_modules/.bin/jshint \ + --config ./test/config/jshint.json \ + --exclude ./node_modules \ + *.js **/*.js + # Start the application start: @echo "Starting application..." diff --git a/app.js b/app.js index d3aba17..18d7344 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,5 @@ 'use strict'; -var async = require('async'); var createClient = require('pa11y-webservice-client-node'); var EventEmitter = require('events').EventEmitter; var express = require('express'); @@ -57,6 +56,7 @@ function initApp (config, callback) { // Error handling app.express.use(function (err, req, res, next) { + /* jshint unused: false */ app.emit('route-error', err); res.send('Error'); }); diff --git a/index.js b/index.js index fdea528..2065632 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ require('./app')(config, function (err, app) { app.on('route-error', function (err) { if (err.code === 'ECONNREFUSED') { - console.log(chalk.red('Error: could not connect to pa11y-webservice')) + console.log(chalk.red('Error: could not connect to pa11y-webservice')); } }); diff --git a/package.json b/package.json index bbf04d8..85b480b 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.2" }, "devDependencies": { + "jshint": "~2.1", "supervisor": "~0.5" }, "scripts": { diff --git a/test/config/jshint.json b/test/config/jshint.json new file mode 100644 index 0000000..f3c0e1b --- /dev/null +++ b/test/config/jshint.json @@ -0,0 +1,65 @@ +{ + "bitwise": true, + "camelcase": false, + "curly": true, + "eqeqeq": true, + "es3": false, + "forin": true, + "immed": true, + "indent": 4, + "latedef": false, + "newcap": true, + "noarg": true, + "noempty": true, + "nonew": true, + "plusplus": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "maxparams": 4, + "maxdepth": 2, + "maxstatements": 0, + "maxcomplexity": 4, + "maxlen": 100, + + "asi": false, + "boss": false, + "debug": false, + "eqnull": false, + "es5": false, + "esnext": false, + "evil": false, + "expr": false, + "funcscope": false, + "globalstrict": false, + "iterator": false, + "lastsemic": false, + "laxbreak": false, + "laxcomma": false, + "loopfunc": false, + "moz": false, + "multistr": false, + "proto": false, + "scripturl": false, + "smarttabs": false, + "shadow": false, + "sub": false, + "supernew": false, + "validthis": false, + + "browser": false, + "couch": false, + "devel": false, + "dojo": false, + "jquery": false, + "mootools": false, + "node": true, + "nonstandard": false, + "prototypejs": false, + "rhino": false, + "worker": false, + "wsh": false, + "yui": false +} \ No newline at end of file diff --git a/view/helper/date.js b/view/helper/date.js index 7187593..2ff5c03 100644 --- a/view/helper/date.js +++ b/view/helper/date.js @@ -17,4 +17,4 @@ function helper (register) { return moment(context).fromNow(); }); -}; +}