From 98e23a83c9402823dd1e35cdfaac1edf8a60c941 Mon Sep 17 00:00:00 2001 From: Peter deHaan Date: Thu, 11 Jun 2015 23:52:11 -0700 Subject: [PATCH] chore(cleanup): Fixed some syntax errors reported by ESLint --- config/config.js | 6 +++--- grunttasks/copyright.js | 4 ++-- grunttasks/jshint.js | 4 ++-- lib/db/mysql.js | 4 ++-- scripts/tap-coverage.js | 8 ++++---- test/local/log-stats.js | 2 +- test/local/mysql_tests.js | 4 ++-- test/local/prune_tokens.js | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config/config.js b/config/config.js index 99ff072..06f73e0 100644 --- a/config/config.js +++ b/config/config.js @@ -81,7 +81,7 @@ module.exports = function (fs, path, url, convict) { env: 'MYSQL_PORT', }, connectionLimit: { - doc: "The maximum number of connections to create at once.", + doc: 'The maximum number of connections to create at once.', default: 10, format: 'nat', env: 'MYSQL_CONNECTION_LIMIT', @@ -127,7 +127,7 @@ module.exports = function (fs, path, url, convict) { env: 'MYSQL_SLAVE_PORT', }, connectionLimit: { - doc: "The maximum number of connections to create at once.", + doc: 'The maximum number of connections to create at once.', default: 10, format: 'nat', env: 'MYSQL_SLAVE_CONNECTION_LIMIT', @@ -159,7 +159,7 @@ module.exports = function (fs, path, url, convict) { jwt: { secretKeyFile: { doc: 'Secret key to use for signing JWTs, a PEM-encoded file.', - default: __dirname + '/../test/local/test-secret.pem', + default: path.join(__dirname, '..', 'test', 'local', 'test-secret.pem'), env: 'NOTIFICATIONS_JWT_SECRET_KEY_FILE' }, iss: { diff --git a/grunttasks/copyright.js b/grunttasks/copyright.js index 3a15c29..f5e1986 100644 --- a/grunttasks/copyright.js +++ b/grunttasks/copyright.js @@ -8,10 +8,10 @@ module.exports = function (grunt) { grunt.config('copyright', { app: { src: [ - "{,bin/,config/,db/,scripts/}*.js" + '{,bin/,config/,db/,scripts/}*.js' ], options: { - pattern: "This Source Code Form is subject to the terms of the Mozilla Public" + pattern: 'This Source Code Form is subject to the terms of the Mozilla Public' } }, tests: { diff --git a/grunttasks/jshint.js b/grunttasks/jshint.js index e9944b3..7929ebf 100644 --- a/grunttasks/jshint.js +++ b/grunttasks/jshint.js @@ -7,10 +7,10 @@ module.exports = function (grunt) { grunt.config('jshint', { files: [ - "{,bin/,config/,db/,scripts/,test/**/}*.{js,json}" + '{,bin/,config/,db/,scripts/,test/**/}*.js' ], options: { - jshintrc: ".jshintrc" + jshintrc: '.jshintrc' } }) } diff --git a/lib/db/mysql.js b/lib/db/mysql.js index fabc7a5..06eec0a 100644 --- a/lib/db/mysql.js +++ b/lib/db/mysql.js @@ -66,7 +66,7 @@ module.exports = function (log, error) { } ) - var pruneIn = options.pruneEvery/2 + Math.floor(Math.random() * options.pruneEvery) + var pruneIn = options.pruneEvery / 2 + Math.floor(Math.random() * options.pruneEvery) setTimeout(prune.bind(this), pruneIn).unref(); } // start the pruning off, but only if enabled in config @@ -672,7 +672,7 @@ module.exports = function (log, error) { // exposed for testing only MySql.prototype.retryable_ = retryable - var PRUNE = "CALL prune(?, ?)" + var PRUNE = 'CALL prune(?, ?)' MySql.prototype.pruneTokens = function () { log.info({ op : 'MySql.pruneTokens' }) diff --git a/scripts/tap-coverage.js b/scripts/tap-coverage.js index 644a65e..2d884e6 100755 --- a/scripts/tap-coverage.js +++ b/scripts/tap-coverage.js @@ -21,14 +21,14 @@ var p = spawn(path.join(path.dirname(__dirname), 'node_modules', '.bin', 'tap'), p.on('close', function(code) { if (!process.env.NO_COVERAGE) { ass.report('json', function(err, r) { - console.log("code coverage:", r.percent + "%"); - process.stdout.write("generating coverage.html: "); + console.log('code coverage:', r.percent + '%'); + process.stdout.write('generating coverage.html: '); var start = new Date(); ass.report('html', function(err, html) { fs.writeFileSync(path.join(path.dirname(__dirname), 'coverage.html'), html); - process.stdout.write("complete in " + - ((new Date() - start) / 1000.0).toFixed(1) + "s\n"); + process.stdout.write('complete in ' + + ((new Date() - start) / 1000.0).toFixed(1) + 's\n'); process.exit(code); }); }); diff --git a/test/local/log-stats.js b/test/local/log-stats.js index 6edbad3..87c160b 100644 --- a/test/local/log-stats.js +++ b/test/local/log-stats.js @@ -38,7 +38,7 @@ DB.connect(config) t.equal(stats.stat, 'mysql', 'stats.stat is mysql') t.equal(stats.errors, 0, 'have no errors') t.equal(stats.connections, 1, 'have one connection') - }, + }, function(err) { t.fail('this should never happen ' + err) } diff --git a/test/local/mysql_tests.js b/test/local/mysql_tests.js index 583849c..4c9b109 100644 --- a/test/local/mysql_tests.js +++ b/test/local/mysql_tests.js @@ -203,8 +203,8 @@ DB.connect(config) t.pass('The call to the stored procedure failed as expected') t.equal(err.code, 500, 'error code is correct') var possibleErrors = [ - { msg: "ER_BAD_NULL_ERROR", errno: 1048 }, - { msg: "ER_NO_DEFAULT_FOR_FIELD", errno: 1364 } + { msg: 'ER_BAD_NULL_ERROR', errno: 1048 }, + { msg: 'ER_NO_DEFAULT_FOR_FIELD', errno: 1364 } ]; var matchedError = false; possibleErrors.forEach(function(possibleErr) { diff --git a/test/local/prune_tokens.js b/test/local/prune_tokens.js index 1882ee5..514f885 100644 --- a/test/local/prune_tokens.js +++ b/test/local/prune_tokens.js @@ -39,7 +39,7 @@ DB.connect(config) }) .then(function() { // now set it to be a day ago - var sql = "UPDATE accountResetTokens SET createdAt = createdAt - ? WHERE tokenId = ?" + var sql = 'UPDATE accountResetTokens SET createdAt = createdAt - ? WHERE tokenId = ?' return db.write(sql, [ oneDay, user.accountResetTokenId ]) }) .then(function(sdf) { @@ -47,7 +47,7 @@ DB.connect(config) }) .then(function() { // now set it to be a day ago - var sql = "UPDATE passwordForgotTokens SET createdAt = createdAt - ? WHERE tokenId = ?" + var sql = 'UPDATE passwordForgotTokens SET createdAt = createdAt - ? WHERE tokenId = ?' return db.write(sql, [ oneDay, user.passwordForgotTokenId ]) }) .then(function() {