blueslip: Apply ESLint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-10-28 15:39:19 -07:00 committed by Tim Abbott
parent 8fd51a0ab5
commit 87b23720f5
2 changed files with 37 additions and 30 deletions

View File

@ -1,3 +1,10 @@
static/js/blueslip.js # This is intended for generated files and vendored third-party files.
static/webpack-bundles # For our source code, instead of adding files here, consider using
static/js/js_typings/zulip/index.d.ts # specific eslint-disable comments in the files themselves.
/docs/_build
/static/generated
/static/third
/static/webpack-bundles
/var
/zulip-py3-venv

View File

@ -36,11 +36,10 @@ Logger.prototype = (function () {
pad(now.getUTCMilliseconds(), 3) + ' UTC'; pad(now.getUTCMilliseconds(), 3) + ' UTC';
var str_args = _.map(arguments, function (x) { var str_args = _.map(arguments, function (x) {
if (typeof(x) === 'object') { if (typeof x === 'object') {
return JSON.stringify(x); return JSON.stringify(x);
} else {
return x;
} }
return x;
}); });
var log_entry = date_str + " " + name.toUpperCase() + var log_entry = date_str + " " + name.toUpperCase() +
@ -62,12 +61,12 @@ Logger.prototype = (function () {
var proto = { var proto = {
get_log: function Logger_get_log() { get_log: function Logger_get_log() {
return this._memory_log; return this._memory_log;
} },
}; };
var methods = ['debug', 'log', 'info', 'warn', 'error']; var methods = ['debug', 'log', 'info', 'warn', 'error'];
var i; var i;
for (i = 0; i < methods.length; i++) { for (i = 0; i < methods.length; i += 1) {
proto[methods[i]] = make_logger_func(methods[i]); proto[methods[i]] = make_logger_func(methods[i]);
} }
@ -98,10 +97,9 @@ function report_error(msg, stack, opts) {
var key = ':' + msg + stack; var key = ':' + msg + stack;
if (reported_errors.hasOwnProperty(key) if (reported_errors.hasOwnProperty(key)
|| (last_report_attempt.hasOwnProperty(key) || last_report_attempt.hasOwnProperty(key)
// Only try to report a given error once every 5 minutes // Only try to report a given error once every 5 minutes
&& (Date.now() - last_report_attempt[key] <= 60 * 5 * 1000))) && Date.now() - last_report_attempt[key] <= 60 * 5 * 1000) {
{
return; return;
} }
@ -115,13 +113,15 @@ function report_error(msg, stack, opts) {
type: 'POST', type: 'POST',
url: '/json/report/error', url: '/json/report/error',
dataType: 'json', dataType: 'json',
data: { message: msg, data: {
message: msg,
stacktrace: stack, stacktrace: stack,
ui_message: opts.show_ui_msg, ui_message: opts.show_ui_msg,
more_info: JSON.stringify(opts.more_info), more_info: JSON.stringify(opts.more_info),
href: window.location.href, href: window.location.href,
user_agent: window.navigator.userAgent, user_agent: window.navigator.userAgent,
log: logger.get_log().join("\n")}, log: logger.get_log().join("\n"),
},
timeout: 3 * 1000, timeout: 3 * 1000,
success: function () { success: function () {
reported_errors[key] = true; reported_errors[key] = true;
@ -158,7 +158,7 @@ function report_error(msg, stack, opts) {
"Please try reloading the page.", "Please try reloading the page.",
$("#home-error"), "alert-error"); $("#home-error"), "alert-error");
} }
} },
}); });
if (page_params.save_stacktraces) { if (page_params.save_stacktraces) {