mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	lint: Add eslint enforcement for comma-spacing.
We've been enforcing this manually for a long time, and hadn't realized it was missing from our eslint configuration.
This commit is contained in:
		@@ -223,6 +223,12 @@
 | 
				
			|||||||
                "functions": "never"
 | 
					                "functions": "never"
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
 | 
					        "comma-spacing": [ "error",
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "before": false,
 | 
				
			||||||
 | 
					                "after": true
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        "complexity": [ 0, 4 ],
 | 
					        "complexity": [ 0, 4 ],
 | 
				
			||||||
        "curly": 2,
 | 
					        "curly": 2,
 | 
				
			||||||
        "dot-notation": [ "error", { "allowKeywords": true } ],
 | 
					        "dot-notation": [ "error", { "allowKeywords": true } ],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ exports.process_message = function (message) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        var regex = new RegExp('(' + before_punctuation + ')' +
 | 
					        var regex = new RegExp('(' + before_punctuation + ')' +
 | 
				
			||||||
                               '(' + clean + ')' +
 | 
					                               '(' + clean + ')' +
 | 
				
			||||||
                               '(' + after_punctuation + ')' , 'ig');
 | 
					                               '(' + after_punctuation + ')', 'ig');
 | 
				
			||||||
        message.content = message.content.replace(regex, function (match, before, word,
 | 
					        message.content = message.content.replace(regex, function (match, before, word,
 | 
				
			||||||
                                                                   after, offset, content) {
 | 
					                                                                   after, offset, content) {
 | 
				
			||||||
            // Logic for ensuring that we don't muck up rendered HTML.
 | 
					            // Logic for ensuring that we don't muck up rendered HTML.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -220,7 +220,7 @@ exports.initialize = function () {
 | 
				
			|||||||
        e.stopPropagation();
 | 
					        e.stopPropagation();
 | 
				
			||||||
        popovers.hide_all();
 | 
					        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");
 | 
					        var recipient_row = $(this).closest(".recipient_row");
 | 
				
			||||||
        message_edit.start_topic_edit(recipient_row);
 | 
					        message_edit.start_topic_edit(recipient_row);
 | 
				
			||||||
        e.stopPropagation();
 | 
					        e.stopPropagation();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,9 +36,9 @@ exports.luminance_to_lightness = function (luminance) {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.getDecimalColor = function (hexcolor) {
 | 
					exports.getDecimalColor = function (hexcolor) {
 | 
				
			||||||
    return {r: parseInt(hexcolor.substr(1,2), 16),
 | 
					    return {r: parseInt(hexcolor.substr(1, 2), 16),
 | 
				
			||||||
            g: parseInt(hexcolor.substr(3,2), 16),
 | 
					            g: parseInt(hexcolor.substr(3, 2), 16),
 | 
				
			||||||
            b: parseInt(hexcolor.substr(5,2), 16)};
 | 
					            b: parseInt(hexcolor.substr(5, 2), 16)};
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.getLighterColor = function (rgb, lightness) {
 | 
					exports.getLighterColor = function (rgb, lightness) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -319,7 +319,7 @@ exports.compose_content_begins_typeahead = function (query) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Start syntax highlighting autocompleter if the first three characters are ```
 | 
					    // 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 === "~~~")) {
 | 
					    if (this.options.completions.syntax && (syntax_token === '```' || syntax_token === "~~~")) {
 | 
				
			||||||
        // Only autocomplete if user starts typing a language after ```
 | 
					        // Only autocomplete if user starts typing a language after ```
 | 
				
			||||||
        if (current_token.length === 3) {
 | 
					        if (current_token.length === 3) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,7 +165,7 @@ function copy_handler() {
 | 
				
			|||||||
            selection.addRange(range);
 | 
					            selection.addRange(range);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        $('#copytempdiv').remove();
 | 
					        $('#copytempdiv').remove();
 | 
				
			||||||
    },0);
 | 
					    }, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.paste_handler_converter = function (paste_html) {
 | 
					exports.paste_handler_converter = function (paste_html) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -206,7 +206,7 @@ exports.setup_page = function (callback) {
 | 
				
			|||||||
        _.each(data, function (draft, id) {
 | 
					        _.each(data, function (draft, id) {
 | 
				
			||||||
            data_array.push([id, data[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;
 | 
					            return draft_a[1].updatedAt - draft_b[1].updatedAt;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        _.each(data_sorted, function (data_element) {
 | 
					        _.each(data_sorted, function (data_element) {
 | 
				
			||||||
@@ -279,7 +279,7 @@ exports.setup_page = function (callback) {
 | 
				
			|||||||
    function populate_and_fill() {
 | 
					    function populate_and_fill() {
 | 
				
			||||||
        $('#drafts_table').empty();
 | 
					        $('#drafts_table').empty();
 | 
				
			||||||
        var drafts = format_drafts(draft_model.get());
 | 
					        var drafts = format_drafts(draft_model.get());
 | 
				
			||||||
        var rendered = templates.render('draft_table_body',{
 | 
					        var rendered = templates.render('draft_table_body', {
 | 
				
			||||||
            drafts: drafts,
 | 
					            drafts: drafts,
 | 
				
			||||||
            draft_lifetime: DRAFT_LIFETIME,
 | 
					            draft_lifetime: DRAFT_LIFETIME,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -234,7 +234,7 @@ function encodeOperand(operand) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function decodeOperand(encoded, operator) {
 | 
					function decodeOperand(encoded, operator) {
 | 
				
			||||||
    encoded = encoded.replace(/"/g, '');
 | 
					    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, ' ');
 | 
					        encoded = encoded.replace(/\+/g, ' ');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return util.robust_uri_decode(encoded).trim();
 | 
					    return util.robust_uri_decode(encoded).trim();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -744,10 +744,10 @@ function remove_diacritics(s) {
 | 
				
			|||||||
        return s;
 | 
					        return s;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return s.replace(/[áàãâä]/g,"a")
 | 
					    return s.replace(/[áàãâä]/g, "a")
 | 
				
			||||||
        .replace(/[éèëê]/g,"e")
 | 
					        .replace(/[éèëê]/g, "e")
 | 
				
			||||||
        .replace(/[íìïî]/g,"i")
 | 
					        .replace(/[íìïî]/g, "i")
 | 
				
			||||||
        .replace(/[óòöôõ]/g,"o")
 | 
					        .replace(/[óòöôõ]/g, "o")
 | 
				
			||||||
        .replace(/[úùüû]/g, "u")
 | 
					        .replace(/[úùüû]/g, "u")
 | 
				
			||||||
        .replace(/[ç]/g, "c")
 | 
					        .replace(/[ç]/g, "c")
 | 
				
			||||||
        .replace(/[ñ]/g, "n");
 | 
					        .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)) {
 | 
					    if (to_remove && user_id && ids.has(user_id)) {
 | 
				
			||||||
        ids.del(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) {
 | 
					exports.is_duplicate_full_name = function (full_name) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,12 +77,12 @@ function get_new_heights() {
 | 
				
			|||||||
    var usable_height =
 | 
					    var usable_height =
 | 
				
			||||||
        res.right_sidebar_height
 | 
					        res.right_sidebar_height
 | 
				
			||||||
        - $("#feedback_section").safeOuterHeight(true)
 | 
					        - $("#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)
 | 
					        - parseInt(buddy_list_wrapper.css("marginBottom"), 10)
 | 
				
			||||||
        - $("#userlist-header").safeOuterHeight(true)
 | 
					        - $("#userlist-header").safeOuterHeight(true)
 | 
				
			||||||
        - $(".user-list-filter").safeOuterHeight(true)
 | 
					        - $(".user-list-filter").safeOuterHeight(true)
 | 
				
			||||||
        - invite_user_link_height
 | 
					        - invite_user_link_height
 | 
				
			||||||
        - parseInt(group_pms.css("marginTop"),10)
 | 
					        - parseInt(group_pms.css("marginTop"), 10)
 | 
				
			||||||
        - parseInt(group_pms.css("marginBottom"), 10)
 | 
					        - parseInt(group_pms.css("marginBottom"), 10)
 | 
				
			||||||
        - $("#group-pm-header").safeOuterHeight(true)
 | 
					        - $("#group-pm-header").safeOuterHeight(true)
 | 
				
			||||||
        - keyboard_popover_shortcut.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.main_div_min_height = viewport_height - top_navbar_height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.bottom_sidebar_height = viewport_height
 | 
					    res.bottom_sidebar_height = viewport_height
 | 
				
			||||||
                                - parseInt($("#left-sidebar").css("marginTop"),10)
 | 
					                                - parseInt($("#left-sidebar").css("marginTop"), 10)
 | 
				
			||||||
                                - parseInt($(".bottom_sidebar").css("marginTop"),10);
 | 
					                                - parseInt($(".bottom_sidebar").css("marginTop"), 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.total_leftlist_height = res.bottom_sidebar_height
 | 
					    res.total_leftlist_height = res.bottom_sidebar_height
 | 
				
			||||||
@@ -131,7 +131,7 @@ function left_userlist_get_new_heights() {
 | 
				
			|||||||
                                - $("#userlist-header").safeOuterHeight(true)
 | 
					                                - $("#userlist-header").safeOuterHeight(true)
 | 
				
			||||||
                                - $(".user-list-filter").safeOuterHeight(true)
 | 
					                                - $(".user-list-filter").safeOuterHeight(true)
 | 
				
			||||||
                                - $("#group-pm-header").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("marginTop"), 10)
 | 
				
			||||||
                                - parseInt(buddy_list_wrapper.css("marginBottom"), 10)
 | 
					                                - parseInt(buddy_list_wrapper.css("marginBottom"), 10)
 | 
				
			||||||
                                - parseInt(group_pms.css("marginTop"), 10)
 | 
					                                - parseInt(group_pms.css("marginTop"), 10)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -163,7 +163,7 @@ exports.initialize = function () {
 | 
				
			|||||||
    $('#search_exit').on('click', narrow.deactivate);
 | 
					    $('#search_exit').on('click', narrow.deactivate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    search_query_box.on('focus', exports.focus_search);
 | 
					    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
 | 
					        // The search query box is a visual cue as to
 | 
				
			||||||
        // whether search or narrowing is active.  If
 | 
					        // whether search or narrowing is active.  If
 | 
				
			||||||
        // the user blurs the search box, then we should
 | 
					        // the user blurs the search box, then we should
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 .loader").css('display', 'inline-block');
 | 
				
			||||||
        $("#do_deactivate_self_button span").hide();
 | 
					        $("#do_deactivate_self_button span").hide();
 | 
				
			||||||
        $("#do_deactivate_self_button object").on("load", function () {
 | 
					        $("#do_deactivate_self_button object").on("load", function () {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -605,7 +605,7 @@ exports.set_up = function () {
 | 
				
			|||||||
        subsection.find('.save-button').show();
 | 
					        subsection.find('.save-button').show();
 | 
				
			||||||
        var properties_elements = get_subsection_property_elements(subsection);
 | 
					        var properties_elements = get_subsection_property_elements(subsection);
 | 
				
			||||||
        var show_change_process_button = false;
 | 
					        var show_change_process_button = false;
 | 
				
			||||||
        _.each(properties_elements , function (elem) {
 | 
					        _.each(properties_elements, function (elem) {
 | 
				
			||||||
            if (check_property_changed(elem)) {
 | 
					            if (check_property_changed(elem)) {
 | 
				
			||||||
                show_change_process_button = true;
 | 
					                show_change_process_button = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -181,7 +181,7 @@ function open_edit_form(e) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    profile_field.row.hide();
 | 
					    profile_field.row.hide();
 | 
				
			||||||
    profile_field.form.show();
 | 
					    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
 | 
					    // Set initial value in edit form
 | 
				
			||||||
    profile_field.form.find('input[name=name]').val(field.name);
 | 
					    profile_field.form.find('input[name=name]').val(field.name);
 | 
				
			||||||
    profile_field.form.find('input[name=hint]').val(field.hint);
 | 
					    profile_field.form.find('input[name=hint]').val(field.hint);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,10 +61,10 @@ exports.populate_user_groups = function () {
 | 
				
			|||||||
            if (exports.can_edit(group_id)) {
 | 
					            if (exports.can_edit(group_id)) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            userg.find('.name').attr('contenteditable','false');
 | 
					            userg.find('.name').attr('contenteditable', 'false');
 | 
				
			||||||
            userg.find('.description').attr('contenteditable','false');
 | 
					            userg.find('.description').attr('contenteditable', 'false');
 | 
				
			||||||
            userg.addClass('ntm');
 | 
					            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.find('.input').css('display', 'none');
 | 
				
			||||||
            pill_container.addClass('not-editable');
 | 
					            pill_container.addClass('not-editable');
 | 
				
			||||||
            pill_container.off('keydown', '.pill');
 | 
					            pill_container.off('keydown', '.pill');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -506,7 +506,7 @@ exports.get_streams_for_settings_page = function () {
 | 
				
			|||||||
    var unsubscribed_rows = exports.unsubscribed_subs();
 | 
					    var unsubscribed_rows = exports.unsubscribed_subs();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Sort and combine all our streams.
 | 
					    // Sort and combine all our streams.
 | 
				
			||||||
    function by_name(a,b) {
 | 
					    function by_name(a, b) {
 | 
				
			||||||
        return util.strcmp(a.name, b.name);
 | 
					        return util.strcmp(a.name, b.name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    subscribed_rows.sort(by_name);
 | 
					    subscribed_rows.sort(by_name);
 | 
				
			||||||
@@ -544,7 +544,7 @@ exports.sort_for_stream_settings = function (stream_ids) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
exports.get_streams_for_admin = function () {
 | 
					exports.get_streams_for_admin = function () {
 | 
				
			||||||
    // Sort and combine all our streams.
 | 
					    // Sort and combine all our streams.
 | 
				
			||||||
    function by_name(a,b) {
 | 
					    function by_name(a, b) {
 | 
				
			||||||
        return util.strcmp(a.name, b.name);
 | 
					        return util.strcmp(a.name, b.name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user