js: Automatically convert var to let and const in most files.

This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-11-01 16:06:25 -07:00
committed by Tim Abbott
parent f7245e9ec6
commit 28f3dfa284
279 changed files with 6102 additions and 6102 deletions

View File

@@ -1,6 +1,6 @@
exports.update_count_in_dom = function (unread_count_elem, count) {
var count_span = unread_count_elem.find('.count');
var value_span = count_span.find('.value');
const count_span = unread_count_elem.find('.count');
const value_span = count_span.find('.value');
if (count === 0) {
count_span.hide();
@@ -13,7 +13,7 @@ exports.update_count_in_dom = function (unread_count_elem, count) {
};
exports.update_starred_count = function (count) {
var starred_li = $('.top_left_starred_messages');
const starred_li = $('.top_left_starred_messages');
exports.update_count_in_dom(starred_li, count);
};
@@ -21,8 +21,8 @@ exports.update_dom_with_unread_counts = function (counts) {
// Note that "Private messages" counts are handled in pm_list.js.
// mentioned/home have simple integer counts
var mentioned_li = $('.top_left_mentions');
var home_li = $('.top_left_all_messages');
const mentioned_li = $('.top_left_mentions');
const home_li = $('.top_left_all_messages');
exports.update_count_in_dom(mentioned_li, counts.mentioned_message_count);
exports.update_count_in_dom(home_li, counts.home_unread_messages);
@@ -45,9 +45,9 @@ function deselect_top_left_corner_items() {
exports.handle_narrow_activated = function (filter) {
deselect_top_left_corner_items();
var ops;
var filter_name;
var filter_li;
let ops;
let filter_name;
let filter_li;
// TODO: handle confused filters like "in:all stream:foo"
ops = filter.operands('in');
@@ -71,7 +71,7 @@ exports.handle_narrow_activated = function (filter) {
}
if (exports.should_expand_pm_list(filter)) {
var op_pm = filter.operands('pm-with');
const op_pm = filter.operands('pm-with');
pm_list.expand(op_pm);
} else {
pm_list.close();
@@ -79,22 +79,22 @@ exports.handle_narrow_activated = function (filter) {
};
exports.should_expand_pm_list = function (filter) {
var op_is = filter.operands('is');
const op_is = filter.operands('is');
if (op_is.length >= 1 && _.contains(op_is, "private")) {
return true;
}
var op_pm = filter.operands('pm-with');
const op_pm = filter.operands('pm-with');
if (op_pm.length !== 1) {
return false;
}
var emails_strings = op_pm[0];
var emails = emails_strings.split(',');
const emails_strings = op_pm[0];
const emails = emails_strings.split(',');
var has_valid_emails = people.is_valid_bulk_emails_for_compose(emails);
const has_valid_emails = people.is_valid_bulk_emails_for_compose(emails);
return has_valid_emails;
};
@@ -103,7 +103,7 @@ exports.handle_narrow_deactivated = function () {
deselect_top_left_corner_items();
pm_list.close();
var filter_li = $('.top_left_all_messages');
const filter_li = $('.top_left_all_messages');
filter_li.addClass('active-filter');
};