mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-01 20:43:33 +00:00
xo: Enable @typescript-eslint/restrict-plus-operands.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
849df4adaf
commit
963c2e5388
@@ -34,11 +34,14 @@ export function linuxUpdateNotification(): void {
|
||||
if (response.statusCode < 400) {
|
||||
const data = JSON.parse(body);
|
||||
const latestVersion = ConfigUtil.getConfigItem('betaUpdate') ? data[0].tag_name : data.tag_name;
|
||||
if (typeof latestVersion !== 'string') {
|
||||
throw new TypeError('Expected string for tag_name');
|
||||
}
|
||||
|
||||
if (semver.gt(latestVersion, app.getVersion())) {
|
||||
const notified = LinuxUpdateUtil.getUpdateItem(latestVersion);
|
||||
if (notified === null) {
|
||||
new Notification({title: 'Zulip Update', body: 'A new version ' + latestVersion + ' is available. Please update using your package manager.'}).show();
|
||||
new Notification({title: 'Zulip Update', body: `A new version ${latestVersion} is available. Please update using your package manager.`}).show();
|
||||
LinuxUpdateUtil.setUpdateItem(latestVersion, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ class ServerManagerView {
|
||||
return true;
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.error('Could not add ' + domain + '. Please contact your system administrator.');
|
||||
logger.error(`Could not add ${domain}. Please contact your system administrator.`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -492,7 +492,7 @@ class ServerManagerView {
|
||||
// This needs to handled only for the add server tooltip and not others.
|
||||
if (addServer) {
|
||||
const { top } = SidebarButton.getBoundingClientRect();
|
||||
SidebarTooltip.style.top = top + 'px';
|
||||
SidebarTooltip.style.top = `${top}px`;
|
||||
}
|
||||
});
|
||||
SidebarButton.addEventListener('mouseout', () => {
|
||||
@@ -508,7 +508,7 @@ class ServerManagerView {
|
||||
// This could not be handled using CSS, hence the top of the tooltip is made same
|
||||
// as that of its parent element.
|
||||
const { top } = this.$serverIconTooltip[index].parentElement.getBoundingClientRect();
|
||||
this.$serverIconTooltip[index].style.top = top + 'px';
|
||||
this.$serverIconTooltip[index].style.top = `${top}px`;
|
||||
}
|
||||
|
||||
onHoverOut(index: number): void {
|
||||
|
||||
@@ -181,7 +181,7 @@ ipcRenderer.on('tray', (_event: Event, arg: number): void => {
|
||||
unread = arg;
|
||||
const image = renderNativeImage(arg);
|
||||
tray.setImage(image);
|
||||
tray.setToolTip(arg + ' unread messages');
|
||||
tray.setToolTip(`${arg} unread messages`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -202,7 +202,7 @@ function toggleTray(): void {
|
||||
if (process.platform === 'linux' || process.platform === 'win32') {
|
||||
const image = renderNativeImage(unread);
|
||||
tray.setImage(image);
|
||||
tray.setToolTip(unread + ' unread messages');
|
||||
tray.setToolTip(`${unread} unread messages`);
|
||||
}
|
||||
|
||||
ConfigUtil.setConfigItem('trayIcon', true);
|
||||
|
||||
@@ -185,14 +185,18 @@ async function getServerSettings(domain: string, ignoreCerts = false): Promise<S
|
||||
return new Promise((resolve, reject) => {
|
||||
request(serverSettingsOptions, (error: string, response: any) => {
|
||||
if (!error && response.statusCode === 200) {
|
||||
const data = JSON.parse(response.body);
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'realm_icon') && data.realm_icon) {
|
||||
const { realm_name, realm_uri, realm_icon } = JSON.parse(response.body);
|
||||
if (
|
||||
typeof realm_name === 'string' &&
|
||||
typeof realm_uri === 'string' &&
|
||||
typeof realm_icon === 'string'
|
||||
) {
|
||||
resolve({
|
||||
// Some Zulip Servers use absolute URL for server icon whereas others use relative URL
|
||||
// Following check handles both the cases
|
||||
icon: data.realm_icon.startsWith('/') ? data.realm_uri + data.realm_icon : data.realm_icon,
|
||||
url: data.realm_uri,
|
||||
alias: escape(data.realm_name),
|
||||
icon: realm_icon.startsWith('/') ? realm_uri + realm_icon : realm_icon,
|
||||
url: realm_uri,
|
||||
alias: escape(realm_name),
|
||||
ignoreCerts
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -206,7 +206,6 @@
|
||||
"@typescript-eslint/no-dynamic-delete": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
||||
"@typescript-eslint/restrict-plus-operands": "off",
|
||||
"capitalized-comments": "off",
|
||||
"import/no-mutable-exports": "off",
|
||||
"import/unambiguous": "error",
|
||||
|
||||
Reference in New Issue
Block a user