mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-04 14:03:27 +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);
|
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;
|
const serverURL = location.origin;
|
||||||
iconURL = iconURL.includes('http') ? iconURL : `${serverURL}${iconURL}`;
|
iconURL = iconURL.includes('http') ? iconURL : `${serverURL}${iconURL}`;
|
||||||
ipcRenderer.send('realm-icon-changed', 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');
|
const response = await fetch('/json/users');
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const { members } = await response.json();
|
const { members } = await response.json();
|
||||||
members.forEach((membersRow: any) => {
|
members.forEach(({ is_bot, full_name }: any) => {
|
||||||
if (membersRow.is_bot) {
|
if (is_bot && typeof full_name === 'string') {
|
||||||
const bot = `@${membersRow.full_name}`;
|
const bot = `@${full_name}`;
|
||||||
const mention = `@**${bot.replace(/^@/, '')}**`;
|
const mention = `@**${bot.replace(/^@/, '')}**`;
|
||||||
botsList.push([bot, mention]);
|
botsList.push([bot, mention]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default class GeneralSection extends BaseSection {
|
|||||||
</div>
|
</div>
|
||||||
<div class="setting-row" id="remove-custom-css">
|
<div class="setting-row" id="remove-custom-css">
|
||||||
<div class="setting-description">
|
<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>
|
||||||
<div class="action red" id="css-delete-action">
|
<div class="action red" id="css-delete-action">
|
||||||
<i class="material-icons">indeterminate_check_box</i>
|
<i class="material-icons">indeterminate_check_box</i>
|
||||||
@@ -130,7 +130,7 @@ export default class GeneralSection extends BaseSection {
|
|||||||
</div>
|
</div>
|
||||||
<div class="setting-row">
|
<div class="setting-row">
|
||||||
<div class="setting-description">
|
<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>
|
</div>
|
||||||
<div class="setting-row" id="prompt-download">
|
<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)
|
// This function returns whether a key exists in the configuration file (settings.json)
|
||||||
export function isConfigItemExists(key: string): boolean {
|
export function isConfigItemExists(key: string): boolean {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export function requestOptions(domain: string, ignoreCerts: boolean): RequestUti
|
|||||||
try {
|
try {
|
||||||
certificateLocation = fs.readFileSync(certificateFile, 'utf8');
|
certificateLocation = fs.readFileSync(certificateFile, 'utf8');
|
||||||
} catch (error) {
|
} 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/no-unused-vars": "off",
|
||||||
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
||||||
"@typescript-eslint/restrict-plus-operands": "off",
|
"@typescript-eslint/restrict-plus-operands": "off",
|
||||||
"@typescript-eslint/restrict-template-expressions": "off",
|
|
||||||
"capitalized-comments": "off",
|
"capitalized-comments": "off",
|
||||||
"import/no-mutable-exports": "off",
|
"import/no-mutable-exports": "off",
|
||||||
"import/unambiguous": "error",
|
"import/unambiguous": "error",
|
||||||
|
|||||||
Reference in New Issue
Block a user