From 491b17997146686f5c10e44887b36f456b45a7a5 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 30 Jun 2021 13:28:31 +0100 Subject: [PATCH] Auto-fix lint errors --- src/@types/global.d.ts | 2 +- .../structures/CompatibilityView.tsx | 4 ++-- src/async-components/structures/ErrorView.tsx | 2 +- src/components/views/auth/VectorAuthFooter.tsx | 6 +++--- .../views/auth/VectorAuthHeaderLogo.tsx | 2 +- src/components/views/auth/VectorAuthPage.tsx | 2 +- src/favicon.ts | 6 +++--- src/vector/app.tsx | 16 ++++++++-------- src/vector/getconfig.ts | 4 ++-- src/vector/index.ts | 2 +- src/vector/indexeddb-worker.js | 2 +- src/vector/init.tsx | 5 ++--- src/vector/jitsi/index.ts | 6 +++--- src/vector/mobile_guide/index.js | 2 +- src/vector/platform/ElectronPlatform.tsx | 16 ++++++++-------- src/vector/platform/VectorBasePlatform.ts | 4 ++-- src/vector/platform/WebPlatform.ts | 10 +++++----- 17 files changed, 45 insertions(+), 46 deletions(-) diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 68b85d6a84..521150648a 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -15,7 +15,7 @@ limitations under the License. */ import "matrix-react-sdk/src/@types/global"; // load matrix-react-sdk's type extensions first -import type {Renderer} from "react-dom"; +import type { Renderer } from "react-dom"; type ElectronChannel = "app_onAction" | diff --git a/src/async-components/structures/CompatibilityView.tsx b/src/async-components/structures/CompatibilityView.tsx index d8b5f0be8d..7a781ab459 100644 --- a/src/async-components/structures/CompatibilityView.tsx +++ b/src/async-components/structures/CompatibilityView.tsx @@ -27,7 +27,7 @@ interface IProps { } const CompatibilityView: React.FC = ({ onAccept }) => { - const {brand, mobileBuilds} = SdkConfig.get(); + const { brand, mobileBuilds } = SdkConfig.get(); let ios = null; const iosCustomUrl = mobileBuilds?.ios; @@ -71,7 +71,7 @@ const CompatibilityView: React.FC = ({ onAccept }) => { android = []; } - let mobileHeader =

{_t("Use %(brand)s on mobile", {brand})}

; + let mobileHeader =

{_t("Use %(brand)s on mobile", { brand })}

