summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-10-14 14:49:23 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-10-16 11:06:43 +0200
commit66225b84bc9d68dc7029aed34ea3781fcbb18c58 (patch)
tree62de940469c8d2a8a1e70b4c5f2b926f3735ab71
parentd25896a3d701c0a92b4efb2ef04204480abc82ed (diff)
downloadmullvadvpn-66225b84bc9d68dc7029aed34ea3781fcbb18c58.tar.xz
mullvadvpn-66225b84bc9d68dc7029aed34ea3781fcbb18c58.zip
Fix warnings from TypeScript eslint plugin after upgrade
-rw-r--r--gui/.eslintrc.js4
-rw-r--r--gui/package-lock.json9
-rw-r--r--gui/package.json1
-rw-r--r--gui/src/main/daemon-rpc.ts10
-rw-r--r--gui/src/renderer/components/Connect.tsx4
-rw-r--r--gui/src/renderer/components/SelectLocation.tsx6
-rw-r--r--gui/src/shared/gettext.ts2
-rw-r--r--gui/types/gettext-parser/index.d.ts5
8 files changed, 22 insertions, 19 deletions
diff --git a/gui/.eslintrc.js b/gui/.eslintrc.js
index c23f14c3ee..183c260886 100644
--- a/gui/.eslintrc.js
+++ b/gui/.eslintrc.js
@@ -38,13 +38,13 @@ module.exports = {
'no-return-await': 'error',
'@typescript-eslint/no-use-before-define': 'off',
- '@typescript-eslint/explicit-function-return-type': 'off',
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
// TODO: The rules below should be enabled when move from ReactXP is completed.
'@typescript-eslint/camelcase': 'off',
- '@typescript-eslint/ban-ts-ignore': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
'react/no-find-dom-node': 'off',
},
};
diff --git a/gui/package-lock.json b/gui/package-lock.json
index 215a149997..670cede96c 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -577,6 +577,15 @@
"integrity": "sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==",
"dev": true
},
+ "@types/gettext-parser": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/gettext-parser/-/gettext-parser-4.0.0.tgz",
+ "integrity": "sha512-I/wvhr+l5M7IwBF1ADBfNQ6qGfUg85UTjj/AZWn09Y+POqyLe1cfbdJSMWzCobiJ3EJNY23MQCbP6jxQT81OTQ==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
diff --git a/gui/package.json b/gui/package.json
index f323ca64f0..660efb8cd7 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -45,6 +45,7 @@
"@types/d3-geo": "^1.11.0",
"@types/enzyme": "^3.1.15",
"@types/enzyme-adapter-react-16": "^1.0.3",
+ "@types/gettext-parser": "^4.0.0",
"@types/google-protobuf": "^3.7.2",
"@types/mkdirp": "^1.0.0",
"@types/mocha": "^5.2.6",
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 4bbca29930..006dd12866 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -940,18 +940,16 @@ function convertFromBridgeSettings(
const localSettings = bridgeSettings.local;
if (localSettings) {
return customSettings({
- port: localSettings?.port!,
- peer: localSettings?.peer!,
+ port: localSettings.port,
+ peer: localSettings.peer,
});
}
const remoteSettings = bridgeSettings.remote;
if (remoteSettings) {
return customSettings({
- address: remoteSettings?.address!,
- auth: {
- ...remoteSettings?.auth!,
- },
+ address: remoteSettings.address,
+ auth: remoteSettings.auth && { ...remoteSettings.auth },
});
}
diff --git a/gui/src/renderer/components/Connect.tsx b/gui/src/renderer/components/Connect.tsx
index c0c257b736..a6654ad8c0 100644
--- a/gui/src/renderer/components/Connect.tsx
+++ b/gui/src/renderer/components/Connect.tsx
@@ -188,8 +188,6 @@ export default class Connect extends React.Component<IProps, IState> {
return HeaderBarStyle.success;
case 'nothing':
return HeaderBarStyle.error;
- default:
- throw new Error(`Invalid action after disconnection: ${status.details}`);
}
}
}
@@ -244,8 +242,6 @@ export default class Connect extends React.Component<IProps, IState> {
return MarkerStyle.secure;
case 'nothing':
return MarkerStyle.unsecure;
- default:
- throw new Error(`Invalid action after disconnection: ${status.details}`);
}
}
}
diff --git a/gui/src/renderer/components/SelectLocation.tsx b/gui/src/renderer/components/SelectLocation.tsx
index 52943549c6..c42994b572 100644
--- a/gui/src/renderer/components/SelectLocation.tsx
+++ b/gui/src/renderer/components/SelectLocation.tsx
@@ -60,7 +60,11 @@ export default class SelectLocation extends React.Component<IProps> {
this.scrollToSelectedCell();
}
- public componentDidUpdate(prevProps: IProps, _prevState: {}, snapshot?: ISelectLocationSnapshot) {
+ public componentDidUpdate(
+ prevProps: IProps,
+ _prevState: unknown,
+ snapshot?: ISelectLocationSnapshot,
+ ) {
if (this.props.locationScope !== prevProps.locationScope) {
this.restoreScrollPosition(this.props.locationScope);
diff --git a/gui/src/shared/gettext.ts b/gui/src/shared/gettext.ts
index cfee187351..df15e0c2ef 100644
--- a/gui/src/shared/gettext.ts
+++ b/gui/src/shared/gettext.ts
@@ -50,7 +50,7 @@ function parseTranslation(locale: string, domain: string, catalogue: Gettext): b
return false;
}
- let translations: object;
+ let translations: ReturnType<typeof po.parse>;
try {
translations = po.parse(contents);
} catch (error) {
diff --git a/gui/types/gettext-parser/index.d.ts b/gui/types/gettext-parser/index.d.ts
deleted file mode 100644
index 61207951f4..0000000000
--- a/gui/types/gettext-parser/index.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-declare module 'gettext-parser' {
- export namespace po {
- export function parse(input: string | Buffer, defaultCharset?: string): object;
- }
-}