mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	eslint: Fix @typescript-eslint/prefer-regexp-exec.
https://typescript-eslint.io/rules/prefer-regexp-exec/ Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							e6344bd1f5
						
					
				
				
					commit
					8196c4f63d
				
			| @@ -567,7 +567,7 @@ export function paste_handler_converter(paste_html: string): string { | ||||
|             const className = codeElement.getAttribute("class") ?? ""; | ||||
|             const language = node.parentElement?.classList.contains("zulip-code-block") | ||||
|                 ? (node.closest<HTMLElement>(".codehilite")?.dataset?.codeLanguage ?? "") | ||||
|                 : (className.match(/language-(\S+)/) ?? [null, ""])[1]; | ||||
|                 : (/language-(\S+)/.exec(className) ?? [null, ""])[1]; | ||||
|  | ||||
|             assert(options.fence !== undefined); | ||||
|             const fenceChar = options.fence.charAt(0); | ||||
|   | ||||
| @@ -170,7 +170,7 @@ export function create<ItemType extends {type: string}>( | ||||
|             if (value.length === 0) { | ||||
|                 return true; | ||||
|             } | ||||
|             if (store.split_text_on_comma && value.match(",")) { | ||||
|             if (store.split_text_on_comma && value.includes(",")) { | ||||
|                 funcs.insertManyPills(value); | ||||
|                 return false; | ||||
|             } | ||||
|   | ||||
| @@ -397,7 +397,7 @@ export function build_open_media_function( | ||||
|         const payload = parse_media_data(util.the($media)); | ||||
|  | ||||
|         assert(payload !== undefined); | ||||
|         if (payload.type.match("-video")) { | ||||
|         if (payload.type.includes("-video")) { | ||||
|             display_video(payload); | ||||
|         } else if (payload.type === "image") { | ||||
|             display_image(payload); | ||||
| @@ -509,7 +509,7 @@ export function parse_media_data(media: HTMLMediaElement | HTMLImageElement): Pa | ||||
|     let original_width_px; | ||||
|     let original_height_px; | ||||
|     if (original_dimensions) { | ||||
|         const found = original_dimensions.match(/^(\d+)x(\d+)$/); | ||||
|         const found = /^(\d+)x(\d+)$/.exec(original_dimensions); | ||||
|         if (found) { | ||||
|             original_width_px = Number(found[1]); | ||||
|             original_height_px = Number(found[2]); | ||||
|   | ||||
| @@ -198,8 +198,8 @@ export function find_stream_wildcard_mentions(message_content: string): string | | ||||
|     // We cannot use the exact same regex as the server side uses (in zerver/lib/mention.py) | ||||
|     // because Safari < 16.4 does not support look-behind assertions.  Reframe the lookbehind of a | ||||
|     // negative character class as a start-of-string or positive character class. | ||||
|     const mention = message_content.match( | ||||
|         /(?:^|[\s"'(/<[{])(@\*{2}(all|everyone|stream|channel)\*{2})/, | ||||
|     const mention = /(?:^|[\s"'(/<[{])(@\*{2}(all|everyone|stream|channel)\*{2})/.exec( | ||||
|         message_content, | ||||
|     ); | ||||
|     if (mention === null) { | ||||
|         return null; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user