From 496cacb8c8a8475270f820c5e0dbb2f74f4947a2 Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 30 Aug 2017 12:40:43 +0900 Subject: [PATCH] update dependencies and fix lint errors --- main/account_switcher.ts | 3 +- main/window.ts | 2 + package.json | 14 ++--- renderer/key_handler.ts | 4 +- typings/menubar.d.ts | 112 +++++++++++++++++++-------------------- 5 files changed, 69 insertions(+), 66 deletions(-) diff --git a/main/account_switcher.ts b/main/account_switcher.ts index 8138c50..d9011e0 100644 --- a/main/account_switcher.ts +++ b/main/account_switcher.ts @@ -49,7 +49,8 @@ export default class AccountSwitcher extends EventEmitter { submenu, }); - const menu = Menu.getApplicationMenu(); + // Note: Electron's type definitions don't support nullable types yet. + const menu = Menu.getApplicationMenu() as Electron.Menu | null; if (menu !== null) { // Insert item before 'Help' menu.insert(menu.items.length - 1, item); diff --git a/main/window.ts b/main/window.ts index c6ad2d4..62b16af 100644 --- a/main/window.ts +++ b/main/window.ts @@ -34,7 +34,9 @@ export default class Window { public browser: Electron.BrowserWindow, public state: any /*XXX: ElectronWindowState.WindowState */, public account: Account, + /* tslint:disable:no-shadowed-variable */ public menubar: Menubar.MenubarApp | null, + /* tslint:enable:no-shadowed-variable */ ) { if (!IS_DARWIN) { // Users can still access menu bar with pressing Alt key. diff --git a/package.json b/package.json index 62c0e96..6943127 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build:bundle:release": "NODE_ENV=production browserify -x electron renderer/index.js -o renderer/preload.js", "build:release": "npm run build:ts && npm run build:bundle:release", "test": "echo \"Error: no test specified\" && exit 1", - "lint": "tslint --project tsconfig.json --type-check $(git ls-files | grep -E \"\\.ts$\")", + "lint": "tslint --project tsconfig.json --type-check", "watch": "guard --watchdir main renderer typings", "debug": "NODE_ENV=development electron .", "start": "NODE_ENV=production electron .", @@ -38,14 +38,14 @@ "homepage": "https://github.com/rhysd/Mstdn#readme", "devDependencies": { "@types/electron-window-state": "^2.0.29", - "@types/loglevel": "^1.4.29", + "@types/loglevel": "^1.4.30", "@types/mousetrap": "^1.5.34", - "@types/node": "^8.0.0", + "@types/node": "^8.0.26", "browserify": "^14.4.0", - "electron-packager": "^8.7.1", - "npm-run-all": "^4.0.2", - "tslint": "^5.4.3", - "typescript": "^2.3.4" + "electron-packager": "^9.0.0", + "npm-run-all": "^4.1.1", + "tslint": "^5.7.0", + "typescript": "^2.4.2" }, "dependencies": { "electron": "^1.7.5", diff --git a/renderer/key_handler.ts b/renderer/key_handler.ts index 4e999e8..4b56f3c 100644 --- a/renderer/key_handler.ts +++ b/renderer/key_handler.ts @@ -1,4 +1,4 @@ -import * as path from 'path'; +import {join} from 'path'; import {remote} from 'electron'; import * as Mousetrap from 'mousetrap'; import * as Ipc from './ipc'; @@ -71,7 +71,7 @@ export default function setupKeymaps( log.info('Loading external script is limited because Chromium sandbox is enabled. Disable shortcut:', action); continue; } - const script = path.join(dataDir, action); + const script = join(dataDir, action); let plugin: (c: Config, a: Account) => void; try { diff --git a/typings/menubar.d.ts b/typings/menubar.d.ts index 2c87404..f8f642c 100644 --- a/typings/menubar.d.ts +++ b/typings/menubar.d.ts @@ -1,61 +1,61 @@ declare namespace Menubar { - type Position - = "trayLeft" - | "trayBottomLeft" - | "trayRight" - | "trayBottomRight" - | "trayCenter" - | "trayBottomCenter" - | "topLeft" - | "topRight" - | "bottomLeft" - | "bottomRight" - | "topCenter" - | "bottomCenter" - | "center"; - type TrayBounds - = "trayLeft" - | "trayBottomLeft" - | "trayRight" - | "trayBottomRight" - | "trayCenter" - | "trayBottomCenter"; - interface ElectronPositioner { - move(pos: Position): void; - calculate(pos: Position, bounds?: TrayBounds): Electron.Point; - } - class MenubarApp extends NodeJS.EventEmitter { - app: Electron.App; - window: Electron.BrowserWindow; - tray: Electron.Tray; - positioner: ElectronPositioner; + type Position + = 'trayLeft' + | 'trayBottomLeft' + | 'trayRight' + | 'trayBottomRight' + | 'trayCenter' + | 'trayBottomCenter' + | 'topLeft' + | 'topRight' + | 'bottomLeft' + | 'bottomRight' + | 'topCenter' + | 'bottomCenter' + | 'center'; + type TrayBounds + = 'trayLeft' + | 'trayBottomLeft' + | 'trayRight' + | 'trayBottomRight' + | 'trayCenter' + | 'trayBottomCenter'; + interface ElectronPositioner { + move(pos: Position): void; + calculate(pos: Position, bounds?: TrayBounds): Electron.Point; + } + class MenubarApp extends NodeJS.EventEmitter { + app: Electron.App; + window: Electron.BrowserWindow; + tray: Electron.Tray; + positioner: ElectronPositioner; - setOption(opt: string, value: any): void; - getOption(opt: string): any; - showWindow(): void; - hideWindow(): void; - } - interface MenubarOptions extends Electron.BrowserWindowConstructorOptions { - dir?: string; - index?: string; - tooltip?: string; - tray?: Electron.Tray; - icon?: string; - width?: number; - height?: number; - show?: boolean; - preloadWindow?: boolean; - alwaysOnTop?: boolean; - showOnAllWorkspaces?: boolean; - windowPosition?: Position; - showDockIcon?: boolean; - showOnRightClick?: boolean; - autoHideMenuBar?: boolean; - webPreferences?: Electron.WebPreferences; - } + setOption(opt: string, value: any): void; + getOption(opt: string): any; + showWindow(): void; + hideWindow(): void; + } + interface MenubarOptions extends Electron.BrowserWindowConstructorOptions { + dir?: string; + index?: string; + tooltip?: string; + tray?: Electron.Tray; + icon?: string; + width?: number; + height?: number; + show?: boolean; + preloadWindow?: boolean; + alwaysOnTop?: boolean; + showOnAllWorkspaces?: boolean; + windowPosition?: Position; + showDockIcon?: boolean; + showOnRightClick?: boolean; + autoHideMenuBar?: boolean; + webPreferences?: Electron.WebPreferences; + } } -declare module "menubar" { - const ctor: (opts?: Menubar.MenubarOptions) => Menubar.MenubarApp; - export = ctor; +declare module 'menubar' { + const ctor: (opts?: Menubar.MenubarOptions) => Menubar.MenubarApp; + export = ctor; }