diff --git a/.eslintrc.json b/.eslintrc.json index adb6c46067..28aca802ea 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,10 +3,23 @@ "jasmine": true }, "extends": "@wireapp/eslint-config", + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "rules": { + "@typescript-eslint/member-ordering": "off", + "@typescript-eslint/typedef": "off", + "no-unused-vars": "off" + } + } + ], + "parserOptions": { + "project": ["./tsconfig.json", "./tsconfig.bin.json", "./tsconfig.mocha.json"] + }, "plugins": ["jasmine"], "rules": { - "handle-callback-err": 2, - "import/no-default-export": 0, - "no-undef": 0 + "import/no-default-export": "off", + "no-magic-numbers": "off", + "no-undef": "off" } } diff --git a/bin/bin-utils.ts b/bin/bin-utils.ts index 53dad71c27..e9d05a9d56 100644 --- a/bin/bin-utils.ts +++ b/bin/bin-utils.ts @@ -51,7 +51,7 @@ export async function restoreFiles({originalPaths, backupPaths, tempDir}: Backup } export const getLogger = (namespace: string, name: string) => - LogFactory.getLogger(name, {namespace: `@wireapp/${namespace}`, forceEnable: true, separator: '/'}); + LogFactory.getLogger(name, {forceEnable: true, namespace: `@wireapp/${namespace}`, separator: '/'}); export function checkCommanderOptions( commanderInstance: typeof commander, diff --git a/bin/build-tools/build-cli.ts b/bin/build-tools/build-cli.ts index 22be9ade8a..68ae63e2ce 100644 --- a/bin/build-tools/build-cli.ts +++ b/bin/build-tools/build-cli.ts @@ -35,7 +35,7 @@ interface CommanderData { } const toolName = path.basename(__filename).replace('.ts', ''); -const logger = LogFactory.getLogger(toolName, {namespace: '@wireapp/build-tools', forceEnable: true}); +const logger = LogFactory.getLogger(toolName, {forceEnable: true, namespace: '@wireapp/build-tools'}); const appSource = path.join(__dirname, '../../'); commander diff --git a/bin/build-tools/lib/build-windows-installer.ts b/bin/build-tools/lib/build-windows-installer.ts index dadd1ee4e5..ffb4a755b5 100755 --- a/bin/build-tools/lib/build-windows-installer.ts +++ b/bin/build-tools/lib/build-windows-installer.ts @@ -17,7 +17,7 @@ * */ -import {Options as electronWinstallerOptions, createWindowsInstaller} from 'electron-winstaller'; +import {createWindowsInstaller, Options as electronWinstallerOptions} from 'electron-winstaller'; import fs from 'fs-extra'; import path from 'path'; @@ -77,7 +77,7 @@ export async function buildWindowsInstallerConfig( commonConfig.updateUrl = windowsConfig.updateUrl; - return {windowsConfig, wInstallerOptions}; + return {wInstallerOptions, windowsConfig}; } export async function buildWindowsInstaller( diff --git a/bin/deploy-tools/hockey-cli.ts b/bin/deploy-tools/hockey-cli.ts index e28268a12c..9a65d66693 100755 --- a/bin/deploy-tools/hockey-cli.ts +++ b/bin/deploy-tools/hockey-cli.ts @@ -21,7 +21,7 @@ import fs from 'fs-extra'; import path from 'path'; import {checkCommanderOptions, getLogger} from '../bin-utils'; -import {FindResult, find, zip} from './lib/deploy-utils'; +import {find, FindResult, zip} from './lib/deploy-utils'; import {HockeyDeployer} from './lib/HockeyDeployer'; const toolName = path.basename(__filename).replace('.ts', ''); @@ -52,9 +52,8 @@ function getUploadFile(platform: string, basePath: string): Promise return find('*-Setup.exe', {cwd: basePath}); } else if (platform.includes('macos')) { return find('*.pkg', {cwd: basePath}); - } else { - throw new Error(`Invalid platform "${platform}"`); } + throw new Error(`Invalid platform "${platform}"`); } (async () => { diff --git a/bin/deploy-tools/lib/GitHubDraftDeployer.test.ts b/bin/deploy-tools/lib/GitHubDraftDeployer.test.ts index fc35c291ce..7910cb5ac9 100644 --- a/bin/deploy-tools/lib/GitHubDraftDeployer.test.ts +++ b/bin/deploy-tools/lib/GitHubDraftDeployer.test.ts @@ -43,7 +43,7 @@ describe('GitHubDraftDeployer', () => { repoSlug: 'wireapp/wire-desktop', }); - await gitHubDraftDeployer.uploadAsset({draftId: 0, filePath: __filename, fileName: path.basename(__filename)}); + await gitHubDraftDeployer.uploadAsset({draftId: 0, fileName: path.basename(__filename), filePath: __filename}); }); }); }); diff --git a/bin/deploy-tools/lib/GitHubDraftDeployer.ts b/bin/deploy-tools/lib/GitHubDraftDeployer.ts index 8b68aba8af..3660472031 100644 --- a/bin/deploy-tools/lib/GitHubDraftDeployer.ts +++ b/bin/deploy-tools/lib/GitHubDraftDeployer.ts @@ -20,7 +20,7 @@ import axios from 'axios'; import fs from 'fs-extra'; import logdown from 'logdown'; -import {TWO_HUNDRED_MB_IN_BYTES, logDry} from './deploy-utils'; +import {logDry, TWO_HUNDRED_MB_IN_BYTES} from './deploy-utils'; /** @see https://developer.github.com/v3/repos/releases/#create-a-release */ export interface GitHubAPIDraftData { @@ -125,7 +125,7 @@ export class GitHubDraftDeployer { }; if (this.options.dryRun) { - logDry('createDraft', {url: draftUrl, draftData}); + logDry('createDraft', {draftData, url: draftUrl}); return {id: 0}; } @@ -159,7 +159,7 @@ export class GitHubDraftDeployer { const url = `${uploadUrl}?name=${fileName}`; if (this.options.dryRun) { - logDry('uploadAsset', {url, file, headers, maxContentLength: TWO_HUNDRED_MB_IN_BYTES}); + logDry('uploadAsset', {file, headers, maxContentLength: TWO_HUNDRED_MB_IN_BYTES, url}); return; } diff --git a/bin/deploy-tools/lib/HockeyDeployer.ts b/bin/deploy-tools/lib/HockeyDeployer.ts index 39eafce031..18e044255a 100755 --- a/bin/deploy-tools/lib/HockeyDeployer.ts +++ b/bin/deploy-tools/lib/HockeyDeployer.ts @@ -22,7 +22,7 @@ import fs from 'fs-extra'; import logdown from 'logdown'; import path from 'path'; -import {TWO_HUNDRED_MB_IN_BYTES, logDry} from './deploy-utils'; +import {logDry, TWO_HUNDRED_MB_IN_BYTES} from './deploy-utils'; const HOCKEY_API_URL = 'https://rink.hockeyapp.net/api/2/apps'; diff --git a/bin/deploy-tools/lib/S3Deployer.ts b/bin/deploy-tools/lib/S3Deployer.ts index cdda3b17aa..244e297fdd 100644 --- a/bin/deploy-tools/lib/S3Deployer.ts +++ b/bin/deploy-tools/lib/S3Deployer.ts @@ -20,7 +20,7 @@ import S3 from 'aws-sdk/clients/s3'; import fs from 'fs-extra'; import path from 'path'; -import {FindResult, find, logDry} from './deploy-utils'; +import {find, FindResult, logDry} from './deploy-utils'; export interface S3DeployerOptions { accessKeyId: string; @@ -96,9 +96,8 @@ export class S3Deployer { } else if (platform.includes('macos')) { const setupPkg = await find('*.pkg', {cwd: basePath}); return [setupPkg]; - } else { - throw new Error(`Invalid platform "${platform}"`); } + throw new Error(`Invalid platform "${platform}"`); } async uploadToS3(uploadOptions: S3UploadOptions): Promise { diff --git a/electron/renderer/src/lib/locale.js b/electron/renderer/src/lib/locale.js index aa8542a9b6..74263e09d1 100644 --- a/electron/renderer/src/lib/locale.js +++ b/electron/renderer/src/lib/locale.js @@ -20,4 +20,4 @@ window.locStrings = window.locStrings || {}; window.locStringsDefault = window.locStringsDefault || {}; -export const getText = id => locStrings[id] || locStringsDefault[id] || id; +export const getText = id => window.locStrings[id] || window.locStringsDefault[id] || id; diff --git a/electron/src/after.test.ts b/electron/src/after.test.ts index d44588d1b3..f6f234d565 100644 --- a/electron/src/after.test.ts +++ b/electron/src/after.test.ts @@ -29,7 +29,7 @@ declare global { } const writeCoverageReport = (coverage: Object) => { - const outputFile = path.join(process.cwd(), `.nyc_output/coverage.${process['type']}.json`); + const outputFile = path.join(process.cwd(), `.nyc_output/coverage.${process.type}.json`); fs.outputJsonSync(outputFile, coverage); }; diff --git a/electron/src/lib/CertificateVerifyProcManager.ts b/electron/src/lib/CertificateVerifyProcManager.ts index 2b034d7b65..9fd4b511b2 100644 --- a/electron/src/lib/CertificateVerifyProcManager.ts +++ b/electron/src/lib/CertificateVerifyProcManager.ts @@ -18,7 +18,7 @@ */ import * as certificateUtils from '@wireapp/certificate-check'; -import {BrowserWindow, Certificate, ProcRequest, dialog} from 'electron'; +import {BrowserWindow, Certificate, dialog, ProcRequest} from 'electron'; import * as fs from 'fs-extra'; import * as path from 'path'; diff --git a/electron/src/lib/LocalAccountDeletion.ts b/electron/src/lib/LocalAccountDeletion.ts index e3768ed228..257b95b07e 100644 --- a/electron/src/lib/LocalAccountDeletion.ts +++ b/electron/src/lib/LocalAccountDeletion.ts @@ -18,7 +18,7 @@ */ import {ValidationUtil} from '@wireapp/commons'; -import {Session, app, webContents} from 'electron'; +import {app, Session, webContents} from 'electron'; import * as fs from 'fs-extra'; import * as path from 'path'; diff --git a/electron/src/lib/download.ts b/electron/src/lib/download.ts index 5b21b4288f..3adf5b8665 100644 --- a/electron/src/lib/download.ts +++ b/electron/src/lib/download.ts @@ -17,7 +17,7 @@ * */ -import {SaveDialogOptions, dialog} from 'electron'; +import {dialog, SaveDialogOptions} from 'electron'; import * as fs from 'fs-extra'; import imageType from 'image-type'; import * as moment from 'moment'; diff --git a/electron/src/lib/openGraph.test.main.ts b/electron/src/lib/openGraph.test.main.ts index 7be28e48a8..aa938ea7a1 100644 --- a/electron/src/lib/openGraph.test.main.ts +++ b/electron/src/lib/openGraph.test.main.ts @@ -28,7 +28,7 @@ const defaultMessageUtf8 = [72, 101, 108, 108, 111, 32, 102, 114, 111, 109, 32, const russianMessage = 'Привет из нока!'; const russianMessageKoi8r = [240, 210, 201, 215, 197, 212, 32, 201, 218, 32, 206, 207, 203, 193, 33]; -/* tslint:disable-next-line */ +// eslint-disable-next-line const russianMessageUtf8 = [208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130, 32, 208, 184, 208, 183, 32, 208, 189, 208, 190, 208, 186, 208, 176, 33]; const contentLimitRequest = (contentType: string, contentArray: number[]) => { diff --git a/electron/src/lib/openGraph.ts b/electron/src/lib/openGraph.ts index f529f29afc..b302fa5235 100644 --- a/electron/src/lib/openGraph.ts +++ b/electron/src/lib/openGraph.ts @@ -18,7 +18,7 @@ */ import axios, {AxiosRequestConfig, AxiosResponse} from 'axios'; -import {ParsedMediaType, parse as parseContentType} from 'content-type'; +import {parse as parseContentType, ParsedMediaType} from 'content-type'; import {IncomingMessage} from 'http'; import {decode as iconvDecode} from 'iconv-lite'; import {Data as OpenGraphResult, parse as openGraphParse} from 'open-graph'; @@ -205,8 +205,7 @@ export const getOpenGraphDataAsync = async (url: string): Promise { diff --git a/electron/src/main.ts b/electron/src/main.ts index 7bce53a4f7..3931137639 100644 --- a/electron/src/main.ts +++ b/electron/src/main.ts @@ -19,17 +19,17 @@ import {LogFactory, ValidationUtil} from '@wireapp/commons'; import { + app, BrowserWindow, BrowserWindowConstructorOptions, Event as ElectronEvent, Filter, HeadersReceivedResponse, + ipcMain, Menu, OnHeadersReceivedListenerDetails, - WebContents, - app, - ipcMain, shell, + WebContents, } from 'electron'; import WindowStateKeeper = require('electron-window-state'); import fileUrl = require('file-url'); @@ -92,7 +92,7 @@ const BASE_URL = EnvironmentUtil.web.getWebappUrl(argv.env); const logger = getLogger(path.basename(__filename)); if (argv.version) { - console.log(config.version); + console.info(config.version); process.exit(); } @@ -209,7 +209,9 @@ const showMainWindow = async (mainWindowState: WindowStateKeeper.State) => { webviewTag: true, }, width: mainWindowState.width, + // eslint-disable-next-line x: mainWindowState.x, + // eslint-disable-next-line y: mainWindowState.y, }; diff --git a/electron/src/menu/TrayHandler.ts b/electron/src/menu/TrayHandler.ts index f7de4fb829..b928f5b3ba 100644 --- a/electron/src/menu/TrayHandler.ts +++ b/electron/src/menu/TrayHandler.ts @@ -17,7 +17,7 @@ * */ -import {BrowserWindow, Menu, Tray, app, nativeImage} from 'electron'; +import {app, BrowserWindow, Menu, nativeImage, Tray} from 'electron'; import * as path from 'path'; import * as locale from '../locale/locale'; diff --git a/electron/src/menu/developer.ts b/electron/src/menu/developer.ts index b3f9655213..a1425db5f5 100644 --- a/electron/src/menu/developer.ts +++ b/electron/src/menu/developer.ts @@ -17,7 +17,7 @@ * */ -import {MenuItem, MenuItemConstructorOptions, app, dialog} from 'electron'; +import {app, dialog, MenuItem, MenuItemConstructorOptions} from 'electron'; import * as openExternal from 'open'; import * as path from 'path'; diff --git a/electron/src/menu/system.ts b/electron/src/menu/system.ts index f1e401020a..52e970391d 100644 --- a/electron/src/menu/system.ts +++ b/electron/src/menu/system.ts @@ -18,21 +18,20 @@ */ import autoLaunch = require('auto-launch'); -import {Menu, MenuItemConstructorOptions, dialog, globalShortcut, ipcMain, shell} from 'electron'; +import {dialog, globalShortcut, ipcMain, Menu, MenuItemConstructorOptions, shell} from 'electron'; import * as path from 'path'; +import {Supportedi18nLanguage} from '../interfaces/'; import {EVENT_TYPE} from '../lib/eventType'; import * as locale from '../locale/locale'; import {getLogger} from '../logging/getLogger'; +import * as EnvironmentUtil from '../runtime/EnvironmentUtil'; import * as lifecycle from '../runtime/lifecycle'; import {config} from '../settings/config'; import {settings} from '../settings/ConfigurationPersistence'; import {SettingsType} from '../settings/SettingsType'; import {WindowManager} from '../window/WindowManager'; -import {Supportedi18nLanguage} from '../interfaces/'; -import * as EnvironmentUtil from '../runtime/EnvironmentUtil'; - const launchCmd = process.env.APPIMAGE || process.execPath; const logger = getLogger(path.basename(__filename)); @@ -413,7 +412,7 @@ export const createMenu = (isFullScreen: boolean): Menu => { visible: false, }; - const switchShortcuts: MenuItemConstructorOptions[] = Array.from({length: config.maximumAccounts}, (_, index) => { + const switchShortcuts: MenuItemConstructorOptions[] = Array.from({length: config.maximumAccounts}, (key, index) => { const switchAccelerator = `Ctrl+${index + 1}`; return { @@ -472,7 +471,7 @@ export const registerGlobalShortcuts = (): void => { WindowManager.sendActionToPrimaryWindow(EVENT_TYPE.UI.SYSTEM_MENU, EVENT_TYPE.CONVERSATION.TOGGLE_MUTE), ); - Array.from({length: config.maximumAccounts}, (_, index) => { + Array.from({length: config.maximumAccounts}, (key, index) => { const switchAccelerator = `CmdOrCtrl+${index + 1}`; logger.info(`Registering global account switching shortcut "${switchAccelerator}" ...`); diff --git a/electron/src/renderer/menu/context.ts b/electron/src/renderer/menu/context.ts index 677317e639..db0888c38d 100644 --- a/electron/src/renderer/menu/context.ts +++ b/electron/src/renderer/menu/context.ts @@ -17,7 +17,7 @@ * */ -import {Menu as ElectronMenu, MenuItemConstructorOptions, clipboard, ipcRenderer, remote} from 'electron'; +import {clipboard, ipcRenderer, Menu as ElectronMenu, MenuItemConstructorOptions, remote} from 'electron'; const Menu = remote.Menu; import {EVENT_TYPE} from '../../lib/eventType'; @@ -92,7 +92,7 @@ window.addEventListener( const parentElement = element.closest('.message-body') as HTMLDivElement; const timeElement = parentElement.getElementsByTagName('time')[0]; if (timeElement) { - const imageTimestamp = timeElement.dataset['timestamp']; + const imageTimestamp = timeElement.dataset.timestamp; imageMenu.timestamp = imageTimestamp; } imageMenu.image = elementSource; diff --git a/electron/src/renderer/menu/preload-about.ts b/electron/src/renderer/menu/preload-about.ts index 1e688c90c0..9803e29e5b 100644 --- a/electron/src/renderer/menu/preload-about.ts +++ b/electron/src/renderer/menu/preload-about.ts @@ -25,7 +25,7 @@ ipcRenderer.once(EVENT_TYPE.ABOUT.LOCALE_RENDER, (event, labels: string[]) => { for (const label in labels) { const labelElement = document.querySelector(`[data-string="${label}"]`); if (labelElement) { - labelElement.innerHTML = labels[label]; + labelElement.textContent = labels[label]; } } }); @@ -40,22 +40,22 @@ interface Details { export function loadedAboutScreen(event: Event, details: Details): void { const nameElement = document.getElementById('name'); if (nameElement) { - nameElement.innerHTML = details.productName; + nameElement.textContent = details.productName; } const versionElement = document.getElementById('version'); if (versionElement) { - versionElement.innerHTML = details.electronVersion; + versionElement.textContent = details.electronVersion; } const webappVersionElement = document.getElementById('webappVersion'); if (webappVersionElement) { - webappVersionElement.innerHTML = details.webappVersion; + webappVersionElement.textContent = details.webappVersion; } const copyrightElement = document.getElementById('copyright'); if (copyrightElement) { - copyrightElement.innerHTML = details.copyright; + copyrightElement.textContent = details.copyright; } const logoElement = document.getElementById('logo') as HTMLImageElement; diff --git a/electron/src/renderer/menu/preload-proxy-prompt.ts b/electron/src/renderer/menu/preload-proxy-prompt.ts index 77495f1c1b..00ddcfbf6d 100644 --- a/electron/src/renderer/menu/preload-proxy-prompt.ts +++ b/electron/src/renderer/menu/preload-proxy-prompt.ts @@ -25,7 +25,7 @@ ipcRenderer.once(EVENT_TYPE.PROXY_PROMPT.LOCALE_RENDER, (event, labels: string[] for (const label in labels) { const labelElement = document.querySelector(`[data-string="${label}"]`); if (labelElement) { - labelElement.innerHTML = labels[label]; + labelElement.textContent = labels[label]; } } }); diff --git a/electron/src/renderer/preload-app.ts b/electron/src/renderer/preload-app.ts index d02b59aaf8..026ef68ee7 100644 --- a/electron/src/renderer/preload-app.ts +++ b/electron/src/renderer/preload-app.ts @@ -17,7 +17,7 @@ * */ -import {WebviewTag, ipcRenderer, webFrame} from 'electron'; +import {ipcRenderer, webFrame, WebviewTag} from 'electron'; import * as path from 'path'; import {EVENT_TYPE} from '../lib/eventType'; @@ -108,10 +108,11 @@ const setupIpcInterface = (): void => { return new Promise((resolve, reject) => { const accountWebview = getWebviewById(accountID); if (!accountWebview) { + // eslint-disable-next-line return reject(`Webview for account "${accountID}" does not exist`); } - console.log(`Processing deletion of "${accountID}"`); + console.info(`Processing deletion of "${accountID}"`); const viewInstanceId = accountWebview.getWebContents().id; ipcRenderer.on(EVENT_TYPE.ACCOUNT.DATA_DELETED, () => resolve()); ipcRenderer.send(EVENT_TYPE.ACCOUNT.DELETE_DATA, viewInstanceId, accountID, sessionID); diff --git a/electron/src/renderer/preload-sso.ts b/electron/src/renderer/preload-sso.ts index 328fd75ce8..758b5ad9b0 100644 --- a/electron/src/renderer/preload-sso.ts +++ b/electron/src/renderer/preload-sso.ts @@ -22,7 +22,7 @@ const {SingleSignOn} = remote.require('./sso/SingleSignOn'); // Only execute the helper if the origin is the backend if (typeof document.location?.origin === 'string' && SingleSignOn.isBackendOrigin(document.location.origin)) { - // tslint:disable-next-line:no-floating-promises + //eslint-disable-next-line @typescript-eslint/no-floating-promises (async () => { // `window.opener` is not available when sandbox is activated, // therefore we need to fake the function on backend area and diff --git a/electron/src/sso/SingleSignOn.ts b/electron/src/sso/SingleSignOn.ts index 1364d88ce6..4b53e090ae 100644 --- a/electron/src/sso/SingleSignOn.ts +++ b/electron/src/sso/SingleSignOn.ts @@ -17,20 +17,21 @@ * */ +const minimist = require('minimist'); + import * as crypto from 'crypto'; import { + app, BrowserWindow, BrowserWindowConstructorOptions, Event as ElectronEvent, ProtocolRequest, Session, - WebContents, - app, session, + WebContents, } from 'electron'; import * as path from 'path'; import {URL} from 'url'; -const minimist = require('minimist'); import {getLogger} from '../logging/getLogger'; import {config} from '../settings/config'; diff --git a/electron/src/window/AboutWindow.ts b/electron/src/window/AboutWindow.ts index 965c564984..02cf2c0cc4 100644 --- a/electron/src/window/AboutWindow.ts +++ b/electron/src/window/AboutWindow.ts @@ -17,7 +17,7 @@ * */ -import {BrowserWindow, app, ipcMain, session, shell} from 'electron'; +import {app, BrowserWindow, ipcMain, session, shell} from 'electron'; import fileUrl = require('file-url'); import * as path from 'path'; @@ -91,7 +91,7 @@ const showWindow = async () => { if (url.startsWith('https://')) { await shell.openExternal(url); } else { - console.log('Attempt to open URL in window prevented, url:', url); + console.info('Attempt to open URL in window prevented, url:', url); } callback({redirectURL: ABOUT_HTML}); diff --git a/electron/src/window/ProxyPromptWindow.ts b/electron/src/window/ProxyPromptWindow.ts index 9e7229f1f9..6e8d7cb6e5 100644 --- a/electron/src/window/ProxyPromptWindow.ts +++ b/electron/src/window/ProxyPromptWindow.ts @@ -17,7 +17,7 @@ * */ -import {BrowserWindow, app, ipcMain, session} from 'electron'; +import {app, BrowserWindow, ipcMain, session} from 'electron'; import fileUrl = require('file-url'); import * as path from 'path'; diff --git a/electron/src/window/WindowManager.ts b/electron/src/window/WindowManager.ts index d635b6e91b..ea5ce59a1f 100644 --- a/electron/src/window/WindowManager.ts +++ b/electron/src/window/WindowManager.ts @@ -17,7 +17,7 @@ * */ -import {BrowserWindow, app} from 'electron'; +import {app, BrowserWindow} from 'electron'; import * as path from 'path'; import {getLogger} from '../logging/getLogger'; diff --git a/electron/src/window/WindowUtil.ts b/electron/src/window/WindowUtil.ts index 10e5187e2c..e3ec74eea2 100644 --- a/electron/src/window/WindowUtil.ts +++ b/electron/src/window/WindowUtil.ts @@ -47,4 +47,4 @@ const isInView = (win: BrowserWindow): boolean => { return upperLeftVisible || lowerRightVisible; }; -export const WindowUtil = {pointInRectangle, isInView}; +export const WindowUtil = {isInView, pointInRectangle}; diff --git a/package.json b/package.json index 1e085b572f..e566805159 100644 --- a/package.json +++ b/package.json @@ -53,11 +53,12 @@ "@types/raygun": "0.10.2", "@types/sinon": "7.5.1", "@types/uuid": "3.4.6", + "@typescript-eslint/eslint-plugin": "2.11.0", + "@typescript-eslint/parser": "2.11.0", "@wireapp/copy-config": "1.0.0", "@wireapp/deploy-tools": "0.1.12", - "@wireapp/eslint-config": "1.3.0", + "@wireapp/eslint-config": "1.3.0-beta.14", "@wireapp/prettier-config": "0.3.0", - "@wireapp/tslint-config": "1.4.1", "aws-sdk": "2.562.0", "babel-core": "7.0.0-bridge.0", "babel-eslint": "10.0.3", @@ -83,6 +84,7 @@ "eslint-plugin-no-unsanitized": "3.0.2", "eslint-plugin-prettier": "3.1.2", "eslint-plugin-react": "7.17.0", + "eslint-plugin-react-hooks": "2.3.0", "eslint-plugin-simple-import-sort": "5.0.0", "eslint-plugin-sort-keys-fix": "1.1.0", "form-data": "3.0.0", @@ -100,11 +102,6 @@ "sinon": "7.5.0", "style-loader": "1.0.1", "ts-node": "8.5.4", - "tslint": "5.20.1", - "tslint-config-prettier": "1.18.0", - "tslint-plugin-prettier": "2.0.1", - "tslint-react": "4.1.0", - "tslint-react-hooks": "2.2.1", "typescript": "3.7.3", "webpack": "4.41.2", "webpack-cli": "3.3.10", @@ -119,22 +116,10 @@ }, "license": "GPL-3.0", "lint-staged": { - "*.{js,jsx}": [ + "*.{js,jsx,ts}": [ "eslint --fix", "git add" ], - "bin/**/*.ts": [ - "tslint --project tsconfig.bin.json --fix", - "git add" - ], - "electron/**/!(*.test*).ts": [ - "tslint --project tsconfig.json --fix", - "git add" - ], - "electron/**/*.test*.ts": [ - "tslint --project tsconfig.mocha.json --fix", - "git add" - ], "*.{json,md,css,yml,html}": [ "prettier --write", "git add" @@ -169,18 +154,12 @@ "clear:wrap": "rimraf wrap", "configure": "copy-config", "coverage": "yarn clear:coverage && nyc report", - "fix": "yarn fix:js && yarn fix:other && yarn fix:ts && yarn fix:ts:tests && yarn fix:ts:bin", - "fix:js": "yarn lint:js --fix", + "fix": "yarn fix:code && yarn fix:other", + "fix:code": "yarn lint:code --fix", "fix:other": "yarn prettier --write", - "fix:ts": "yarn lint:ts --fix", - "fix:ts:bin": "yarn lint:ts:bin --fix", - "fix:ts:tests": "yarn lint:ts:tests --fix", - "lint": "yarn lint:js && yarn lint:other && yarn lint:ts && yarn lint:ts:tests && yarn lint:ts:bin", - "lint:js": "eslint --ignore-path .gitignore --ext .js,.jsx .", + "lint": "yarn lint:code && yarn lint:other", + "lint:code": "eslint --ignore-path .gitignore --ext .js,.jsx,.ts,.tsx .", "lint:other": "yarn prettier --list-different", - "lint:ts": "tslint --project tsconfig.json", - "lint:ts:bin": "tslint --project tsconfig.bin.json", - "lint:ts:tests": "tslint --project tsconfig.mocha.json", "postinstall": "yarn configure", "prestart": "yarn build:ts && yarn bundle:dev", "prettier": "prettier \"**/*.{json,md,css,yml,html}\"", diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 531cc4716e..0000000000 --- a/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": ["@wireapp/tslint-config"], - "linterOptions": { - "exclude": ["**/dist/**", "**/node_modules/**"] - } -} diff --git a/yarn.lock b/yarn.lock index 74026324fe..215e5164a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1126,6 +1126,11 @@ electron-notarize "^0.1.1" electron-osx-sign "^0.4.11" +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/events@*": version "3.0.0" resolved "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -1174,6 +1179,11 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/json-schema@^7.0.3": + version "7.0.3" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" + integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== + "@types/jszip@3.1.6": version "3.1.6" resolved "https://registry.npmjs.org/@types/jszip/-/jszip-3.1.6.tgz#0512574a2b35f3194b41769c56e4b35065e67000" @@ -1262,6 +1272,49 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@2.11.0": + version "2.11.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.11.0.tgz#4477c33491ccf0a9a3f4a30ef84978fa0ea0cad2" + integrity sha512-G2HHA1vpMN0EEbUuWubiCCfd0R3a30BB+UdvnFkxwZIxYEGOrWEXDv8tBFO9f44CWc47Xv9lLM3VSn4ORLI2bA== + dependencies: + "@typescript-eslint/experimental-utils" "2.11.0" + eslint-utils "^1.4.3" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@2.11.0": + version "2.11.0" + resolved "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.11.0.tgz#cef18e6b122706c65248a5d8984a9779ed1e52ac" + integrity sha512-YxcA/y0ZJaCc/fB/MClhcDxHI0nOBB7v2/WxBju2cOTanX7jO9ttQq6Fy4yW9UaY5bPd9xL3cun3lDVqk67sPQ== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.11.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@2.11.0": + version "2.11.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.11.0.tgz#cdcc3be73ee31cbef089af5ff97ccaa380ef6e8b" + integrity sha512-DyGXeqhb3moMioEFZIHIp7oXBBh7dEfPTzGrlyP0Mi9ScCra4SWEGs3kPd18mG7Sy9Wy8z88zmrw5tSGL6r/6A== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.11.0" + "@typescript-eslint/typescript-estree" "2.11.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.11.0": + version "2.11.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.11.0.tgz#21ada6504274cd1644855926312c798fc697e9fb" + integrity sha512-HGY4+d4MagO6cKMcKfIKaTMxcAv7dEVnji2Zi+vi5VV8uWAM631KjAB5GxFcexMYrwKT0EekRiiGK1/Sd7VFGA== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -1458,21 +1511,16 @@ jszip "3.2.2" logdown "3.2.8" -"@wireapp/eslint-config@1.3.0": - version "1.3.0" - resolved "https://registry.npmjs.org/@wireapp/eslint-config/-/eslint-config-1.3.0.tgz#61054d638eb2ec6ea29b0d9c0f2a759a29a1907c" - integrity sha512-MZZOrecOgtT/8L3HbDqXrdutbwKWkZtjA+pGmvLkrZRa1koPz3Aj0LDp7uzgbVMBgAGdVQKW7nGlTskeIqGGEg== +"@wireapp/eslint-config@1.3.0-beta.14": + version "1.3.0-beta.14" + resolved "https://registry.npmjs.org/@wireapp/eslint-config/-/eslint-config-1.3.0-beta.14.tgz#d81ca1d00074aade6e3b75965ac7c54cb9486dc3" + integrity sha512-Q4mKClW+XVMofoPXRSNJ0ShqVXPYXI0pEfcIioocy3FJ2SZ+VvA6Zmu2a2ER4zptb26FTWMcY24e2t3MlrfRIA== "@wireapp/prettier-config@0.3.0": version "0.3.0" resolved "https://registry.npmjs.org/@wireapp/prettier-config/-/prettier-config-0.3.0.tgz#e8129b31021c81d90d564d9c4ff0f7f7b514e943" integrity sha512-BFokvX4NZlkhWq5/OoJUCS8Iels+MeRgzpd5V9QR3hj5swwCFGxJOAL7soPXkSNWo91gI1qwiTp8szB1O9aCfQ== -"@wireapp/tslint-config@1.4.1": - version "1.4.1" - resolved "https://registry.npmjs.org/@wireapp/tslint-config/-/tslint-config-1.4.1.tgz#2089af720f65279d696293cbc3ca13063529139a" - integrity sha512-hPoEUTlnjJ38r/NDHMhfCgWQAue4Q3Zf8iWQeLKn/aOxUVQTEY1/oALplooKwoX/ei5KulBQveEu/foBQ2TYsw== - "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -2264,11 +2312,6 @@ builder-util@10.1.2, builder-util@~10.1.2: stat-mode "^0.3.0" temp-file "^3.3.3" -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= - builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" @@ -2611,7 +2654,7 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@2.20.0, commander@^2.12.1, commander@^2.20.0, commander@~2.20.0: +commander@2.20.0, commander@^2.20.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -3723,13 +3766,10 @@ eslint-plugin-prettier@3.1.2: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-prettier@^2.2.0: - version "2.7.0" - resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz#b4312dcf2c1d965379d7f9d5b5f8aaadc6a45904" - integrity sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA== - dependencies: - fast-diff "^1.1.1" - jest-docblock "^21.0.0" +eslint-plugin-react-hooks@2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.3.0.tgz#53e073961f1f5ccf8dd19558036c1fac8c29d99a" + integrity sha512-gLKCa52G4ee7uXzdLiorca7JIQZPPXRAQDXV83J4bUEeUuc5pIEyZYAZ45Xnxe5IuupxEqHS+hUhSLIimK1EMw== eslint-plugin-react@7.17.0: version "7.17.0" @@ -4049,7 +4089,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-diff@^1.1.1, fast-diff@^1.1.2: +fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== @@ -4588,6 +4628,18 @@ glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global-agent@^2.0.2: version "2.1.5" resolved "https://registry.npmjs.org/global-agent/-/global-agent-2.1.5.tgz#0e9b8367f7068bb6fa360a8f920499e1d873762f" @@ -5612,11 +5664,6 @@ jest-diff@^24.9.0: jest-get-type "^24.9.0" pretty-format "^24.9.0" -jest-docblock@^21.0.0: - version "21.2.0" - resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" - integrity sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw== - jest-docblock@^24.3.0: version "24.9.0" resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" @@ -6392,6 +6439,11 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "^3.0.0" +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash@4.17.15, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.5: version "4.17.15" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" @@ -8165,6 +8217,11 @@ regexpp@^2.0.1: resolved "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regexpp@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" + integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + regexpu-core@^4.6.0: version "4.6.0" resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" @@ -9328,64 +9385,12 @@ ts-node@8.5.4: source-map-support "^0.5.6" yn "^3.0.0" -tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.8.1, tslib@^1.9.0: version "1.10.0" resolved "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint-config-prettier@1.18.0: - version "1.18.0" - resolved "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" - integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - -tslint-plugin-prettier@2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.0.1.tgz#95b6a3b766622ffc44375825d7760225c50c3680" - integrity sha512-4FX9JIx/1rKHIPJNfMb+ooX1gPk5Vg3vNi7+dyFYpLO+O57F4g+b/fo1+W/G0SUOkBLHB/YKScxjX/P+7ZT/Tw== - dependencies: - eslint-plugin-prettier "^2.2.0" - lines-and-columns "^1.1.6" - tslib "^1.7.1" - -tslint-react-hooks@2.2.1: - version "2.2.1" - resolved "https://registry.npmjs.org/tslint-react-hooks/-/tslint-react-hooks-2.2.1.tgz#c52c7df65ee1517b2d6c92bc716e9ef72ccdf208" - integrity sha512-bqIg2uZe+quJMfSOGc4OOZ4awo6TP1ejGDGS6IKg2WIrS0XnWfhUJ99i3B8rUpnZhuD4vRSvyYIbXPUmEqQxxQ== - -tslint-react@4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-4.1.0.tgz#7153b724a8cfbea52423d0ffa469e8eba3bcc834" - integrity sha512-Y7CbFn09X7Mpg6rc7t/WPbmjx9xPI8p1RsQyiGCLWgDR6sh3+IBSlT+bEkc0PSZcWwClOkqq2wPsID8Vep6szQ== - dependencies: - tsutils "^3.9.1" - -tslint@5.20.1: - version "5.20.1" - resolved "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz#e401e8aeda0152bc44dd07e614034f3f80c67b7d" - integrity sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.1" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.8.0" - tsutils "^2.29.0" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - -tsutils@^3.9.1: +tsutils@^3.17.1: version "3.17.1" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== @@ -9842,7 +9847,6 @@ winreg@1.2.4: "wire-web-config-internal@https://github.com/wireapp/wire-web-config-default#v0.24.28": version "0.24.28" - uid "309fdda66830ad3ad27c7e3c9e4d8003403e628e" resolved "https://github.com/wireapp/wire-web-config-default#309fdda66830ad3ad27c7e3c9e4d8003403e628e" dependencies: adm-zip "0.4.13" @@ -9850,7 +9854,6 @@ winreg@1.2.4: "wire-web-config-production@https://github.com/wireapp/wire-web-config-wire#v0.24.28-0": version "0.24.28-0" - uid "506d4020451707be773d90f7c826d37cf5c8eca4" resolved "https://github.com/wireapp/wire-web-config-wire#506d4020451707be773d90f7c826d37cf5c8eca4" dependencies: adm-zip "0.4.13"