Skip to content

Commit

Permalink
lint: use standard style
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed May 18, 2016
1 parent fb378a8 commit 2492832
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 177 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
coverage
node_modules
3 changes: 3 additions & 0 deletions .eslintrc
@@ -0,0 +1,3 @@
{
"extends": "standard"
}
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -16,8 +16,8 @@ cache:
- node_modules - node_modules
before_install: before_install:
# Setup Node.js version-specific dependencies # Setup Node.js version-specific dependencies
- "test $TRAVIS_NODE_VERSION != '0.6' || npm rm --save-dev istanbul" - "test $TRAVIS_NODE_VERSION != '0.6' || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard istanbul"
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul" - "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard istanbul"


# Update Node.js modules # Update Node.js modules
- "test ! -d node_modules || npm prune" - "test ! -d node_modules || npm prune"
Expand All @@ -26,5 +26,6 @@ script:
# Run test script, depending on istanbul install # Run test script, depending on istanbul install
- "test ! -z $(npm -ps ls istanbul) || npm test" - "test ! -z $(npm -ps ls istanbul) || npm test"
- "test -z $(npm -ps ls istanbul) || npm run-script test-travis" - "test -z $(npm -ps ls istanbul) || npm run-script test-travis"
- "test -z $(npm -ps ls eslint ) || npm run-script lint"
after_script: after_script:
- "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls" - "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
34 changes: 17 additions & 17 deletions index.js
Expand Up @@ -11,8 +11,8 @@
*/ */


var setPrototypeOf = require('setprototypeof') var setPrototypeOf = require('setprototypeof')
var statuses = require('statuses'); var statuses = require('statuses')
var inherits = require('inherits'); var inherits = require('inherits')


/** /**
* Module exports. * Module exports.
Expand All @@ -34,27 +34,27 @@ populateConstructorExports(module.exports, statuses.codes, module.exports.HttpEr


function createError () { function createError () {
// so much arity going on ~_~ // so much arity going on ~_~
var err; var err
var msg; var msg
var status = 500; var status = 500
var props = {}; var props = {}
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i]; var arg = arguments[i]
if (arg instanceof Error) { if (arg instanceof Error) {
err = arg; err = arg
status = err.status || err.statusCode || status; status = err.status || err.statusCode || status
continue; continue
} }
switch (typeof arg) { switch (typeof arg) {
case 'string': case 'string':
msg = arg; msg = arg
break; break
case 'number': case 'number':
status = arg; status = arg
break; break
case 'object': case 'object':
props = arg; props = arg
break; break
} }
} }


Expand Down Expand Up @@ -85,7 +85,7 @@ function createError () {
} }
} }


return err; return err
} }


/** /**
Expand Down
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -15,13 +15,18 @@
"statuses": ">= 1.3.0 < 2" "statuses": ">= 1.3.0 < 2"
}, },
"devDependencies": { "devDependencies": {
"eslint": "2.10.2",
"eslint-config-standard": "5.3.1",
"eslint-plugin-promise": "1.1.0",
"eslint-plugin-standard": "1.3.2",
"istanbul": "0.4.3", "istanbul": "0.4.3",
"mocha": "1.21.5" "mocha": "1.21.5"
}, },
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
}, },
"scripts": { "scripts": {
"lint": "eslint **/*.js",
"test": "mocha --reporter spec --bail", "test": "mocha --reporter spec --bail",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}

0 comments on commit 2492832

Please sign in to comment.