From 3920b694275c8b3a7e77b4d607907ee4ea84f46a Mon Sep 17 00:00:00 2001 From: Martin Zagora Date: Mon, 29 Aug 2016 23:53:31 +1000 Subject: [PATCH] use typescript-eslint-parser to lint sources --- .brackets.json | 2 +- .eslintrc.json | 5 ++-- app/auto-updater.ts | 72 ++++++++++++++++++++++----------------------- package.json | 1 + 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/.brackets.json b/.brackets.json index 258a2231448..24b6ad6aa98 100644 --- a/.brackets.json +++ b/.brackets.json @@ -32,7 +32,7 @@ "linting.usePreferredOnly": true }, "typescript": { - "linting.prefer": ["TypeScript"], + "linting.prefer": ["TypeScript", "ESLint"], "linting.usePreferredOnly": true } }, diff --git a/.eslintrc.json b/.eslintrc.json index 5b8792a5173..e6eff962ecc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { + "parser": "typescript-eslint-parser", "parserOptions": { - "ecmaVersion": 6 + "sourceType": "module" }, "rules": { "no-bitwise": 0, @@ -43,7 +44,7 @@ "new-parens": 2, "no-new-object": 2, "no-invalid-this": 0, - "indent": [0, 4], + "indent": [1, 4], "valid-jsdoc": 0, "valid-typeof": 2, diff --git a/app/auto-updater.ts b/app/auto-updater.ts index c476e5334e1..a44bbe7c09a 100644 --- a/app/auto-updater.ts +++ b/app/auto-updater.ts @@ -6,45 +6,45 @@ const log = getLogger("auto-updater"); const UPDATE_SERVER_HOST = "brackets-electron-nuts.herokuapp.com"; function notify(title: string, message: string) { - let windows = BrowserWindow.getAllWindows(); - if (windows.length === 0) { - return; - } - windows[0].webContents.send("notify", title, message); + let windows = BrowserWindow.getAllWindows(); + if (windows.length === 0) { + return; + } + windows[0].webContents.send("notify", title, message); } export default class AppUpdater { - constructor(window: Electron.BrowserWindow) { - if (isDev()) { - return; - } - - const version = app.getVersion(); - autoUpdater.addListener("update-available", (event: any) => { - log.info("A new update is available"); - }); - autoUpdater.addListener( - "update-downloaded", - (event: any, releaseNotes: string, releaseName: string, releaseDate: string, updateURL: string) => { - notify( - "A new update is ready to install", - `Version ${releaseName} is downloaded and will be automatically installed on Quit` - ); + constructor(window: Electron.BrowserWindow) { + if (isDev()) { + return; } - ); - autoUpdater.addListener("error", (error: any) => { - log.error(error); - }); - autoUpdater.addListener("checking-for-update", (event: any) => { - log.info("checking-for-update"); - }); - autoUpdater.addListener("update-not-available", () => { - log.info("update-not-available"); - }); - autoUpdater.setFeedURL(`https://${UPDATE_SERVER_HOST}/update/${os.platform()}/${version}`); - window.webContents.once("did-frame-finish-load", (event: any) => { - autoUpdater.checkForUpdates(); - }); - } + const version = app.getVersion(); + autoUpdater.addListener("update-available", (event: any) => { + log.info("A new update is available"); + }); + autoUpdater.addListener( + "update-downloaded", + (event: any, releaseNotes: string, releaseName: string, releaseDate: string, updateURL: string) => { + notify( + "A new update is ready to install", + `Version ${releaseName} is downloaded and will be automatically installed on Quit` + ); + } + ); + autoUpdater.addListener("error", (error: any) => { + log.error(error); + }); + autoUpdater.addListener("checking-for-update", (event: any) => { + log.info("checking-for-update"); + }); + autoUpdater.addListener("update-not-available", () => { + log.info("update-not-available"); + }); + autoUpdater.setFeedURL(`https://${UPDATE_SERVER_HOST}/update/${os.platform()}/${version}`); + + window.webContents.once("did-frame-finish-load", (event: any) => { + autoUpdater.checkForUpdates(); + }); + } } diff --git a/package.json b/package.json index c943ca76c47..97c62d8d42f 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,7 @@ "q": "1.4.1", "rimraf": "2.5.4", "tslint": "3.15.1", + "typescript-eslint-parser": "0.1.3", "xmldoc": "0.1.2" } }