mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	xo: Enable @typescript-eslint/restrict-template-expressions.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
		
				
					committed by
					
						
						Anders Kaseorg
					
				
			
			
				
	
			
			
			
						parent
						
							fc6ff83485
						
					
				
				
					commit
					849df4adaf
				
			@@ -59,7 +59,11 @@ electron_bridge.on('realm_name', realmName => {
 | 
			
		||||
	ipcRenderer.send('realm-name-changed', serverURL, realmName);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
electron_bridge.on('realm_icon_url', iconURL => {
 | 
			
		||||
electron_bridge.on('realm_icon_url', (iconURL: unknown) => {
 | 
			
		||||
	if (typeof iconURL !== 'string') {
 | 
			
		||||
		throw new TypeError('Expected string for iconURL');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const serverURL = location.origin;
 | 
			
		||||
	iconURL = iconURL.includes('http') ? iconURL : `${serverURL}${iconURL}`;
 | 
			
		||||
	ipcRenderer.send('realm-icon-changed', serverURL, iconURL);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,9 +21,9 @@ export async function loadBots(): Promise<void> {
 | 
			
		||||
	const response = await fetch('/json/users');
 | 
			
		||||
	if (response.ok) {
 | 
			
		||||
		const { members } = await response.json();
 | 
			
		||||
		members.forEach((membersRow: any) => {
 | 
			
		||||
			if (membersRow.is_bot) {
 | 
			
		||||
				const bot = `@${membersRow.full_name}`;
 | 
			
		||||
		members.forEach(({ is_bot, full_name }: any) => {
 | 
			
		||||
			if (is_bot && typeof full_name === 'string') {
 | 
			
		||||
				const bot = `@${full_name}`;
 | 
			
		||||
				const mention = `@**${bot.replace(/^@/, '')}**`;
 | 
			
		||||
				botsList.push([bot, mention]);
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ export default class GeneralSection extends BaseSection {
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="setting-row" id="remove-custom-css">
 | 
			
		||||
						<div class="setting-description">
 | 
			
		||||
							<div class="selected-css-path" id="custom-css-path">${ConfigUtil.getConfigItem('customCSS')}</div>
 | 
			
		||||
							<div class="selected-css-path" id="custom-css-path">${ConfigUtil.getConfigString('customCSS', '')}</div>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="action red" id="css-delete-action">
 | 
			
		||||
							<i class="material-icons">indeterminate_check_box</i>
 | 
			
		||||
@@ -130,7 +130,7 @@ export default class GeneralSection extends BaseSection {
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="setting-row">
 | 
			
		||||
						<div class="setting-description">
 | 
			
		||||
							<div class="download-folder-path">${ConfigUtil.getConfigItem('downloadsPath', `${app.getPath('downloads')}`)}</div>
 | 
			
		||||
							<div class="download-folder-path">${ConfigUtil.getConfigString('downloadsPath', app.getPath('downloads'))}</div>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="setting-row" id="prompt-download">
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,16 @@ export function getConfigItem(key: string, defaultValue: any = null): any {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getConfigString(key: string, defaultValue: string): string {
 | 
			
		||||
	const value = getConfigItem(key, defaultValue);
 | 
			
		||||
	if (typeof value === 'string') {
 | 
			
		||||
		return value;
 | 
			
		||||
	} else {
 | 
			
		||||
		setConfigItem(key, defaultValue);
 | 
			
		||||
		return defaultValue;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This function returns whether a key exists in the configuration file (settings.json)
 | 
			
		||||
export function isConfigItemExists(key: string): boolean {
 | 
			
		||||
	try {
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ export function requestOptions(domain: string, ignoreCerts: boolean): RequestUti
 | 
			
		||||
		try {
 | 
			
		||||
			certificateLocation = fs.readFileSync(certificateFile, 'utf8');
 | 
			
		||||
		} catch (error) {
 | 
			
		||||
			logger.warn(`Error while trying to get certificate: ${error}`);
 | 
			
		||||
			logger.warn('Error while trying to get certificate:', error);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -207,7 +207,6 @@
 | 
			
		||||
      "@typescript-eslint/no-unused-vars": "off",
 | 
			
		||||
      "@typescript-eslint/prefer-readonly-parameter-types": "off",
 | 
			
		||||
      "@typescript-eslint/restrict-plus-operands": "off",
 | 
			
		||||
      "@typescript-eslint/restrict-template-expressions": "off",
 | 
			
		||||
      "capitalized-comments": "off",
 | 
			
		||||
      "import/no-mutable-exports": "off",
 | 
			
		||||
      "import/unambiguous": "error",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user