mirror of https://github.com/zulip/zulip.git
eslint: Add and enforce space-in-parens lint rule.
This commit is contained in:
parent
0c44310009
commit
82b708b721
|
@ -310,7 +310,7 @@
|
|||
"asyncArrow": "always"
|
||||
}
|
||||
],
|
||||
"space-in-parens": 0,
|
||||
"space-in-parens": 2,
|
||||
"space-infix-ops": 0,
|
||||
"spaced-comment": 0,
|
||||
"strict": 0,
|
||||
|
|
|
@ -885,7 +885,7 @@ global.people.add(deactivated_user);
|
|||
assert.deepEqual(item, { primary: 'py' });
|
||||
th_render_typeahead_item_called = true;
|
||||
};
|
||||
ct.content_highlighter.call(fake_this, 'py' );
|
||||
ct.content_highlighter.call(fake_this, 'py');
|
||||
|
||||
fake_this = { completing: 'something-else' };
|
||||
assert(!ct.content_highlighter.call(fake_this));
|
||||
|
|
|
@ -80,7 +80,7 @@ var draft_2 = {
|
|||
localStorage.clear();
|
||||
(function test_editDraft() {
|
||||
stub_timestamp(2, function () {
|
||||
ls.set("drafts", { id1: draft_1 } );
|
||||
ls.set("drafts", { id1: draft_1 });
|
||||
var expected = _.clone(draft_2);
|
||||
expected.updatedAt = 2;
|
||||
draft_model.editDraft("id1", _.clone(draft_2));
|
||||
|
@ -91,7 +91,7 @@ var draft_2 = {
|
|||
|
||||
localStorage.clear();
|
||||
(function test_deleteDraft() {
|
||||
ls.set("drafts", { id1: draft_1 } );
|
||||
ls.set("drafts", { id1: draft_1 });
|
||||
draft_model.deleteDraft("id1");
|
||||
|
||||
assert.deepEqual(ls.get("drafts"), {});
|
||||
|
|
|
@ -10,7 +10,7 @@ function mkdir_p(path) {
|
|||
try {
|
||||
fs.mkdirSync(path);
|
||||
} catch (e) {
|
||||
if ( e.code !== 'EEXIST' ) {
|
||||
if (e.code !== 'EEXIST') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -646,7 +646,7 @@ exports.initialize = function () {
|
|||
clone_file_input = $('#file_input').clone(true);
|
||||
}
|
||||
$("#compose #file_input").trigger("click");
|
||||
} );
|
||||
});
|
||||
|
||||
function show_preview(rendered_content) {
|
||||
var preview_html;
|
||||
|
|
|
@ -53,14 +53,14 @@ function query_matches_person(query, person) {
|
|||
// Case-insensitive.
|
||||
query = query.toLowerCase();
|
||||
|
||||
return ( person.email .toLowerCase().indexOf(query) !== -1
|
||||
return (person.email.toLowerCase().indexOf(query) !== -1
|
||||
|| person.full_name.toLowerCase().indexOf(query) !== -1);
|
||||
}
|
||||
|
||||
function query_matches_stream(query, stream) {
|
||||
query = query.toLowerCase();
|
||||
|
||||
return ( stream.name .toLowerCase().indexOf(query) !== -1
|
||||
return (stream.name.toLowerCase().indexOf(query) !== -1
|
||||
|| stream.description.toLowerCase().indexOf(query) !== -1);
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ exports.initialize = function () {
|
|||
}
|
||||
|
||||
// limit number of items so the list doesn't fall off the screen
|
||||
$( "#stream" ).typeahead({
|
||||
$("#stream").typeahead({
|
||||
source: function () {
|
||||
return stream_data.subscribed_streams();
|
||||
},
|
||||
|
@ -510,7 +510,7 @@ exports.initialize = function () {
|
|||
},
|
||||
});
|
||||
|
||||
$( "#subject" ).typeahead({
|
||||
$("#subject").typeahead({
|
||||
source: function () {
|
||||
var stream_name = $("#stream").val();
|
||||
return exports.topics_seen_for(stream_name);
|
||||
|
@ -529,7 +529,7 @@ exports.initialize = function () {
|
|||
},
|
||||
});
|
||||
|
||||
$( "#private_message_recipient" ).typeahead({
|
||||
$("#private_message_recipient").typeahead({
|
||||
source: people.get_all_persons, // This is a function.
|
||||
items: 5,
|
||||
dropup: true,
|
||||
|
@ -572,7 +572,7 @@ exports.initialize = function () {
|
|||
|
||||
exports.initialize_compose_typeahead("#new_message_content", {mention: true, emoji: true, stream: true, syntax: true});
|
||||
|
||||
$( "#private_message_recipient" ).blur(function () {
|
||||
$("#private_message_recipient").blur(function () {
|
||||
var val = $(this).val();
|
||||
var recipients = typeahead_helper.get_cleaned_pm_recipients(val);
|
||||
$(this).val(recipients.join(", "));
|
||||
|
|
|
@ -70,7 +70,8 @@ exports.initialize = function () {
|
|||
},
|
||||
success: function () {
|
||||
$('#submit-invitation').button('reset');
|
||||
invite_status.text(i18n.t('User invited successfully.', {count: (invitee_emails.val().match(/@/g) || [] ).length}))
|
||||
invite_status.text(i18n.t('User invited successfully.',
|
||||
{count: (invitee_emails.val().match(/@/g) || []).length}))
|
||||
.addClass('alert-success')
|
||||
.show();
|
||||
invitee_emails.val('');
|
||||
|
|
|
@ -305,7 +305,7 @@ function edit_message(row, raw_content) {
|
|||
|
||||
if (feature_flags.propagate_topic_edits && !message.locally_echoed) {
|
||||
var original_topic = message.subject;
|
||||
message_edit_topic.keyup( function () {
|
||||
message_edit_topic.keyup(function () {
|
||||
var new_topic = message_edit_topic.val();
|
||||
message_edit_topic_propagate.toggle(new_topic !== original_topic && new_topic !== "");
|
||||
});
|
||||
|
|
|
@ -666,7 +666,7 @@ exports.MessageList.prototype = {
|
|||
var index = self._items.indexOf(current_message);
|
||||
|
||||
if (index === -1) {
|
||||
if ( !self.muting_enabled && current_msg_list === self) {
|
||||
if (!self.muting_enabled && current_msg_list === self) {
|
||||
blueslip.error("Trying to re-order message but can't find message with new_id in _items!");
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -69,9 +69,9 @@ exports.activate = function (raw_operators, opts) {
|
|||
}
|
||||
} else if (filter.has_operator("is")) {
|
||||
exports.narrow_title = filter.operands("is")[0];
|
||||
} else if (filter.has_operator("pm-with") ) {
|
||||
} else if (filter.has_operator("pm-with")) {
|
||||
exports.narrow_title = "private";
|
||||
} else if (filter.has_operator("group-pm-with") ) {
|
||||
} else if (filter.has_operator("group-pm-with")) {
|
||||
exports.narrow_title = "private group";
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ exports.open_modal = function (name) {
|
|||
|
||||
exports.close_overlay = function (name) {
|
||||
if (name !== open_overlay_name) {
|
||||
blueslip.error("Trying to close " + name + " when " + open_overlay_name + " is open." );
|
||||
blueslip.error("Trying to close " + name + " when " + open_overlay_name + " is open.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ exports.close_overlay = function (name) {
|
|||
$('.header').attr("aria-hidden", "false");
|
||||
|
||||
if (!close_handler) {
|
||||
blueslip.error("Overlay close handler for " + name + " not properly setup." );
|
||||
blueslip.error("Overlay close handler for " + name + " not properly setup.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ exports.close_modal = function (name) {
|
|||
|
||||
if (exports.active_modal() !== name) {
|
||||
blueslip.error("Trying to close " + name +
|
||||
" modal when " + exports.active_modal() + " is open." );
|
||||
" modal when " + exports.active_modal() + " is open.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ var exports = {};
|
|||
*/
|
||||
function convert_from_raw(digits, part_length, raw) {
|
||||
var result = '';
|
||||
for (var i = 0; i < raw.length; ) {
|
||||
for (var i = 0; i < raw.length;) {
|
||||
var t = 0;
|
||||
for (var j = 0; j < part_length; j += 1) {
|
||||
t = t * digits.length + digits.indexOf(raw.charAt(i));
|
||||
|
|
|
@ -45,7 +45,7 @@ exports.initialize = function () {
|
|||
// just represents the key of the hash, so it's redundant.)
|
||||
var search_object = {};
|
||||
|
||||
$( "#search_query" ).typeahead({
|
||||
$("#search_query").typeahead({
|
||||
source: function (query) {
|
||||
var suggestions = search_suggestion.get_suggestions(query);
|
||||
// Update our global search_object hash
|
||||
|
|
|
@ -111,7 +111,7 @@ function get_stream_suggestions(last, operators) {
|
|||
}
|
||||
|
||||
function get_group_suggestions(all_persons, last, operators) {
|
||||
if (last.operator !== 'pm-with' ) {
|
||||
if (last.operator !== 'pm-with') {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ $(function () {
|
|||
var max_scroll = this.scrollHeight - self.innerHeight() - 1;
|
||||
|
||||
e.stopPropagation();
|
||||
if ( ((delta < 0) && (scroll <= 0))
|
||||
|| ((delta > 0) && (scroll >= max_scroll))) {
|
||||
if (((delta < 0) && (scroll <= 0)) ||
|
||||
((delta > 0) && (scroll >= max_scroll))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue