mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	eslint: Fix unicorn/prefer-set-has.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-set-has.md Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							de791b82b6
						
					
				
				
					commit
					b178fc6069
				
			@@ -923,10 +923,10 @@ run_test("initialize", () => {
 | 
				
			|||||||
    initialize();
 | 
					    initialize();
 | 
				
			||||||
    assert(!stream_data.is_filtering_inactives());
 | 
					    assert(!stream_data.is_filtering_inactives());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const stream_names = stream_data.get_streams_for_admin().map((elem) => elem.name);
 | 
					    const stream_names = new Set(stream_data.get_streams_for_admin().map((elem) => elem.name));
 | 
				
			||||||
    assert(stream_names.includes("subscriptions"));
 | 
					    assert(stream_names.has("subscriptions"));
 | 
				
			||||||
    assert(stream_names.includes("unsubscribed"));
 | 
					    assert(stream_names.has("unsubscribed"));
 | 
				
			||||||
    assert(stream_names.includes("never_subscribed"));
 | 
					    assert(stream_names.has("never_subscribed"));
 | 
				
			||||||
    assert.equal(stream_data.get_notifications_stream(), "");
 | 
					    assert.equal(stream_data.get_notifications_stream(), "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Simulate a private stream the user isn't subscribed to
 | 
					    // Simulate a private stream the user isn't subscribed to
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ function do_narrow_action(action) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// For message actions and user profile menu.
 | 
					// For message actions and user profile menu.
 | 
				
			||||||
const menu_dropdown_hotkeys = ["down_arrow", "up_arrow", "vim_up", "vim_down", "enter"];
 | 
					const menu_dropdown_hotkeys = new Set(["down_arrow", "up_arrow", "vim_up", "vim_down", "enter"]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Note that multiple keys can map to the same event_name, which
 | 
					// Note that multiple keys can map to the same event_name, which
 | 
				
			||||||
// we'll do in cases where they have the exact same semantics.
 | 
					// we'll do in cases where they have the exact same semantics.
 | 
				
			||||||
@@ -573,7 +573,7 @@ exports.process_hotkey = function (e, hotkey) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (menu_dropdown_hotkeys.includes(event_name)) {
 | 
					    if (menu_dropdown_hotkeys.has(event_name)) {
 | 
				
			||||||
        if (popovers.actions_popped()) {
 | 
					        if (popovers.actions_popped()) {
 | 
				
			||||||
            popovers.actions_menu_handle_keyboard(event_name);
 | 
					            popovers.actions_menu_handle_keyboard(event_name);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,8 +130,8 @@ function get_messages_success(data, opts) {
 | 
				
			|||||||
// or convert the emails string to user IDs directly into the Filter code
 | 
					// or convert the emails string to user IDs directly into the Filter code
 | 
				
			||||||
// because doing so breaks the app in various modules that expect emails string.
 | 
					// because doing so breaks the app in various modules that expect emails string.
 | 
				
			||||||
function handle_operators_supporting_id_based_api(data) {
 | 
					function handle_operators_supporting_id_based_api(data) {
 | 
				
			||||||
    const operators_supporting_ids = ["pm-with"];
 | 
					    const operators_supporting_ids = new Set(["pm-with"]);
 | 
				
			||||||
    const operators_supporting_id = ["sender", "group-pm-with", "stream"];
 | 
					    const operators_supporting_id = new Set(["sender", "group-pm-with", "stream"]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (data.narrow === undefined) {
 | 
					    if (data.narrow === undefined) {
 | 
				
			||||||
        return data;
 | 
					        return data;
 | 
				
			||||||
@@ -139,11 +139,11 @@ function handle_operators_supporting_id_based_api(data) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    data.narrow = JSON.parse(data.narrow);
 | 
					    data.narrow = JSON.parse(data.narrow);
 | 
				
			||||||
    data.narrow = data.narrow.map((filter) => {
 | 
					    data.narrow = data.narrow.map((filter) => {
 | 
				
			||||||
        if (operators_supporting_ids.includes(filter.operator)) {
 | 
					        if (operators_supporting_ids.has(filter.operator)) {
 | 
				
			||||||
            filter.operand = people.emails_strings_to_user_ids_array(filter.operand);
 | 
					            filter.operand = people.emails_strings_to_user_ids_array(filter.operand);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (operators_supporting_id.includes(filter.operator)) {
 | 
					        if (operators_supporting_id.has(filter.operator)) {
 | 
				
			||||||
            if (filter.operator === "stream") {
 | 
					            if (filter.operator === "stream") {
 | 
				
			||||||
                const stream_id = stream_data.get_stream_id(filter.operand);
 | 
					                const stream_id = stream_data.get_stream_id(filter.operand);
 | 
				
			||||||
                if (stream_id !== undefined) {
 | 
					                if (stream_id !== undefined) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ export function detect_user_os() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export function activate_correct_tab($codeSection) {
 | 
					export function activate_correct_tab($codeSection) {
 | 
				
			||||||
    const user_os = detect_user_os();
 | 
					    const user_os = detect_user_os();
 | 
				
			||||||
    const desktop_os = ["mac", "linux", "windows"];
 | 
					    const desktop_os = new Set(["mac", "linux", "windows"]);
 | 
				
			||||||
    const $li = $codeSection.find("ul.nav li");
 | 
					    const $li = $codeSection.find("ul.nav li");
 | 
				
			||||||
    const $blocks = $codeSection.find(".blocks div");
 | 
					    const $blocks = $codeSection.find(".blocks div");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -30,7 +30,7 @@ export function activate_correct_tab($codeSection) {
 | 
				
			|||||||
            $(this).addClass("active");
 | 
					            $(this).addClass("active");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (desktop_os.includes(user_os) && language === "desktop-web") {
 | 
					        if (desktop_os.has(user_os) && language === "desktop-web") {
 | 
				
			||||||
            $(this).addClass("active");
 | 
					            $(this).addClass("active");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
@@ -42,7 +42,7 @@ export function activate_correct_tab($codeSection) {
 | 
				
			|||||||
            $(this).addClass("active");
 | 
					            $(this).addClass("active");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (desktop_os.includes(user_os) && language === "desktop-web") {
 | 
					        if (desktop_os.has(user_os) && language === "desktop-web") {
 | 
				
			||||||
            $(this).addClass("active");
 | 
					            $(this).addClass("active");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,9 +36,9 @@ function convert_from_raw(digits, part_length, raw) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Isolate initiator characters. */
 | 
					/** Isolate initiator characters. */
 | 
				
			||||||
const i_chars = [0x2066, 0x2067, 0x2068];
 | 
					const i_chars = new Set([0x2066, 0x2067, 0x2068]);
 | 
				
			||||||
/** Pop directional isolate character. */
 | 
					/** Pop directional isolate character. */
 | 
				
			||||||
const pdi_chars = [0x2069];
 | 
					const pdi_chars = new Set([0x2069]);
 | 
				
			||||||
/** The digits that are used for base conversions from base 92. */
 | 
					/** The digits that are used for base conversions from base 92. */
 | 
				
			||||||
const digits =
 | 
					const digits =
 | 
				
			||||||
    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[]^_`{|}~';
 | 
					    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[]^_`{|}~';
 | 
				
			||||||
@@ -86,10 +86,10 @@ const lr_ranges = convert_from_raw(
 | 
				
			|||||||
 * @returns {'I' | 'PDI' | 'R' | 'L' | 'Other'}
 | 
					 * @returns {'I' | 'PDI' | 'R' | 'L' | 'Other'}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function get_bidi_class(ch) {
 | 
					function get_bidi_class(ch) {
 | 
				
			||||||
    if (i_chars.includes(ch)) {
 | 
					    if (i_chars.has(ch)) {
 | 
				
			||||||
        return "I"; // LRI, RLI, FSI
 | 
					        return "I"; // LRI, RLI, FSI
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (pdi_chars.includes(ch)) {
 | 
					    if (pdi_chars.has(ch)) {
 | 
				
			||||||
        return "PDI";
 | 
					        return "PDI";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    let i = util.lower_bound(rl_ranges, ch);
 | 
					    let i = util.lower_bound(rl_ranges, ch);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user