12
angular.json
12
angular.json
@@ -50,7 +50,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"dev-web": {
|
||||
"web": {
|
||||
"optimization": false,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": true,
|
||||
@@ -95,8 +95,8 @@
|
||||
"dev": {
|
||||
"browserTarget": "angular-electron:build:dev"
|
||||
},
|
||||
"dev-web": {
|
||||
"browserTarget": "angular-electron:build:dev-web"
|
||||
"web": {
|
||||
"browserTarget": "angular-electron:build:web"
|
||||
},
|
||||
"production": {
|
||||
"browserTarget": "angular-electron:build:production"
|
||||
@@ -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"
|
||||
],
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
/* eslint "@typescript-eslint/no-var-requires": 0 */
|
||||
const Application = require('spectron').Application;
|
||||
/* eslint "@typescript-eslint/no-var-requires": 0 */
|
||||
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
|
||||
/* eslint "@typescript-eslint/no-var-requires": 0 */
|
||||
const path = require('path');
|
||||
|
||||
export default function setup() {
|
||||
export default function setup(): void {
|
||||
beforeEach(async function () {
|
||||
this.app = new Application({
|
||||
// Your electron path can be any binary
|
||||
|
||||
6
e2e/eslintrc.e2e.json
Normal file
6
e2e/eslintrc.e2e.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../eslintrc.json",
|
||||
"parserOptions": {
|
||||
"project": ["e2e/tsconfig.e2e.json"]
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {expect, assert} from 'chai';
|
||||
import {expect} from 'chai';
|
||||
import {SpectronClient} from 'spectron';
|
||||
|
||||
import commonSetup from './common-setup';
|
||||
@@ -6,11 +6,13 @@ import commonSetup from './common-setup';
|
||||
describe('angular-electron App', function () {
|
||||
commonSetup.apply(this);
|
||||
|
||||
/* eslint "@typescript-eslint/no-explicit-any": 0 */
|
||||
let browser: any;
|
||||
let client: SpectronClient;
|
||||
|
||||
beforeEach(function () {
|
||||
client = this.app.client;
|
||||
/* eslint "@typescript-eslint/no-explicit-any": 0 */
|
||||
browser = client as any;
|
||||
});
|
||||
|
||||
|
||||
19
eslintrc.json
Normal file
19
eslintrc.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"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"]
|
||||
}
|
||||
11
main.ts
11
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;
|
||||
@@ -19,10 +19,12 @@ function createWindow() {
|
||||
height: size.height,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
allowRunningInsecureContent: (serve) ? true : false,
|
||||
},
|
||||
});
|
||||
|
||||
if (serve) {
|
||||
/* eslint "@typescript-eslint/no-var-requires": 0 */
|
||||
require('electron-reload')(__dirname, {
|
||||
electron: require(`${__dirname}/node_modules/electron`)
|
||||
});
|
||||
@@ -47,6 +49,7 @@ function createWindow() {
|
||||
win = null;
|
||||
});
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
10
package.json
10
package.json
@@ -24,7 +24,7 @@
|
||||
"build:dev": "npm run build -- -c dev",
|
||||
"build:prod": "npm run build -- -c production",
|
||||
"ng:serve": "ng serve",
|
||||
"ng:serve:web": "ng serve -c dev-web -o",
|
||||
"ng:serve:web": "ng serve -c web -o",
|
||||
"electron:serve-tsc": "tsc -p tsconfig-serve.json",
|
||||
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve",
|
||||
"electron:local": "npm run build:prod && electron .",
|
||||
@@ -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,13 +56,17 @@
|
||||
"@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",
|
||||
"core-js": "3.1.4",
|
||||
"electron": "7.0.0",
|
||||
"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",
|
||||
|
||||
@@ -19,7 +19,3 @@ describe('AppComponent', () => {
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
|
||||
class TranslateServiceStub {
|
||||
setDefaultLang(lang: string): void {}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,10 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
/* eslint "no-empty-function":0, "@typescript-eslint/no-empty-function": 0 */
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
/* eslint "no-empty-function":0, "@typescript-eslint/no-empty-function": 0 */
|
||||
ngOnInit(): void { }
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import { Component, OnInit } from '@angular/core';
|
||||
styleUrls: ['./page-not-found.component.scss']
|
||||
})
|
||||
export class PageNotFoundComponent implements OnInit {
|
||||
/* eslint "no-empty-function":0, "@typescript-eslint/no-empty-function": 0 */
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
/* eslint "no-empty-function":0, "@typescript-eslint/no-empty-function": 0 */
|
||||
ngOnInit(): void {}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@ import { Directive } from '@angular/core';
|
||||
selector: '[webview]'
|
||||
})
|
||||
export class WebviewDirective {
|
||||
/* eslint "no-empty-function":0, "@typescript-eslint/no-empty-function": 0 */
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
6
src/eslintrc.config.json
Normal file
6
src/eslintrc.config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../eslintrc.json",
|
||||
"parserOptions": {
|
||||
"project": ["src/tsconfig.app.json", "src/tsconfig.spec.json"]
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
/* eslint "@typescript-eslint/no-explicit-any":0 */
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
|
||||
96
tslint.json
96
tslint.json
@@ -1,96 +0,0 @@
|
||||
{
|
||||
"rulesDirectory": ["node_modules/codelyzer"],
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"callable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [true, "check-space"],
|
||||
"component-class-suffix": true,
|
||||
"component-selector": [true, "element", "app", "kebab-case"],
|
||||
"curly": true,
|
||||
"deprecation": { "severity": "warn" },
|
||||
"directive-class-suffix": true,
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [true, "rxjs/Rx"],
|
||||
"import-spacing": true,
|
||||
"indent": [true, "spaces"],
|
||||
"interface-over-type-literal": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [true, 140],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-host-metadata-property": true,
|
||||
"no-inferrable-types": [true, "ignore-params"],
|
||||
"no-input-rename": true,
|
||||
"no-inputs-metadata-property": true,
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-output-on-prefix": true,
|
||||
"no-output-rename": true,
|
||||
"no-outputs-metadata-property": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"prefer-const": true,
|
||||
"quotemark": [true, "single"],
|
||||
"radix": true,
|
||||
"semicolon": [true, "always"],
|
||||
"triple-equals": [true, "allow-null-check"],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"unified-signatures": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-lifecycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"variable-name": false,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user