; if (!android.length && !ios) { mobileHeader = null; } diff --git a/src/async-components/structures/ErrorView.tsx b/src/async-components/structures/ErrorView.tsx index acde7ac0a2..195bb37f26 100644 --- a/src/async-components/structures/ErrorView.tsx +++ b/src/async-components/structures/ErrorView.tsx @@ -27,7 +27,7 @@ interface IProps { messages?: string[]; } -const ErrorView: React.FC = ({title, messages}) => { +const ErrorView: React.FC = ({ title, messages }) => { return
diff --git a/src/components/views/auth/VectorAuthFooter.tsx b/src/components/views/auth/VectorAuthFooter.tsx index 31a994b3f8..7d940cf049 100644 --- a/src/components/views/auth/VectorAuthFooter.tsx +++ b/src/components/views/auth/VectorAuthFooter.tsx @@ -22,9 +22,9 @@ import { _t } from 'matrix-react-sdk/src/languageHandler'; const VectorAuthFooter = () => { const brandingConfig = SdkConfig.get().branding; let links = [ - {"text": "Blog", "url": "https://element.io/blog"}, - {"text": "Twitter", "url": "https://twitter.com/element_hq"}, - {"text": "GitHub", "url": "https://github.com/vector-im/element-web"}, + { "text": "Blog", "url": "https://element.io/blog" }, + { "text": "Twitter", "url": "https://twitter.com/element_hq" }, + { "text": "GitHub", "url": "https://github.com/vector-im/element-web" }, ]; if (brandingConfig && brandingConfig.authFooterLinks) { diff --git a/src/components/views/auth/VectorAuthHeaderLogo.tsx b/src/components/views/auth/VectorAuthHeaderLogo.tsx index d3bf32341b..976bd9a2f7 100644 --- a/src/components/views/auth/VectorAuthHeaderLogo.tsx +++ b/src/components/views/auth/VectorAuthHeaderLogo.tsx @@ -19,7 +19,7 @@ import React from 'react'; import SdkConfig from 'matrix-react-sdk/src/SdkConfig'; export default class VectorAuthHeaderLogo extends React.PureComponent { - static replaces = 'AuthHeaderLogo' + static replaces = 'AuthHeaderLogo'; render() { const brandingConfig = SdkConfig.get().branding; diff --git a/src/components/views/auth/VectorAuthPage.tsx b/src/components/views/auth/VectorAuthPage.tsx index b50c401f99..c1ccdcf9a0 100644 --- a/src/components/views/auth/VectorAuthPage.tsx +++ b/src/components/views/auth/VectorAuthPage.tsx @@ -19,7 +19,7 @@ import * as sdk from 'matrix-react-sdk/src/index'; import SdkConfig from 'matrix-react-sdk/src/SdkConfig'; export default class VectorAuthPage extends React.PureComponent { - static replaces = 'AuthPage' + static replaces = 'AuthPage'; static welcomeBackgroundUrl; diff --git a/src/favicon.ts b/src/favicon.ts index a7f4d15bd2..bec13c7866 100644 --- a/src/favicon.ts +++ b/src/favicon.ts @@ -57,7 +57,7 @@ export default class Favicon { private readyCb = () => {}; constructor(params: Partial = {}) { - this.params = {...defaults, ...params}; + this.params = { ...defaults, ...params }; this.icons = Favicon.getIcons(); // create work canvas @@ -125,7 +125,7 @@ export default class Favicon { } private circle(n: number | string, opts?: Partial) { - const params = {...this.params, ...opts}; + const params = { ...this.params, ...opts }; const opt = this.options(n, params); let more = false; @@ -214,7 +214,7 @@ export default class Favicon { if (!this.isReady) { this.readyCb = () => { this.badge(content, opts); - } + }; return; } diff --git a/src/vector/app.tsx b/src/vector/app.tsx index 1fc856c01b..510f3597d1 100644 --- a/src/vector/app.tsx +++ b/src/vector/app.tsx @@ -25,17 +25,17 @@ window.React = React; import * as sdk from 'matrix-react-sdk'; import PlatformPeg from 'matrix-react-sdk/src/PlatformPeg'; -import {_td, newTranslatableError} from 'matrix-react-sdk/src/languageHandler'; +import { _td, newTranslatableError } from 'matrix-react-sdk/src/languageHandler'; import AutoDiscoveryUtils from 'matrix-react-sdk/src/utils/AutoDiscoveryUtils'; -import {AutoDiscovery} from "matrix-js-sdk/src/autodiscovery"; +import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery"; import * as Lifecycle from "matrix-react-sdk/src/Lifecycle"; import type MatrixChatType from "matrix-react-sdk/src/components/structures/MatrixChat"; -import {MatrixClientPeg} from 'matrix-react-sdk/src/MatrixClientPeg'; +import { MatrixClientPeg } from 'matrix-react-sdk/src/MatrixClientPeg'; import SdkConfig from "matrix-react-sdk/src/SdkConfig"; -import {parseQs, parseQsFromFragment} from './url_utils'; +import { parseQs, parseQsFromFragment } from './url_utils'; import VectorBasePlatform from "./platform/VectorBasePlatform"; -import {createClient} from "matrix-js-sdk/src/matrix"; +import { createClient } from "matrix-js-sdk/src/matrix"; let lastLocationHashSet: string = null; @@ -257,12 +257,12 @@ async function verifyServerConfig() { validatedConfig = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult, true); } catch (e) { - const {hsUrl, isUrl, userId} = await Lifecycle.getStoredSessionVars(); + const { hsUrl, isUrl, userId } = await Lifecycle.getStoredSessionVars(); if (hsUrl && userId) { console.error(e); console.warn("A session was found - suppressing config error and using the session's homeserver"); - console.log("Using pre-existing hsUrl and isUrl: ", {hsUrl, isUrl}); + console.log("Using pre-existing hsUrl and isUrl: ", { hsUrl, isUrl }); validatedConfig = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl, isUrl, true); } else { // the user is not logged in, so scream @@ -277,7 +277,7 @@ async function verifyServerConfig() { // Add the newly built config to the actual config for use by the app console.log("Updating SdkConfig with validated discovery information"); - SdkConfig.add({"validated_server_config": validatedConfig}); + SdkConfig.add({ "validated_server_config": validatedConfig }); return SdkConfig.get(); } diff --git a/src/vector/getconfig.ts b/src/vector/getconfig.ts index f9ec5a1951..fe012102b3 100644 --- a/src/vector/getconfig.ts +++ b/src/vector/getconfig.ts @@ -55,7 +55,7 @@ function getConfig(configJsonFilename: string): Promise<{}> { resolve({}); } } - reject({err: err, response: response}); + reject({ err: err, response: response }); return; } @@ -65,7 +65,7 @@ function getConfig(configJsonFilename: string): Promise<{}> { // loading from the filesystem (see above). resolve(JSON.parse(body)); } catch (e) { - reject({err: e}); + reject({ err: e }); } }, ); diff --git a/src/vector/index.ts b/src/vector/index.ts index 75c6a76276..8817167069 100644 --- a/src/vector/index.ts +++ b/src/vector/index.ts @@ -26,7 +26,7 @@ require('highlight.js/styles/github.css'); require('katex/dist/katex.css'); // These are things that can run before the skin loads - be careful not to reference the react-sdk though. -import {parseQsFromFragment} from "./url_utils"; +import { parseQsFromFragment } from "./url_utils"; import './modernizr'; async function settled(...promises: Array>) { diff --git a/src/vector/indexeddb-worker.js b/src/vector/indexeddb-worker.js index 3cb2cb9f4e..85070079de 100644 --- a/src/vector/indexeddb-worker.js +++ b/src/vector/indexeddb-worker.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {IndexedDBStoreWorker} from 'matrix-js-sdk/src/indexeddb-worker.js'; +import { IndexedDBStoreWorker } from 'matrix-js-sdk/src/indexeddb-worker.js'; const remoteWorker = new IndexedDBStoreWorker(postMessage); diff --git a/src/vector/init.tsx b/src/vector/init.tsx index f3f848222a..66389df8ab 100644 --- a/src/vector/init.tsx +++ b/src/vector/init.tsx @@ -31,10 +31,9 @@ import PWAPlatform from "./platform/PWAPlatform"; import WebPlatform from "./platform/WebPlatform"; import PlatformPeg from "matrix-react-sdk/src/PlatformPeg"; import SdkConfig from "matrix-react-sdk/src/SdkConfig"; -import {setTheme} from "matrix-react-sdk/src/theme"; - -import {initRageshake, initRageshakeStore} from "./rageshakesetup"; +import { setTheme } from "matrix-react-sdk/src/theme"; +import { initRageshake, initRageshakeStore } from "./rageshakesetup"; export const rageshakePromise = initRageshake(); diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index e92470b7d6..8ebe47abab 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -18,7 +18,7 @@ limitations under the License. require("./index.scss"); import * as qs from 'querystring'; -import {KJUR} from 'jsrsasign'; +import { KJUR } from 'jsrsasign'; import { IOpenIDCredentials, IWidgetApiRequest, @@ -138,7 +138,7 @@ let meetApi: any; // JitsiMeetExternalAPI }); widgetApi.transport.reply(ev.detail, {}); // ack } else { - widgetApi.transport.reply(ev.detail, {error: {message: "Conference not joined"}}); + widgetApi.transport.reply(ev.detail, { error: { message: "Conference not joined" } }); } }, ); @@ -168,7 +168,7 @@ function switchVisibleContainers() { */ function createJWTToken() { // Header - const header = {alg: 'HS256', typ: 'JWT'}; + const header = { alg: 'HS256', typ: 'JWT' }; // Payload const payload = { // As per Jitsi token auth, `iss` needs to be set to something agreed between diff --git a/src/vector/mobile_guide/index.js b/src/vector/mobile_guide/index.js index 9a2af3c6a1..950ab956cb 100644 --- a/src/vector/mobile_guide/index.js +++ b/src/vector/mobile_guide/index.js @@ -1,4 +1,4 @@ -import {getVectorConfig} from '../getconfig'; +import { getVectorConfig } from '../getconfig'; function onBackToElementClick() { // Cookie should expire in 4 hours diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index 6d6c5105d1..71f74fdc5b 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -48,7 +48,7 @@ import React from "react"; import { randomString } from "matrix-js-sdk/src/randomstring"; import { Action } from "matrix-react-sdk/src/dispatcher/actions"; import { ActionPayload } from "matrix-react-sdk/src/dispatcher/payloads"; -import { SwitchSpacePayload} from "matrix-react-sdk/src/dispatcher/payloads/SwitchSpacePayload"; +import { SwitchSpacePayload } from "matrix-react-sdk/src/dispatcher/payloads/SwitchSpacePayload"; import { showToast as showUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast"; import { CheckUpdatesPayload } from "matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload"; import ToastStore from "matrix-react-sdk/src/stores/ToastStore"; @@ -119,8 +119,8 @@ class SeshatIndexManager extends BaseEventIndexManager { // TODO this should be moved into the preload.js file. const ipcCallId = ++this.nextIpcCallId; return new Promise((resolve, reject) => { - this.pendingIpcCalls[ipcCallId] = {resolve, reject}; - window.electron.send('seshat', {id: ipcCallId, name, args}); + this.pendingIpcCalls[ipcCallId] = { resolve, reject }; + window.electron.send('seshat', { id: ipcCallId, name, args }); }); } @@ -258,9 +258,9 @@ export default class ElectronPlatform extends VectorBasePlatform { dis.fire(Action.ViewUserSettings); }); - electron.on('userDownloadCompleted', (ev, {path, name}) => { + electron.on('userDownloadCompleted', (ev, { path, name }) => { const onAccept = () => { - electron.send('userDownloadOpen', {path}); + electron.send('userDownloadOpen', { path }); }; ToastStore.sharedInstance().addOrReplaceToast({ @@ -326,7 +326,7 @@ export default class ElectronPlatform extends VectorBasePlatform { return this._ipcCall('getConfig'); } - onUpdateDownloaded = async (ev, {releaseNotes, releaseName}) => { + onUpdateDownloaded = async (ev, { releaseNotes, releaseName }) => { dis.dispatch({ action: Action.CheckUpdates, status: UpdateCheckStatus.Ready, @@ -497,8 +497,8 @@ export default class ElectronPlatform extends VectorBasePlatform { async _ipcCall(name: string, ...args: any[]): Promise { const ipcCallId = ++this.nextIpcCallId; return new Promise((resolve, reject) => { - this.pendingIpcCalls[ipcCallId] = {resolve, reject}; - window.electron.send('ipcCall', {id: ipcCallId, name, args}); + this.pendingIpcCalls[ipcCallId] = { resolve, reject }; + window.electron.send('ipcCall', { id: ipcCallId, name, args }); // Maybe add a timeout to these? Probably not necessary. }); } diff --git a/src/vector/platform/VectorBasePlatform.ts b/src/vector/platform/VectorBasePlatform.ts index 28038d8e5d..22a93111c0 100644 --- a/src/vector/platform/VectorBasePlatform.ts +++ b/src/vector/platform/VectorBasePlatform.ts @@ -18,8 +18,8 @@ limitations under the License. */ import BasePlatform from 'matrix-react-sdk/src/BasePlatform'; -import {_t} from 'matrix-react-sdk/src/languageHandler'; -import {getVectorConfig} from "../getconfig"; +import { _t } from 'matrix-react-sdk/src/languageHandler'; +import { getVectorConfig } from "../getconfig"; import Favicon from "../../favicon"; diff --git a/src/vector/platform/WebPlatform.ts b/src/vector/platform/WebPlatform.ts index 6356e41bc3..6ddb5f4740 100644 --- a/src/vector/platform/WebPlatform.ts +++ b/src/vector/platform/WebPlatform.ts @@ -17,13 +17,13 @@ limitations under the License. */ import VectorBasePlatform from './VectorBasePlatform'; -import {UpdateCheckStatus} from "matrix-react-sdk/src/BasePlatform"; +import { UpdateCheckStatus } from "matrix-react-sdk/src/BasePlatform"; import request from 'browser-request'; import dis from 'matrix-react-sdk/src/dispatcher/dispatcher'; -import {_t} from 'matrix-react-sdk/src/languageHandler'; -import {Room} from "matrix-js-sdk/src/models/room"; -import {hideToast as hideUpdateToast, showToast as showUpdateToast} from "matrix-react-sdk/src/toasts/UpdateToast"; -import {Action} from "matrix-react-sdk/src/dispatcher/actions"; +import { _t } from 'matrix-react-sdk/src/languageHandler'; +import { Room } from "matrix-js-sdk/src/models/room"; +import { hideToast as hideUpdateToast, showToast as showUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast"; +import { Action } from "matrix-react-sdk/src/dispatcher/actions"; import { CheckUpdatesPayload } from 'matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload'; import UAParser from 'ua-parser-js';