Lint JavaScript

This commit is contained in:
Rowan Manning
2013-09-16 13:28:51 +01:00
parent 3836e9079b
commit b7cb3ab48a
6 changed files with 78 additions and 4 deletions

View File

@@ -1,12 +1,20 @@
# Group targets # Group targets
all: deps all: deps lint
# Install dependencies # Install dependencies
deps: deps:
@echo "Installing dependencies..." @echo "Installing dependencies..."
@npm install @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 the application
start: start:
@echo "Starting application..." @echo "Starting application..."

2
app.js
View File

@@ -1,6 +1,5 @@
'use strict'; 'use strict';
var async = require('async');
var createClient = require('pa11y-webservice-client-node'); var createClient = require('pa11y-webservice-client-node');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var express = require('express'); var express = require('express');
@@ -57,6 +56,7 @@ function initApp (config, callback) {
// Error handling // Error handling
app.express.use(function (err, req, res, next) { app.express.use(function (err, req, res, next) {
/* jshint unused: false */
app.emit('route-error', err); app.emit('route-error', err);
res.send('Error'); res.send('Error');
}); });

View File

@@ -12,7 +12,7 @@ require('./app')(config, function (err, app) {
app.on('route-error', function (err) { app.on('route-error', function (err) {
if (err.code === 'ECONNREFUSED') { 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'));
} }
}); });

View File

@@ -14,6 +14,7 @@
"pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.2" "pa11y-webservice-client-node": "git+ssh://git@github.com:nature/pa11y-webservice-client-node.git#1.0.0-beta.2"
}, },
"devDependencies": { "devDependencies": {
"jshint": "~2.1",
"supervisor": "~0.5" "supervisor": "~0.5"
}, },
"scripts": { "scripts": {

65
test/config/jshint.json Normal file
View File

@@ -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
}

View File

@@ -17,4 +17,4 @@ function helper (register) {
return moment(context).fromNow(); return moment(context).fromNow();
}); });
}; }