mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	eslint: Fix unicorn/no-for-loop.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/no-for-loop.md Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							73a14bee6f
						
					
				
				
					commit
					de791b82b6
				
			| @@ -116,8 +116,8 @@ run_test("adjust_mac_shortcuts", () => { | ||||
|     }); | ||||
|  | ||||
|     $(".markdown_content").each = (f) => { | ||||
|         for (let key_id = 0; key_id < keys_elem_list.length; key_id += 1) { | ||||
|             f.call(keys_elem_list[key_id]); | ||||
|         for (const key_elem of keys_elem_list) { | ||||
|             f.call(key_elem); | ||||
|         } | ||||
|     }; | ||||
|     common.adjust_mac_shortcuts(".markdown_content"); | ||||
|   | ||||
| @@ -309,8 +309,8 @@ class CommonUtils { | ||||
|         } else if (type === "private") { | ||||
|             await page.keyboard.press("KeyX"); | ||||
|             const recipients = params.recipient.split(", "); | ||||
|             for (let i = 0; i < recipients.length; i += 1) { | ||||
|                 await this.pm_recipient.set(page, recipients[i]); | ||||
|             for (const recipient of recipients) { | ||||
|                 await this.pm_recipient.set(page, recipient); | ||||
|             } | ||||
|             delete params.recipient; | ||||
|         } else { | ||||
| @@ -353,8 +353,7 @@ class CommonUtils { | ||||
|     } | ||||
|  | ||||
|     async send_multiple_messages(page, msgs) { | ||||
|         for (let msg_index = 0; msg_index < msgs.length; msg_index += 1) { | ||||
|             const msg = msgs[msg_index]; | ||||
|         for (const msg of msgs) { | ||||
|             await this.send_message(page, msg.stream !== undefined ? "stream" : "private", msg); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -20,7 +20,7 @@ exports.first_visible_message = function (bar) { | ||||
|     const frb_top = frb_bottom - 25; | ||||
|     let result; | ||||
|  | ||||
|     for (let i = 0; i < messages.length; i += 1) { | ||||
|     for (const message_element of messages) { | ||||
|         // The details of this comparison function are sensitive, since we're | ||||
|         // balancing between three possible bugs: | ||||
|         // | ||||
| @@ -47,7 +47,7 @@ exports.first_visible_message = function (bar) { | ||||
|         // message_viewport.scrollTop() to set precise scrolling | ||||
|         // positions determines the value for date_bar_height_offset. | ||||
|  | ||||
|         let message = $(messages[i]); | ||||
|         let message = $(message_element); | ||||
|         const message_bottom = top_offset(message) + message.safeOuterHeight(); | ||||
|         const date_bar_height_offset = 10; | ||||
|  | ||||
|   | ||||
| @@ -328,8 +328,8 @@ function integration_events() { | ||||
|     $('#integration-search input[type="text"]').on("keypress", (e) => { | ||||
|         const integrations = $(".integration-lozenges").children().toArray(); | ||||
|         if (e.which === 13 && e.target.value !== "") { | ||||
|             for (let i = 0; i < integrations.length; i += 1) { | ||||
|                 const integration = $(integrations[i]).find(".integration-lozenge"); | ||||
|             for (const integration_element of integrations) { | ||||
|                 const integration = $(integration_element).find(".integration-lozenge"); | ||||
|  | ||||
|                 if ($(integration).css("display") !== "none") { | ||||
|                     $(integration).closest("a")[0].click(); | ||||
|   | ||||
| @@ -215,15 +215,7 @@ function get_profile_field_info(id) { | ||||
| } | ||||
|  | ||||
| function get_profile_field(id) { | ||||
|     const all_custom_fields = page_params.custom_profile_fields; | ||||
|     let field; | ||||
|     for (let i = 0; i < all_custom_fields.length; i += 1) { | ||||
|         if (all_custom_fields[i].id === id) { | ||||
|             field = all_custom_fields[i]; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     return field; | ||||
|     return page_params.custom_profile_fields.find((field) => field.id === id); | ||||
| } | ||||
|  | ||||
| exports.parse_field_choices_from_field_data = function (field_data) { | ||||
|   | ||||
| @@ -188,11 +188,11 @@ function populate_messages_sent_over_time(data) { | ||||
|             }); | ||||
|             const hover_text_ids = ["#hover_me", "#hover_human", "#hover_bot"]; | ||||
|             const hover_value_ids = ["#hover_me_value", "#hover_human_value", "#hover_bot_value"]; | ||||
|             for (let i = 0; i < values.length; i += 1) { | ||||
|                 if (values[i] !== null) { | ||||
|             for (const [i, value] of values.entries()) { | ||||
|                 if (value !== null) { | ||||
|                     document.querySelector(hover_text_ids[i]).style.display = "inline"; | ||||
|                     document.querySelector(hover_value_ids[i]).style.display = "inline"; | ||||
|                     document.querySelector(hover_value_ids[i]).textContent = values[i]; | ||||
|                     document.querySelector(hover_value_ids[i]).textContent = value; | ||||
|                 } else { | ||||
|                     document.querySelector(hover_text_ids[i]).style.display = "none"; | ||||
|                     document.querySelector(hover_value_ids[i]).style.display = "none"; | ||||
| @@ -737,10 +737,10 @@ function populate_number_of_users(data) { | ||||
|                 "#users_hover_15day_value", | ||||
|                 "#users_hover_all_time_value", | ||||
|             ]; | ||||
|             for (let i = 0; i < values.length; i += 1) { | ||||
|                 if (values[i] !== null) { | ||||
|             for (const [i, value] of values.entries()) { | ||||
|                 if (value !== null) { | ||||
|                     document.querySelector(hover_value_ids[i]).style.display = "inline"; | ||||
|                     document.querySelector(hover_value_ids[i]).textContent = values[i]; | ||||
|                     document.querySelector(hover_value_ids[i]).textContent = value; | ||||
|                 } else { | ||||
|                     document.querySelector(hover_value_ids[i]).style.display = "none"; | ||||
|                 } | ||||
| @@ -867,11 +867,11 @@ function populate_messages_read_over_time(data) { | ||||
|             }); | ||||
|             const read_hover_text_ids = ["#read_hover_me", "#read_hover_everyone"]; | ||||
|             const read_hover_value_ids = ["#read_hover_me_value", "#read_hover_everyone_value"]; | ||||
|             for (let i = 0; i < values.length; i += 1) { | ||||
|                 if (values[i] !== null) { | ||||
|             for (const [i, value] of values.entries()) { | ||||
|                 if (value !== null) { | ||||
|                     document.querySelector(read_hover_text_ids[i]).style.display = "inline"; | ||||
|                     document.querySelector(read_hover_value_ids[i]).style.display = "inline"; | ||||
|                     document.querySelector(read_hover_value_ids[i]).textContent = values[i]; | ||||
|                     document.querySelector(read_hover_value_ids[i]).textContent = value; | ||||
|                 } else { | ||||
|                     document.querySelector(read_hover_text_ids[i]).style.display = "none"; | ||||
|                     document.querySelector(read_hover_value_ids[i]).style.display = "none"; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user