summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-07-23 13:39:34 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-07-23 13:39:34 +0200
commitc2acb4aff58b7b7f60a13ab05104910f70741e3c (patch)
treebc8bcac2c7386aa2522c89223aba4471cfb27820 /gui/src/renderer
parentd0951f1f9ae8d0c6be9c4aa961a257c97ddbf4f5 (diff)
parentf5f870074496283521d6adcc80537a54e2168c8e (diff)
downloadmullvadvpn-c2acb4aff58b7b7f60a13ab05104910f70741e3c.tar.xz
mullvadvpn-c2acb4aff58b7b7f60a13ab05104910f70741e3c.zip
Merge branch 'fix-linter-warnings'
Diffstat (limited to 'gui/src/renderer')
-rw-r--r--gui/src/renderer/app.tsx9
-rw-r--r--gui/src/renderer/components/AdvancedSettings.tsx19
-rw-r--r--gui/src/renderer/components/Login.tsx3
-rw-r--r--gui/src/renderer/components/SplitTunnelingSettings.tsx3
-rw-r--r--gui/src/renderer/components/SvgMap.tsx3
-rw-r--r--gui/src/renderer/containers/AccountPage.tsx3
-rw-r--r--gui/src/renderer/containers/LoginPage.tsx5
-rw-r--r--gui/src/renderer/containers/PreferencesPage.tsx5
-rw-r--r--gui/src/renderer/containers/SupportPage.tsx3
-rw-r--r--gui/src/renderer/lib/utilityHooks.ts13
10 files changed, 26 insertions, 40 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index a92ffb2e8a..5dfdb7bf29 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -21,7 +21,6 @@ import { IGuiSettingsState, SYSTEM_PREFERRED_LOCALE_KEY } from '../shared/gui-se
import { messages, relayLocations } from '../shared/gettext';
import log, { ConsoleOutput } from '../shared/logging';
import { IRelayListPair, LaunchApplicationResult } from '../shared/ipc-schema';
-import consumePromise from '../shared/promise';
import { Scheduler } from '../shared/scheduler';
import History, { ITransitionSpecification, transitions } from './lib/history';
import { loadTranslations } from './lib/load-translations';
@@ -138,7 +137,7 @@ export default class AppRenderer {
});
IpcRendererEventChannel.daemon.listenConnected(() => {
- consumePromise(this.onDaemonConnected());
+ void this.onDaemonConnected();
});
IpcRendererEventChannel.daemon.listenDisconnected(() => {
@@ -243,7 +242,7 @@ export default class AppRenderer {
this.setWireguardPublicKey(initialState.wireguardPublicKey);
if (initialState.isConnected) {
- consumePromise(this.onDaemonConnected());
+ void this.onDaemonConnected();
}
this.checkContentHeight();
@@ -369,7 +368,7 @@ export default class AppRenderer {
} catch (e) {
log.error(`Failed to get the WWW auth token: ${e.message}`);
}
- consumePromise(this.openUrl(`${link}?token=${token}`));
+ void this.openUrl(`${link}?token=${token}`);
}
public async setAllowLan(allowLan: boolean) {
@@ -489,7 +488,7 @@ export default class AppRenderer {
}
public removeSplitTunnelingApplication(application: IApplication | string) {
- consumePromise(IpcRendererEventChannel.windowsSplitTunneling.removeApplication(application));
+ void IpcRendererEventChannel.windowsSplitTunneling.removeApplication(application);
}
public collectProblemReport(toRedact?: string): Promise<string> {
diff --git a/gui/src/renderer/components/AdvancedSettings.tsx b/gui/src/renderer/components/AdvancedSettings.tsx
index 62232b6b8c..338a4d5b81 100644
--- a/gui/src/renderer/components/AdvancedSettings.tsx
+++ b/gui/src/renderer/components/AdvancedSettings.tsx
@@ -8,7 +8,6 @@ import {
TunnelProtocol,
} from '../../shared/daemon-rpc-types';
import { messages } from '../../shared/gettext';
-import consumePromise from '../../shared/promise';
import { IpAddress } from '../lib/ip';
import { WgKeyState } from '../redux/settings/reducers';
import {
@@ -599,7 +598,7 @@ export default class AdvancedSettings extends React.Component<IProps, IState> {
};
private confirmPublicDnsAddress = () => {
- consumePromise(this.addDnsAddress(this.state.publicDnsIpToConfirm!, true));
+ void this.addDnsAddress(this.state.publicDnsIpToConfirm!, true);
this.hideCustomDnsConfirmationDialog();
};
@@ -627,15 +626,13 @@ export default class AdvancedSettings extends React.Component<IProps, IState> {
private removeDnsAddress = (address: string) => {
const addresses = this.props.dns.customOptions.addresses.filter((item) => item !== address);
- consumePromise(
- this.props.setDnsOptions({
- ...this.props.dns,
- state: addresses.length > 0 && this.props.dns.state === 'custom' ? 'custom' : 'default',
- customOptions: {
- addresses,
- },
- }),
- );
+ void this.props.setDnsOptions({
+ ...this.props.dns,
+ state: addresses.length > 0 && this.props.dns.state === 'custom' ? 'custom' : 'default',
+ customOptions: {
+ addresses,
+ },
+ });
};
private tunnelProtocolItems = (
diff --git a/gui/src/renderer/components/Login.tsx b/gui/src/renderer/components/Login.tsx
index 4198bcb9dd..96d3929fe0 100644
--- a/gui/src/renderer/components/Login.tsx
+++ b/gui/src/renderer/components/Login.tsx
@@ -1,7 +1,6 @@
import React, { useCallback } from 'react';
import { sprintf } from 'sprintf-js';
import { colors } from '../../config.json';
-import consumePromise from '../../shared/promise';
import { messages } from '../../shared/gettext';
import { formatAccountToken } from '../lib/account';
import Accordion from './Accordion';
@@ -217,7 +216,7 @@ export default class Login extends React.Component<IProps, IState> {
};
private onClearAccountHistory = () => {
- consumePromise(this.clearAccountHistory());
+ void this.clearAccountHistory();
};
private async clearAccountHistory() {
diff --git a/gui/src/renderer/components/SplitTunnelingSettings.tsx b/gui/src/renderer/components/SplitTunnelingSettings.tsx
index 30948dae35..1b41a6683d 100644
--- a/gui/src/renderer/components/SplitTunnelingSettings.tsx
+++ b/gui/src/renderer/components/SplitTunnelingSettings.tsx
@@ -4,7 +4,6 @@ import { sprintf } from 'sprintf-js';
import { colors } from '../../config.json';
import { messages } from '../../shared/gettext';
import { IApplication, ILinuxSplitTunnelingApplication } from '../../shared/application-types';
-import consumePromise from '../../shared/promise';
import { useAppContext } from '../context';
import { useHistory } from '../lib/history';
import { useAsyncEffect } from '../lib/utilityHooks';
@@ -142,7 +141,7 @@ function LinuxSplitTunnelingSettings(props: IPlatformSplitTunnelingSettingsProps
const [applications, setApplications] = useState<ILinuxSplitTunnelingApplication[]>();
const [browseError, setBrowseError] = useState<string>();
- useEffect(() => consumePromise(getLinuxSplitTunnelingApplications().then(setApplications)), []);
+ useEffect(() => void getLinuxSplitTunnelingApplications().then(setApplications), []);
const launchApplication = useCallback(
async (application: ILinuxSplitTunnelingApplication | string) => {
diff --git a/gui/src/renderer/components/SvgMap.tsx b/gui/src/renderer/components/SvgMap.tsx
index 93b3b7fdc3..cae3c68ed6 100644
--- a/gui/src/renderer/components/SvgMap.tsx
+++ b/gui/src/renderer/components/SvgMap.tsx
@@ -226,8 +226,7 @@ function SvgMap(props: IProps) {
style={mapStyle}
projection={
// Workaround for incorrect type definition in @types/react-simple-maps.
- /* @ts-ignore */
- projection as () => GeoProjection
+ (projection as unknown) as () => GeoProjection
}
projectionConfig={projectionConfig}>
<ZoomableGroup
diff --git a/gui/src/renderer/containers/AccountPage.tsx b/gui/src/renderer/containers/AccountPage.tsx
index 8751107c74..641374c504 100644
--- a/gui/src/renderer/containers/AccountPage.tsx
+++ b/gui/src/renderer/containers/AccountPage.tsx
@@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { links } from '../../config.json';
-import consumePromise from '../../shared/promise';
import Account from '../components/Account';
import withAppContext, { IAppContext } from '../context';
@@ -16,7 +15,7 @@ const mapStateToProps = (state: IReduxState) => ({
const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onLogout: () => {
- consumePromise(props.app.logout());
+ void props.app.logout();
},
onClose: () => {
props.history.pop();
diff --git a/gui/src/renderer/containers/LoginPage.tsx b/gui/src/renderer/containers/LoginPage.tsx
index a56e6ec04a..6797f40d3e 100644
--- a/gui/src/renderer/containers/LoginPage.tsx
+++ b/gui/src/renderer/containers/LoginPage.tsx
@@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-import consumePromise from '../../shared/promise';
import Login from '../components/Login';
import withAppContext, { IAppContext } from '../context';
import accountActions from '../redux/account/actions';
@@ -18,7 +17,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext) => {
const { resetLoginError, updateAccountToken } = bindActionCreators(accountActions, dispatch);
return {
login: (account: string) => {
- consumePromise(props.app.login(account));
+ void props.app.login(account);
},
resetLoginError: () => {
resetLoginError();
@@ -26,7 +25,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext) => {
openExternalLink: (url: string) => props.app.openUrl(url),
updateAccountToken,
clearAccountHistory: () => props.app.clearAccountHistory(),
- createNewAccount: () => consumePromise(props.app.createNewAccount()),
+ createNewAccount: () => void props.app.createNewAccount(),
};
};
diff --git a/gui/src/renderer/containers/PreferencesPage.tsx b/gui/src/renderer/containers/PreferencesPage.tsx
index 671ba33c26..a050afedf7 100644
--- a/gui/src/renderer/containers/PreferencesPage.tsx
+++ b/gui/src/renderer/containers/PreferencesPage.tsx
@@ -1,7 +1,6 @@
import { connect } from 'react-redux';
import { IDnsOptions } from '../../shared/daemon-rpc-types';
import log from '../../shared/logging';
-import consumePromise from '../../shared/promise';
import Preferences from '../components/Preferences';
import withAppContext, { IAppContext } from '../context';
import { IHistoryProps, withHistory } from '../lib/history';
@@ -39,10 +38,10 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAp
props.app.setAutoConnect(autoConnect);
},
setAllowLan: (allowLan: boolean) => {
- consumePromise(props.app.setAllowLan(allowLan));
+ void props.app.setAllowLan(allowLan);
},
setShowBetaReleases: (showBetaReleases: boolean) => {
- consumePromise(props.app.setShowBetaReleases(showBetaReleases));
+ void props.app.setShowBetaReleases(showBetaReleases);
},
setStartMinimized: (startMinimized: boolean) => {
props.app.setStartMinimized(startMinimized);
diff --git a/gui/src/renderer/containers/SupportPage.tsx b/gui/src/renderer/containers/SupportPage.tsx
index a4bdbd4ac3..8457d6f6ff 100644
--- a/gui/src/renderer/containers/SupportPage.tsx
+++ b/gui/src/renderer/containers/SupportPage.tsx
@@ -1,6 +1,5 @@
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-import consumePromise from '../../shared/promise';
import Support from '../components/Support';
import withAppContext, { IAppContext } from '../context';
import { IHistoryProps, withHistory } from '../lib/history';
@@ -24,7 +23,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext & IHisto
props.history.pop();
},
viewLog(id: string) {
- consumePromise(props.app.viewLog(id));
+ void props.app.viewLog(id);
},
saveReportForm,
clearReportForm,
diff --git a/gui/src/renderer/lib/utilityHooks.ts b/gui/src/renderer/lib/utilityHooks.ts
index 9e8cea0bad..d20cb80883 100644
--- a/gui/src/renderer/lib/utilityHooks.ts
+++ b/gui/src/renderer/lib/utilityHooks.ts
@@ -1,5 +1,4 @@
import React, { useCallback, useEffect, useRef } from 'react';
-import consumePromise from '../../shared/promise';
export function useMounted() {
const mountedRef = useRef(false);
@@ -36,13 +35,11 @@ export function useAsyncEffect(
useEffect(() => {
const promise = effect();
return () => {
- consumePromise(
- promise.then((destructor) => {
- if (isMounted() && destructor) {
- return destructor();
- }
- }),
- );
+ void promise.then((destructor) => {
+ if (isMounted() && destructor) {
+ return destructor();
+ }
+ });
};
}, dependencies);
}