ref/ set default angular eslint rules
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
"projects/**/*"
|
"app/**/*", // ignore nodeJs files
|
||||||
|
"dist/**/*",
|
||||||
|
"release/**/*"
|
||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@@ -18,7 +20,8 @@
|
|||||||
"createDefaultProgram": true
|
"createDefaultProgram": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@angular-eslint/recommended",
|
"plugin:@angular-eslint/ng-cli-compat",
|
||||||
|
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates"
|
"plugin:@angular-eslint/template/process-inline-templates"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
@@ -35,14 +38,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"*.component.html"
|
"*.html"
|
||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@angular-eslint/template/recommended"
|
"plugin:@angular-eslint/template/recommended"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@angular-eslint/template/banana-in-box": "error",
|
|
||||||
"@angular-eslint/template/no-negated-async": "error"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -132,10 +132,9 @@
|
|||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-eslint/builder:lint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"eslintConfig": ".eslintrc.json",
|
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.component.html"
|
"src/**/*.html"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +147,6 @@
|
|||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-eslint/builder:lint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"eslintConfig": ".eslintrc.json",
|
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"e2e/**/*.ts"
|
"e2e/**/*.ts"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
const Application = require('spectron').Application;
|
const APPLICATION = require('spectron').Application;
|
||||||
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
|
const ELECTRON_PATH = require('electron'); // Require Electron from the binaries included in node_modules.
|
||||||
const path = require('path');
|
const PATH = require('path');
|
||||||
|
|
||||||
export default function setup(): void {
|
export default function setup(): void {
|
||||||
beforeEach(async function () {
|
beforeEach(async () => {
|
||||||
this.app = new Application({
|
this.app = new APPLICATION({
|
||||||
// Your electron path can be any binary
|
// Your electron path can be any binary
|
||||||
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
|
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
|
||||||
// But for the sake of the example we fetch it from our node_modules.
|
// But for the sake of the example we fetch it from our node_modules.
|
||||||
path: electronPath,
|
path: ELECTRON_PATH,
|
||||||
|
|
||||||
// Assuming you have the following directory structure
|
// Assuming you have the following directory structure
|
||||||
|
|
||||||
@@ -23,14 +23,14 @@ export default function setup(): void {
|
|||||||
|
|
||||||
// The following line tells spectron to look and use the main.js file
|
// The following line tells spectron to look and use the main.js file
|
||||||
// and the package.json located 1 level above.
|
// and the package.json located 1 level above.
|
||||||
args: [path.join(__dirname, '..')],
|
args: [PATH.join(__dirname, '..')],
|
||||||
webdriverOptions: {}
|
webdriverOptions: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.app.start();
|
await this.app.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async () => {
|
||||||
if (this.app && this.app.isRunning()) {
|
if (this.app && this.app.isRunning()) {
|
||||||
await this.app.stop();
|
await this.app.stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { SpectronClient } from 'spectron';
|
|||||||
|
|
||||||
import commonSetup from './common-setup';
|
import commonSetup from './common-setup';
|
||||||
|
|
||||||
describe('angular-electron App', function () {
|
describe('angular-electron App', () => {
|
||||||
|
|
||||||
commonSetup.apply(this);
|
commonSetup.apply(this);
|
||||||
|
|
||||||
@@ -13,12 +13,12 @@ describe('angular-electron App', function () {
|
|||||||
client = this.app.client;
|
client = this.app.client;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates initial windows', async function () {
|
it('creates initial windows', async () => {
|
||||||
const count = await client.getWindowCount();
|
const count = await client.getWindowCount();
|
||||||
expect(count).to.equal(1);
|
expect(count).to.equal(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display message saying App works !', async function () {
|
it('should display message saying App works !', async () => {
|
||||||
const elem = await client.$('app-home h1');
|
const elem = await client.$('app-home h1');
|
||||||
const text = await elem.getText();
|
const text = await elem.getText();
|
||||||
expect(text).to.equal('App works !');
|
expect(text).to.equal('App works !');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ElectronService } from './core/services';
|
import { ElectronService } from './core/services';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { AppConfig } from '../environments/environment';
|
import { APP_CONFIG } from '../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@@ -14,7 +14,7 @@ export class AppComponent {
|
|||||||
private translate: TranslateService
|
private translate: TranslateService
|
||||||
) {
|
) {
|
||||||
this.translate.setDefaultLang('en');
|
this.translate.setDefaultLang('en');
|
||||||
console.log('AppConfig', AppConfig);
|
console.log('APP_CONFIG', APP_CONFIG);
|
||||||
|
|
||||||
if (electronService.isElectron) {
|
if (electronService.isElectron) {
|
||||||
console.log(process.env);
|
console.log(process.env);
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ import { DetailModule } from './detail/detail.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent],
|
||||||
@@ -35,7 +33,7 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useFactory: HttpLoaderFactory,
|
useFactory: httpLoaderFactory,
|
||||||
deps: [HttpClient]
|
deps: [HttpClient]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ export class ElectronService {
|
|||||||
this.childProcess = window.require('child_process');
|
this.childProcess = window.require('child_process');
|
||||||
this.fs = window.require('fs');
|
this.fs = window.require('fs');
|
||||||
|
|
||||||
// If you want to use a NodeJS 3rd party deps in Renderer process (like @electron/remote), it must be declared in dependencies of both package.json (in root and app folders)
|
// If you want to use a NodeJS 3rd party deps in Renderer process (like @electron/remote),
|
||||||
|
// it must be declared in dependencies of both package.json (in root and app folders)
|
||||||
// If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts
|
// If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts
|
||||||
this.remote = window.require('@electron/remote');
|
this.remote = window.require('@electron/remote');
|
||||||
console.log('remote - globalShortcut', this.remote.globalShortcut);
|
console.log('remote - globalShortcut', this.remote.globalShortcut);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class DetailComponent implements OnInit {
|
|||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log("DetailComponent INIT");
|
console.log('DetailComponent INIT');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ export class HomeComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private router: Router) { }
|
constructor(private router: Router) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log("HomeComponent INIT");
|
console.log('HomeComponent INIT');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ export class PageNotFoundComponent implements OnInit {
|
|||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log("PageNotFoundComponent INIT");
|
console.log('PageNotFoundComponent INIT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const AppConfig = {
|
export const APP_CONFIG = {
|
||||||
production: false,
|
production: false,
|
||||||
environment: 'DEV'
|
environment: 'DEV'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const AppConfig = {
|
export const APP_CONFIG = {
|
||||||
production: true,
|
production: true,
|
||||||
environment: 'PROD'
|
environment: 'PROD'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const AppConfig = {
|
export const APP_CONFIG = {
|
||||||
production: false,
|
production: false,
|
||||||
environment: 'LOCAL'
|
environment: 'LOCAL'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const AppConfig = {
|
export const APP_CONFIG = {
|
||||||
production: false,
|
production: false,
|
||||||
environment: 'WEB'
|
environment: 'WEB'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import { enableProdMode } from '@angular/core';
|
|||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
import { AppConfig } from './environments/environment';
|
import { APP_CONFIG } from './environments/environment';
|
||||||
|
|
||||||
if (AppConfig.production) {
|
if (APP_CONFIG.production) {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user