diff --git a/.eslintrc.json b/.eslintrc.json index ec3b1cdd7a..aa69543962 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -223,6 +223,12 @@ "functions": "never" } ], + "comma-spacing": [ "error", + { + "before": false, + "after": true + } + ], "complexity": [ 0, 4 ], "curly": 2, "dot-notation": [ "error", { "allowKeywords": true } ], diff --git a/static/js/alert_words.js b/static/js/alert_words.js index 67960e63c2..e5a9045f90 100644 --- a/static/js/alert_words.js +++ b/static/js/alert_words.js @@ -28,7 +28,7 @@ exports.process_message = function (message) { var regex = new RegExp('(' + before_punctuation + ')' + '(' + clean + ')' + - '(' + after_punctuation + ')' , 'ig'); + '(' + after_punctuation + ')', 'ig'); message.content = message.content.replace(regex, function (match, before, word, after, offset, content) { // Logic for ensuring that we don't muck up rendered HTML. diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 5edaffc5e1..828c723829 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -220,7 +220,7 @@ exports.initialize = function () { e.stopPropagation(); popovers.hide_all(); }); - $('body').on('click','.always_visible_topic_edit,.on_hover_topic_edit', function (e) { + $('body').on('click', '.always_visible_topic_edit,.on_hover_topic_edit', function (e) { var recipient_row = $(this).closest(".recipient_row"); message_edit.start_topic_edit(recipient_row); e.stopPropagation(); diff --git a/static/js/colorspace.js b/static/js/colorspace.js index dac068be39..06f71d052e 100644 --- a/static/js/colorspace.js +++ b/static/js/colorspace.js @@ -36,9 +36,9 @@ exports.luminance_to_lightness = function (luminance) { }; exports.getDecimalColor = function (hexcolor) { - return {r: parseInt(hexcolor.substr(1,2), 16), - g: parseInt(hexcolor.substr(3,2), 16), - b: parseInt(hexcolor.substr(5,2), 16)}; + return {r: parseInt(hexcolor.substr(1, 2), 16), + g: parseInt(hexcolor.substr(3, 2), 16), + b: parseInt(hexcolor.substr(5, 2), 16)}; }; exports.getLighterColor = function (rgb, lightness) { diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index 5e8059c170..a848115339 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -319,7 +319,7 @@ exports.compose_content_begins_typeahead = function (query) { } // Start syntax highlighting autocompleter if the first three characters are ``` - var syntax_token = current_token.substring(0,3); + var syntax_token = current_token.substring(0, 3); if (this.options.completions.syntax && (syntax_token === '```' || syntax_token === "~~~")) { // Only autocomplete if user starts typing a language after ``` if (current_token.length === 3) { diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js index 4e0d211c8a..c5304c3d47 100644 --- a/static/js/copy_and_paste.js +++ b/static/js/copy_and_paste.js @@ -165,7 +165,7 @@ function copy_handler() { selection.addRange(range); }); $('#copytempdiv').remove(); - },0); + }, 0); } exports.paste_handler_converter = function (paste_html) { diff --git a/static/js/drafts.js b/static/js/drafts.js index edeae618a9..466583eb4c 100644 --- a/static/js/drafts.js +++ b/static/js/drafts.js @@ -206,7 +206,7 @@ exports.setup_page = function (callback) { _.each(data, function (draft, id) { data_array.push([id, data[id]]); }); - var data_sorted = data_array.sort(function (draft_a,draft_b) { + var data_sorted = data_array.sort(function (draft_a, draft_b) { return draft_a[1].updatedAt - draft_b[1].updatedAt; }); _.each(data_sorted, function (data_element) { @@ -279,7 +279,7 @@ exports.setup_page = function (callback) { function populate_and_fill() { $('#drafts_table').empty(); var drafts = format_drafts(draft_model.get()); - var rendered = templates.render('draft_table_body',{ + var rendered = templates.render('draft_table_body', { drafts: drafts, draft_lifetime: DRAFT_LIFETIME, }); diff --git a/static/js/filter.js b/static/js/filter.js index 0b47c94318..496ee9f72d 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -234,7 +234,7 @@ function encodeOperand(operand) { function decodeOperand(encoded, operator) { encoded = encoded.replace(/"/g, ''); - if (_.contains(['group-pm-with','pm-with','sender','from'],operator) === false) { + if (_.contains(['group-pm-with', 'pm-with', 'sender', 'from'], operator) === false) { encoded = encoded.replace(/\+/g, ' '); } return util.robust_uri_decode(encoded).trim(); diff --git a/static/js/people.js b/static/js/people.js index d1551ad747..3faaf6459a 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -744,10 +744,10 @@ function remove_diacritics(s) { return s; } - return s.replace(/[áàãâä]/g,"a") - .replace(/[éèëê]/g,"e") - .replace(/[íìïî]/g,"i") - .replace(/[óòöôõ]/g,"o") + return s.replace(/[áàãâä]/g, "a") + .replace(/[éèëê]/g, "e") + .replace(/[íìïî]/g, "i") + .replace(/[óòöôõ]/g, "o") .replace(/[úùüû]/g, "u") .replace(/[ç]/g, "c") .replace(/[ñ]/g, "n"); @@ -840,7 +840,7 @@ exports.track_duplicate_full_name = function (full_name, user_id, to_remove) { if (to_remove && user_id && ids.has(user_id)) { ids.del(user_id); } - duplicate_full_name_data.set(full_name,ids); + duplicate_full_name_data.set(full_name, ids); }; exports.is_duplicate_full_name = function (full_name) { diff --git a/static/js/resize.js b/static/js/resize.js index 1fb2b106b6..e5f9511910 100644 --- a/static/js/resize.js +++ b/static/js/resize.js @@ -77,12 +77,12 @@ function get_new_heights() { var usable_height = res.right_sidebar_height - $("#feedback_section").safeOuterHeight(true) - - parseInt(buddy_list_wrapper.css("marginTop"),10) + - parseInt(buddy_list_wrapper.css("marginTop"), 10) - parseInt(buddy_list_wrapper.css("marginBottom"), 10) - $("#userlist-header").safeOuterHeight(true) - $(".user-list-filter").safeOuterHeight(true) - invite_user_link_height - - parseInt(group_pms.css("marginTop"),10) + - parseInt(group_pms.css("marginTop"), 10) - parseInt(group_pms.css("marginBottom"), 10) - $("#group-pm-header").safeOuterHeight(true) - keyboard_popover_shortcut.safeOuterHeight(true) @@ -121,8 +121,8 @@ function left_userlist_get_new_heights() { res.main_div_min_height = viewport_height - top_navbar_height; res.bottom_sidebar_height = viewport_height - - parseInt($("#left-sidebar").css("marginTop"),10) - - parseInt($(".bottom_sidebar").css("marginTop"),10); + - parseInt($("#left-sidebar").css("marginTop"), 10) + - parseInt($(".bottom_sidebar").css("marginTop"), 10); res.total_leftlist_height = res.bottom_sidebar_height @@ -131,7 +131,7 @@ function left_userlist_get_new_heights() { - $("#userlist-header").safeOuterHeight(true) - $(".user-list-filter").safeOuterHeight(true) - $("#group-pm-header").safeOuterHeight(true) - - parseInt(stream_filters.css("marginBottom"),10) + - parseInt(stream_filters.css("marginBottom"), 10) - parseInt(buddy_list_wrapper.css("marginTop"), 10) - parseInt(buddy_list_wrapper.css("marginBottom"), 10) - parseInt(group_pms.css("marginTop"), 10) diff --git a/static/js/search.js b/static/js/search.js index 81b60b15f5..12548f936b 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -163,7 +163,7 @@ exports.initialize = function () { $('#search_exit').on('click', narrow.deactivate); search_query_box.on('focus', exports.focus_search); - search_query_box.on('blur' , function () { + search_query_box.on('blur', function () { // The search query box is a visual cue as to // whether search or narrowing is active. If // the user blurs the search box, then we should diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 1de73d24ca..9c2ba932f8 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -458,7 +458,7 @@ exports.set_up = function () { } }); - $("#do_deactivate_self_button").on('click',function () { + $("#do_deactivate_self_button").on('click', function () { $("#do_deactivate_self_button .loader").css('display', 'inline-block'); $("#do_deactivate_self_button span").hide(); $("#do_deactivate_self_button object").on("load", function () { diff --git a/static/js/settings_org.js b/static/js/settings_org.js index f1ea4fc856..981680329f 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -605,7 +605,7 @@ exports.set_up = function () { subsection.find('.save-button').show(); var properties_elements = get_subsection_property_elements(subsection); var show_change_process_button = false; - _.each(properties_elements , function (elem) { + _.each(properties_elements, function (elem) { if (check_property_changed(elem)) { show_change_process_button = true; } diff --git a/static/js/settings_profile_fields.js b/static/js/settings_profile_fields.js index d28ca7e93c..0c5e8f37ac 100644 --- a/static/js/settings_profile_fields.js +++ b/static/js/settings_profile_fields.js @@ -181,7 +181,7 @@ function open_edit_form(e) { profile_field.row.hide(); profile_field.form.show(); - var field = get_profile_field(parseInt(field_id,10)); + var field = get_profile_field(parseInt(field_id, 10)); // Set initial value in edit form profile_field.form.find('input[name=name]').val(field.name); profile_field.form.find('input[name=hint]').val(field.hint); diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.js index aebf2e2e75..7582d5446a 100644 --- a/static/js/settings_user_groups.js +++ b/static/js/settings_user_groups.js @@ -61,10 +61,10 @@ exports.populate_user_groups = function () { if (exports.can_edit(group_id)) { return; } - userg.find('.name').attr('contenteditable','false'); - userg.find('.description').attr('contenteditable','false'); + userg.find('.name').attr('contenteditable', 'false'); + userg.find('.description').attr('contenteditable', 'false'); userg.addClass('ntm'); - pill_container.find('.input').attr('contenteditable','false'); + pill_container.find('.input').attr('contenteditable', 'false'); pill_container.find('.input').css('display', 'none'); pill_container.addClass('not-editable'); pill_container.off('keydown', '.pill'); diff --git a/static/js/stream_data.js b/static/js/stream_data.js index 92cc555793..3fefdb2f63 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -506,7 +506,7 @@ exports.get_streams_for_settings_page = function () { var unsubscribed_rows = exports.unsubscribed_subs(); // Sort and combine all our streams. - function by_name(a,b) { + function by_name(a, b) { return util.strcmp(a.name, b.name); } subscribed_rows.sort(by_name); @@ -544,7 +544,7 @@ exports.sort_for_stream_settings = function (stream_ids) { exports.get_streams_for_admin = function () { // Sort and combine all our streams. - function by_name(a,b) { + function by_name(a, b) { return util.strcmp(a.name, b.name); }