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
static/webpack-bundles
static/js/js_typings/zulip/index.d.ts
# This is intended for generated files and vendored third-party files.
# For our source code, instead of adding files here, consider using
# 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';
var str_args = _.map(arguments, function (x) {
if (typeof(x) === 'object') {
if (typeof x === 'object') {
return JSON.stringify(x);
} else {
return x;
}
return x;
});
var log_entry = date_str + " " + name.toUpperCase() +
@@ -62,12 +61,12 @@ Logger.prototype = (function () {
var proto = {
get_log: function Logger_get_log() {
return this._memory_log;
}
},
};
var methods = ['debug', 'log', 'info', 'warn', 'error'];
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]);
}
@@ -98,10 +97,9 @@ function report_error(msg, stack, opts) {
var key = ':' + msg + stack;
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
&& (Date.now() - last_report_attempt[key] <= 60 * 5 * 1000)))
{
&& Date.now() - last_report_attempt[key] <= 60 * 5 * 1000) {
return;
}
@@ -115,13 +113,15 @@ function report_error(msg, stack, opts) {
type: 'POST',
url: '/json/report/error',
dataType: 'json',
data: { message: msg,
data: {
message: msg,
stacktrace: stack,
ui_message: opts.show_ui_msg,
more_info: JSON.stringify(opts.more_info),
href: window.location.href,
user_agent: window.navigator.userAgent,
log: logger.get_log().join("\n")},
log: logger.get_log().join("\n"),
},
timeout: 3 * 1000,
success: function () {
reported_errors[key] = true;
@@ -158,7 +158,7 @@ function report_error(msg, stack, opts) {
"Please try reloading the page.",
$("#home-error"), "alert-error");
}
}
},
});
if (page_params.save_stacktraces) {