diff --git a/angular.json b/angular.json index df3fb46..ceda86d 100644 --- a/angular.json +++ b/angular.json @@ -135,8 +135,9 @@ } }, "lint": { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@angular-eslint/builder:lint", "options": { + "eslintConfig": "src/eslintrc.config.json", "tsConfig": [ "src/tsconfig.app.json", "src/tsconfig.spec.json" @@ -153,8 +154,9 @@ "projectType": "application", "architect": { "lint": { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@angular-eslint/builder:lint", "options": { + "eslintConfig": "e2e/eslintrc.e2e.json", "tsConfig": [ "e2e/tsconfig.e2e.json" ], diff --git a/e2e/eslintrc.e2e.json b/e2e/eslintrc.e2e.json new file mode 100644 index 0000000..51edf19 --- /dev/null +++ b/e2e/eslintrc.e2e.json @@ -0,0 +1,6 @@ +{ + "extends": "../eslintrc.json", + "parserOptions": { + "project": ["e2e/tsconfig.e2e.json"] + } +} diff --git a/eslintrc.json b/eslintrc.json new file mode 100644 index 0000000..3e88df3 --- /dev/null +++ b/eslintrc.json @@ -0,0 +1,24 @@ +{ + "env": { + "browser": true, + "node": true, + "es6": true, + "es2017": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "tsconfigRootDir": "." + }, + "plugins": ["@typescript-eslint"], + "rules": { + "no-empty-function": ["warn"], + "@typescript-eslint/no-empty-function": ["warn"], + "@typescript-eslint/no-var-requires": ["warn"] + } +} diff --git a/main.ts b/main.ts index 793275d..e386907 100644 --- a/main.ts +++ b/main.ts @@ -2,11 +2,11 @@ import { app, BrowserWindow, screen } from 'electron'; import * as path from 'path'; import * as url from 'url'; -let win, serve; -const args = process.argv.slice(1); -serve = args.some(val => val === '--serve'); +let win: BrowserWindow = null; +const args = process.argv.slice(1), + serve = args.some(val => val === '--serve'); -function createWindow() { +function createWindow(): BrowserWindow { const electronScreen = screen; const size = electronScreen.getPrimaryDisplay().workAreaSize; @@ -48,6 +48,7 @@ function createWindow() { win = null; }); + return win; } try { diff --git a/package.json b/package.json index c5e0549..39f736f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "devDependencies": { "@angular-builders/custom-webpack": "^8.2.0", "@angular-devkit/build-angular": "0.803.6", + "@angular-eslint/builder": "0.0.1-alpha.17", "@angular/cli": "8.3.6", "@angular/common": "8.2.12", "@angular/compiler": "8.2.12", @@ -55,6 +56,8 @@ "@types/jasminewd2": "2.0.6", "@types/mocha": "5.2.7", "@types/node": "12.6.8", + "@typescript-eslint/eslint-plugin": "^2.7.0", + "@typescript-eslint/parser": "^2.7.0", "chai": "4.2.0", "codelyzer": "5.1.0", "conventional-changelog-cli": "2.0.25", @@ -62,6 +65,8 @@ "electron": "7.1.1", "electron-builder": "21.2.0", "electron-reload": "1.5.0", + "eslint": "^6.6.0", + "eslint-plugin-import": "^2.18.2", "jasmine-core": "3.4.0", "jasmine-spec-reporter": "4.2.1", "karma": "4.2.0", @@ -74,7 +79,6 @@ "rxjs": "6.5.3", "spectron": "9.0.0", "ts-node": "8.3.0", - "tslint": "5.20.0", "typescript": "3.5.3", "wait-on": "3.3.0", "webdriver-manager": "12.1.5", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 876d7ce..b2f66c7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -19,7 +19,7 @@ import { HomeModule } from './home/home.module'; import { AppComponent } from './app.component'; // AoT requires an exported function for factories -export function HttpLoaderFactory(http: HttpClient) { +export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } diff --git a/src/app/core/services/electron/electron.service.ts b/src/app/core/services/electron/electron.service.ts index 411ef54..7a9e766 100644 --- a/src/app/core/services/electron/electron.service.ts +++ b/src/app/core/services/electron/electron.service.ts @@ -16,7 +16,7 @@ export class ElectronService { childProcess: typeof childProcess; fs: typeof fs; - get isElectron() { + get isElectron(): boolean { return window && window.process && window.process.type; } diff --git a/src/eslintrc.config.json b/src/eslintrc.config.json new file mode 100644 index 0000000..ad87184 --- /dev/null +++ b/src/eslintrc.config.json @@ -0,0 +1,6 @@ +{ + "extends": "../eslintrc.json", + "parserOptions": { + "project": ["src/tsconfig.app.json", "src/tsconfig.spec.json"] + } +}