mirror of https://github.com/zulip/zulip.git
eslint: change no-plusplus from warning to 2 and fix violations.
This commit is contained in:
parent
c90da24541
commit
e6369fc29b
|
@ -124,7 +124,7 @@
|
|||
"no-new": 2,
|
||||
"no-new-func": 2,
|
||||
"no-native-reassign": 2,
|
||||
"no-plusplus": 1,
|
||||
"no-plusplus": 2,
|
||||
"no-delete-var": 2,
|
||||
"no-return-assign": 2,
|
||||
"no-new-object": 2,
|
||||
|
|
|
@ -56,7 +56,7 @@ exports.initialize_casper = function (viewport) {
|
|||
casper.test.on('fail', function failure() {
|
||||
if (casper_failure_count <= 10) {
|
||||
casper.capture("var/casper/casper-failure" + casper_failure_count + ".png");
|
||||
casper_failure_count++;
|
||||
casper_failure_count += 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ var zero_counts = {
|
|||
|
||||
var num_msgs = 10000;
|
||||
var i;
|
||||
for (i = 0; i < num_msgs; ++i) {
|
||||
for (i = 0; i < num_msgs; i += 1) {
|
||||
message.id = i+1;
|
||||
unread.process_loaded_messages([message]);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ var zero_counts = {
|
|||
count = unread.num_unread_for_subject('social', 'lunch');
|
||||
assert.equal(count, num_msgs);
|
||||
|
||||
for (i = 0; i < num_msgs; ++i) {
|
||||
for (i = 0; i < num_msgs; i += 1) {
|
||||
message.id = i+1;
|
||||
unread.process_read_message(message);
|
||||
}
|
||||
|
|
|
@ -188,19 +188,19 @@ var _ = global._;
|
|||
'some_email@**everyone**.com'
|
||||
];
|
||||
var i;
|
||||
for (i=0; i<messages_with_all_mentions.length; i++) {
|
||||
for (i=0; i<messages_with_all_mentions.length; i += 1) {
|
||||
assert(util.is_all_or_everyone_mentioned(messages_with_all_mentions[i]));
|
||||
}
|
||||
|
||||
for (i=0; i<messages_with_everyone_mentions.length; i++) {
|
||||
for (i=0; i<messages_with_everyone_mentions.length; i += 1) {
|
||||
assert(util.is_all_or_everyone_mentioned(messages_with_everyone_mentions[i]));
|
||||
}
|
||||
|
||||
for (i=0; i<messages_without_all_mentions.length; i++) {
|
||||
for (i=0; i<messages_without_all_mentions.length; i += 1) {
|
||||
assert(!util.is_all_or_everyone_mentioned(messages_without_everyone_mentions[i]));
|
||||
}
|
||||
|
||||
for (i=0; i<messages_without_everyone_mentions.length; i++) {
|
||||
for (i=0; i<messages_without_everyone_mentions.length; i += 1) {
|
||||
assert(!util.is_all_or_everyone_mentioned(messages_without_everyone_mentions[i]));
|
||||
}
|
||||
}());
|
||||
|
|
|
@ -176,7 +176,7 @@ exports.huddle_fraction_present = function (huddle, presence_info) {
|
|||
if (presence_info[user_id]) {
|
||||
var status = presence_info[user_id].status;
|
||||
if (status && (status !== 'offline')) {
|
||||
++num_present;
|
||||
num_present += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -264,7 +264,7 @@ function _setup_page() {
|
|||
var domains_string = stringify_list_with_conjunction(page_params.domains, "or");
|
||||
var atdomains = page_params.domains.slice();
|
||||
var i;
|
||||
for (i = 0; i < atdomains.length; i++) {
|
||||
for (i = 0; i < atdomains.length; i += 1) {
|
||||
atdomains[i] = '@' + atdomains[i];
|
||||
}
|
||||
var atdomains_string = stringify_list_with_conjunction(atdomains, "or");
|
||||
|
|
|
@ -61,7 +61,7 @@ function _fade_messages() {
|
|||
normal_display = false;
|
||||
|
||||
// Update the visible messages first, before the compose box opens
|
||||
for (i = 0; i < visible_groups.length; i++) {
|
||||
for (i = 0; i < visible_groups.length; i += 1) {
|
||||
first_row = rows.first_message_in_group(visible_groups[i]);
|
||||
first_message = current_msg_list.get(rows.id(first_row));
|
||||
should_fade_group = !fade_heuristic(focused_recipient, first_message);
|
||||
|
@ -83,7 +83,7 @@ function _fade_messages() {
|
|||
|
||||
// Note: The below algorithm relies on the fact that all_elts is
|
||||
// sorted as it would be displayed in the message view
|
||||
for (i = 0; i < all_groups.length; i++) {
|
||||
for (i = 0; i < all_groups.length; i += 1) {
|
||||
var group_elt = $(all_groups[i]);
|
||||
should_fade_group = !fade_heuristic(focused_recipient, rows.recipient_from_group(group_elt));
|
||||
change_fade_state(group_elt, should_fade_group);
|
||||
|
|
|
@ -19,7 +19,7 @@ function find_boundary_tr(initial_tr, iterate_row) {
|
|||
// To ensure we can't enter an infinite loop, bail out (and let the
|
||||
// browser handle the copy-paste on its own) if we don't hit what we
|
||||
// are looking for within 10 rows.
|
||||
for (j = 0; (!tr.is('.message_row')) && j < 10; j++) {
|
||||
for (j = 0; (!tr.is('.message_row')) && j < 10; j += 1) {
|
||||
tr = iterate_row(tr);
|
||||
}
|
||||
if (j === 10) {
|
||||
|
@ -41,7 +41,7 @@ function copy_handler(e) {
|
|||
var start_data, end_data;
|
||||
var skip_same_td_check = false;
|
||||
var div = $('<div>'), content;
|
||||
for (i = 0; i < selection.rangeCount; i++) {
|
||||
for (i = 0; i < selection.rangeCount; i += 1) {
|
||||
range = selection.getRangeAt(i);
|
||||
ranges.push(range);
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ function add_subject_links(message) {
|
|||
var current_group = i + 1;
|
||||
var back_ref = "\\" + current_group;
|
||||
link_url = link_url.replace(back_ref, matched_group);
|
||||
i++;
|
||||
i += 1;
|
||||
}
|
||||
links.push(link_url);
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ function handleRealmFilter(pattern, matches) {
|
|||
_.each(matches, function (match) {
|
||||
var back_ref = "\\" + current_group;
|
||||
url = url.replace(back_ref, match);
|
||||
current_group++;
|
||||
current_group += 1;
|
||||
});
|
||||
|
||||
return url;
|
||||
|
@ -373,7 +373,7 @@ function python_to_js_filter(pattern, url) {
|
|||
|
||||
match = named_group_re.exec(pattern);
|
||||
|
||||
current_group++;
|
||||
current_group += 1;
|
||||
}
|
||||
// Convert any python in-regex flags to RegExp flags
|
||||
var js_flags = 'g';
|
||||
|
|
|
@ -239,7 +239,7 @@ function edit_message (row, raw_content) {
|
|||
// since otherwise there is a noticeable lag
|
||||
message_edit_countdown_timer.text(timer_text(seconds_left));
|
||||
var countdown_timer = setInterval(function () {
|
||||
if (--seconds_left <= 0) {
|
||||
if (seconds_left - 1 <= 0) {
|
||||
clearInterval(countdown_timer);
|
||||
message_edit_content.prop("readonly", "readonly");
|
||||
if (message.type === 'stream') {
|
||||
|
|
|
@ -260,7 +260,7 @@ exports.MessageList.prototype = {
|
|||
// for lower_bound purposes, find the real leftmost index (first non-local id)
|
||||
do {
|
||||
potential_closest_matches.push(closest);
|
||||
closest--;
|
||||
closest -= 1;
|
||||
} while (closest > 0 && this._is_localonly_id(items[closest - 1].id));
|
||||
}
|
||||
potential_closest_matches.push(closest);
|
||||
|
@ -308,7 +308,7 @@ exports.MessageList.prototype = {
|
|||
break;
|
||||
}
|
||||
next_msg_id = msg_id;
|
||||
++idx;
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
if (next_msg_id > 0) {
|
||||
|
|
|
@ -29,7 +29,7 @@ exports.get_private_message_recipient = function (message, attr, fallback_attr)
|
|||
if (recipient === undefined && fallback_attr !== undefined) {
|
||||
recipient = other_recipients[0][fallback_attr];
|
||||
}
|
||||
for (i = 1; i < other_recipients.length; i++) {
|
||||
for (i = 1; i < other_recipients.length; i += 1) {
|
||||
var attr_value = other_recipients[i][attr];
|
||||
if (attr_value === undefined && fallback_attr !== undefined) {
|
||||
attr_value = other_recipients[i][fallback_attr];
|
||||
|
@ -384,7 +384,7 @@ exports.insert_new_messages = function insert_new_messages(messages) {
|
|||
|
||||
// Iterate backwards to find the last message sent_by_me, stopping at
|
||||
// the pointer position.
|
||||
for (i = messages.length-1; i>=0; i--) {
|
||||
for (i = messages.length-1; i>=0; i -= 1) {
|
||||
var id = messages[i].id;
|
||||
if (id <= selected_id) {
|
||||
break;
|
||||
|
|
|
@ -276,7 +276,7 @@ function process_notification(notification) {
|
|||
|
||||
if (content.length > 150) {
|
||||
// Truncate content at a word boundary
|
||||
for (i = 150; i > 0; i--) {
|
||||
for (i = 150; i > 0; i -= 1) {
|
||||
if (content[i] === ' ') {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -131,9 +131,9 @@ exports.actions_menu_handle_keyboard = function (key) {
|
|||
if (index === -1) {
|
||||
index = 0;
|
||||
} else if ((key === 'down_arrow' || key === 'vim_down') && index < items.length - 1) {
|
||||
++index;
|
||||
index += 1;
|
||||
} else if ((key === 'up_arrow' || key === 'vim_up') && index > 0) {
|
||||
--index;
|
||||
index -= 1;
|
||||
}
|
||||
items.eq(index).focus();
|
||||
};
|
||||
|
|
|
@ -26,12 +26,12 @@ exports.update_state = function (granted, used) {
|
|||
$("#referral-form input").attr('placeholder', _.shuffle(placeholder_invitees).pop());
|
||||
$("#invite-hearts").empty();
|
||||
var i;
|
||||
for (i = 0; i < used; i++) {
|
||||
for (i = 0; i < used; i += 1) {
|
||||
$("#invite-hearts").append($('<i class="icon-vector-heart"> </i>'));
|
||||
}
|
||||
|
||||
var invites_left = Math.max(0, granted - used);
|
||||
for (i = 0; i < invites_left; i++) {
|
||||
for (i = 0; i < invites_left; i += 1) {
|
||||
$("#invite-hearts").append($('<i class="icon-vector-heart-empty"> </i>'));
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ function phrase_match(phrase, q) {
|
|||
}
|
||||
|
||||
var parts = phrase.split(' ');
|
||||
for (i = 0; i < parts.length; i++) {
|
||||
for (i = 0; i < parts.length; i += 1) {
|
||||
if (parts[i].indexOf(q) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ function get_operator_subset_suggestions(query, operators) {
|
|||
var i;
|
||||
var suggestions = [];
|
||||
|
||||
for (i = operators.length - 1; i >= 1; --i) {
|
||||
for (i = operators.length - 1; i >= 1; i -= 1) {
|
||||
var subset = operators.slice(0, i);
|
||||
var search_string = Filter.unparse(subset);
|
||||
var description = Filter.describe(subset);
|
||||
|
|
|
@ -89,7 +89,7 @@ Socket.prototype = {
|
|||
|
||||
_get_next_req_id: function Socket__get_next_req_id() {
|
||||
var req_id = page_params.event_queue_id + ':' + this._next_req_id_counter;
|
||||
this._next_req_id_counter++;
|
||||
this._next_req_id_counter += 1;
|
||||
return req_id;
|
||||
},
|
||||
|
||||
|
@ -239,7 +239,7 @@ Socket.prototype = {
|
|||
};
|
||||
request.error = function (type, resp) {
|
||||
blueslip.info("Could not authenticate with server: " + resp.msg);
|
||||
that._connection_failures++;
|
||||
that._connection_failures += 1;
|
||||
that._try_to_reconnect({reason: 'auth_fail',
|
||||
wait_time: that._reconnect_wait_time()});
|
||||
};
|
||||
|
@ -277,7 +277,7 @@ Socket.prototype = {
|
|||
|
||||
blueslip.info("SockJS connection lost. Attempting to reconnect soon."
|
||||
+ " (" + event.code.toString() + ", " + event.reason + ")");
|
||||
that._connection_failures++;
|
||||
that._connection_failures += 1;
|
||||
that._is_reconnecting = false;
|
||||
// We don't need to specify a reason because the Socket is already closed
|
||||
that._try_to_reconnect({wait_time: that._reconnect_wait_time()});
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
}, function () {
|
||||
var i;
|
||||
initialized = true;
|
||||
for (i=0; i<callbacks.length; i++) {
|
||||
for (i=0; i<callbacks.length; i += 1) {
|
||||
callbacks[i]();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -172,7 +172,7 @@ exports.get_color_class = _.memoize(function (color) {
|
|||
|
||||
// CSS colors are specified in the sRGB color space.
|
||||
// Convert to linear intensity values.
|
||||
for (i=0; i<3; i++) {
|
||||
for (i=0; i<3; i += 1) {
|
||||
channel[i] = colorspace.sRGB_to_linear(mult * parseInt(match[i+1], 16));
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ Handlebars.registerHelper('if_and', function () {
|
|||
// {{/if_and}}
|
||||
var options = arguments[arguments.length - 1];
|
||||
var i;
|
||||
for (i = 0; i < arguments.length - 1; i++) {
|
||||
for (i = 0; i < arguments.length - 1; i += 1) {
|
||||
if (!arguments[i]) {
|
||||
return options.inverse(this);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ Handlebars.registerHelper('if_or', function () {
|
|||
// {{/if_or}}
|
||||
var options = arguments[arguments.length - 1];
|
||||
var i;
|
||||
for (i = 0; i < arguments.length - 1; i++) {
|
||||
for (i = 0; i < arguments.length - 1; i += 1) {
|
||||
if (arguments[i]) {
|
||||
return options.fn(this);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ function render_date_span(elem, time_str, time_above_str) {
|
|||
// okay since to update the time later we look up the node by its id.)
|
||||
exports.render_date = function (time, time_above) {
|
||||
var id = "timerender" + next_timerender_id;
|
||||
next_timerender_id++;
|
||||
next_timerender_id += 1;
|
||||
var rendered_time = exports.render_now(time);
|
||||
var node = $("<span />").attr('id', id);
|
||||
if (time_above !== undefined) {
|
||||
|
|
|
@ -50,7 +50,7 @@ exports.highlight_query_in_phrase = function (query, phrase) {
|
|||
|
||||
var result = "";
|
||||
var parts = phrase.split(' ');
|
||||
for (i = 0; i < parts.length; i++) {
|
||||
for (i = 0; i < parts.length; i += 1) {
|
||||
if (i > 0) {
|
||||
result += " ";
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ exports.lower_bound = function (array, arg1, arg2, arg3, arg4) {
|
|||
middle = first + step;
|
||||
if (less(array[middle], value, middle)) {
|
||||
first = middle;
|
||||
first++;
|
||||
first += 1;
|
||||
len = len - step - 1;
|
||||
} else {
|
||||
len = step;
|
||||
|
@ -144,7 +144,7 @@ exports.robust_uri_decode = function (str) {
|
|||
if (!(e instanceof URIError)) {
|
||||
throw e;
|
||||
}
|
||||
end--;
|
||||
end -= 1;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
|
@ -177,7 +177,7 @@ exports.array_compare = function util_array_compare(a, b) {
|
|||
return false;
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
for (i = 0; i < a.length; i += 1) {
|
||||
if (a[i] !== b[i]) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue