From 7304e29dec33e4d4d64a9f553e7644d70a78d4e4 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 1 Jul 2014 06:00:12 +1000 Subject: [PATCH] Various minor JSHint fixes. Summary: Various fixes as suggested by JSHint. Test Plan: Eye-balled it. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9783 --- support/aphlict/server/aphlict_server.js | 6 ++---- support/aphlict/server/lib/AphlictFlashPolicyServer.js | 4 ++-- support/aphlict/server/lib/AphlictLog.js | 4 ++-- .../js/application/differential/behavior-comment-jump.js | 4 ++-- .../rsrc/js/core/behavior-phabricator-remarkup-assist.js | 8 ++++---- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js index 831437f763..d2594c720e 100644 --- a/support/aphlict/server/aphlict_server.js +++ b/support/aphlict/server/aphlict_server.js @@ -62,10 +62,9 @@ if (process.getuid() !== 0) { var net = require('net'); var http = require('http'); -var url = require('url'); process.on('uncaughtException', function(err) { - debug.log("\n<<< UNCAUGHT EXCEPTION! >>>\n" + err.stack); + debug.log('\n<<< UNCAUGHT EXCEPTION! >>>\n' + err.stack); process.exit(1); }); @@ -188,7 +187,7 @@ var receive_server = http.createServer(function(request, response) { } }); } else if (request.url == '/status/') { - request.on('data', function(data) { + request.on('data', function() { // We just ignore the request data, but newer versions of Node don't // get to 'end' if we don't process the data. See T2953. }); @@ -213,7 +212,6 @@ var receive_server = http.createServer(function(request, response) { response.write('400 Bad Request'); response.end(); } - }).listen(config.admin, config.host); function transmit(msg) { diff --git a/support/aphlict/server/lib/AphlictFlashPolicyServer.js b/support/aphlict/server/lib/AphlictFlashPolicyServer.js index 8651d643a8..4c6ebcaabf 100644 --- a/support/aphlict/server/lib/AphlictFlashPolicyServer.js +++ b/support/aphlict/server/lib/AphlictFlashPolicyServer.js @@ -46,7 +46,7 @@ JX.install('AphlictFlashPolicyServer', { this._log(' Socket Error: %s', error); }, - _log: function(pattern) { + _log: function() { this._debug && this._debug.log.apply(this._debug, arguments); }, @@ -60,7 +60,7 @@ JX.install('AphlictFlashPolicyServer', { '' ]; - return policy.join("\n") + "\0"; + return policy.join('\n') + '\0'; } } diff --git a/support/aphlict/server/lib/AphlictLog.js b/support/aphlict/server/lib/AphlictLog.js index 259c03fada..73b9031194 100644 --- a/support/aphlict/server/lib/AphlictLog.js +++ b/support/aphlict/server/lib/AphlictLog.js @@ -32,7 +32,7 @@ JX.install('AphlictLog', { return this; }, - log: function(pattern) { + log: function() { var str = util.format.apply(null, arguments); var date = new Date().toLocaleString(); str = '[' + date + '] ' + str; @@ -43,7 +43,7 @@ JX.install('AphlictLog', { } for (ii = 0; ii < this._writeToLogs.length; ii++) { - this._writeToLogs[ii].write(str + "\n"); + this._writeToLogs[ii].write(str + '\n'); } } diff --git a/webroot/rsrc/js/application/differential/behavior-comment-jump.js b/webroot/rsrc/js/application/differential/behavior-comment-jump.js index d8aa728e0b..53d43fd05e 100644 --- a/webroot/rsrc/js/application/differential/behavior-comment-jump.js +++ b/webroot/rsrc/js/application/differential/behavior-comment-jump.js @@ -7,7 +7,7 @@ JX.behavior('differential-comment-jump', function() { function handle_jump(offset) { - return (function(e) { + return function(e) { var parent = JX.$('differential-review-stage'); var clicked = e.getNode('differential-inline-comment'); var inlines = JX.DOM.scry(parent, 'div', 'differential-inline-comment'); @@ -24,7 +24,7 @@ JX.behavior('differential-comment-jump', function() { }); JX.DOM.scrollTo(jumpto); e.kill(); - }); + }; } JX.Stratcom.listen('click', 'differential-inline-prev', handle_jump(-1)); diff --git a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js index 97359be317..7576591219 100644 --- a/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js +++ b/webroot/rsrc/js/core/behavior-phabricator-remarkup-assist.js @@ -131,12 +131,12 @@ JX.behavior('phabricator-remarkup-assist', function(config) { break; case 'fa-code': sel = sel || 'foreach ($list as $item) {\n work_miracles($item);\n}'; - var prefix = (r.start === 0) ? '' : '\n'; - update(area, prefix + '```\n', sel, '\n```'); + var code_prefix = (r.start === 0) ? '' : '\n'; + update(area, code_prefix + '```\n', sel, '\n```'); break; case 'fa-table': - var prefix = (r.start === 0 ? '' : '\n\n'); - update(area, prefix + '| ', sel || pht('data'), ' |'); + var table_prefix = (r.start === 0 ? '' : '\n\n'); + update(area, table_prefix + '| ', sel || pht('data'), ' |'); break; case 'fa-meh-o': new JX.Workflow('/macro/meme/create/')