Skip to content

Commit

Permalink
fix/ ng lint with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime GRIS committed Jun 20, 2020
1 parent 21f7401 commit 92d7419
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 55 deletions.
61 changes: 61 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"env": {
"browser": true,
"node": true,
"es6": true,
"es2017": true
},
"overrides": [
{
"files": ["*.ts"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 10,
"project": "src/tsconfig.app.json",
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"plugins": [
"@typescript-eslint",
"@angular-eslint/eslint-plugin"
],
"rules": {
"@typescript-eslint/indent": [
"error", 2, {
"SwitchCase": 1,
"CallExpression": {"arguments": "first"},
"FunctionExpression": {"parameters": "first"},
"FunctionDeclaration": {"parameters": "first"}
}
],
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/no-unsafe-member-access": 0,
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-unsafe-return": 0,
"@typescript-eslint/no-floating-promises": 0,
"@angular-eslint/use-injectable-provided-in": "error",
"@angular-eslint/no-attribute-decorator": "error"
}
},
{
"files": ["*.component.html"],
"parser": "@angular-eslint/template-parser",
"plugins": ["@angular-eslint/template"],
"rules": {
"@angular-eslint/template/banana-in-a-box": "error",
"@angular-eslint/template/no-negated-async": "error"
}
}
]
}
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": "src/eslintrc.config.json",
"eslintConfig": "src/eslintrc.app.json",
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
Expand Down Expand Up @@ -168,4 +168,4 @@
"prefix": "app"
}
}
}
}
6 changes: 4 additions & 2 deletions e2e/eslintrc.e2e.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../eslintrc.json",
"extends": "../.eslintrc.json",
"parserOptions": {
"project": ["e2e/tsconfig.e2e.json"]
"project": [
"e2e/tsconfig.e2e.json"
]
}
}
4 changes: 2 additions & 2 deletions e2e/main.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {expect} from 'chai';
import {SpectronClient} from 'spectron';
import { expect } from 'chai';
import { SpectronClient } from 'spectron';

import commonSetup from './common-setup';

Expand Down
24 changes: 0 additions & 24 deletions eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function createWindow(): BrowserWindow {

if (serve) {

require('devtron').install();
win.webContents.openDevTools();

require('electron-reload')(__dirname, {
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"devDependencies": {
"@angular-builders/custom-webpack": "9.1.0",
"@angular-devkit/build-angular": "0.901.9",
"@angular-eslint/builder": "0.0.1-alpha.18",
"@angular-eslint/builder": "0.0.1-alpha.32",
"@angular-eslint/eslint-plugin": "0.0.1-alpha.32",
"@angular-eslint/eslint-plugin-template": "0.0.1-alpha.32",
"@angular-eslint/template-parser": "0.0.1-alpha.32",
"@angular/cli": "9.1.9",
"@angular/common": "9.1.11",
"@angular/compiler": "9.1.11",
Expand All @@ -57,19 +60,18 @@
"@types/jasminewd2": "2.0.8",
"@types/mocha": "7.0.2",
"@types/node": "12.11.1",
"@typescript-eslint/eslint-plugin": "2.27.0",
"@typescript-eslint/parser": "2.27.0",
"@typescript-eslint/eslint-plugin": "3.3.0",
"@typescript-eslint/eslint-plugin-tslint": "3.3.0",
"@typescript-eslint/parser": "3.3.0",
"chai": "4.2.0",
"codelyzer": "5.2.2",
"conventional-changelog-cli": "2.0.34",
"core-js": "3.6.5",
"cross-env": "7.0.2",
"devtron": "1.4.0",
"electron": "9.0.4",
"electron-builder": "22.7.0",
"electron-reload": "1.5.0",
"eslint": "6.8.0",
"eslint-plugin-import": "2.20.2",
"eslint": "7.3.0",
"eslint-plugin-import": "2.21.2",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "5.0.2",
"karma": "5.1.0",
Expand Down
12 changes: 6 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import { AppConfig } from '../environments/environment';
})
export class AppComponent {
constructor(
public electronService: ElectronService,
private electronService: ElectronService,
private translate: TranslateService
) {
translate.setDefaultLang('en');
this.translate.setDefaultLang('en');
console.log('AppConfig', AppConfig);

if (electronService.isElectron) {
console.log(process.env);
console.log('Mode electron');
console.log('Electron ipcRenderer', electronService.ipcRenderer);
console.log('NodeJS childProcess', electronService.childProcess);
console.log('Run in electron');
console.log('Electron ipcRenderer', this.electronService.ipcRenderer);
console.log('NodeJS childProcess', this.electronService.childProcess);
} else {
console.log('Mode web');
console.log('Run in browser');
}
}
}
4 changes: 3 additions & 1 deletion src/app/core/services/electron/electron.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';

// If you import a module but never use any of the imported values other than as TypeScript types,
// the resulting javascript file will look as if you never imported the module at all.
import { ipcRenderer, webFrame } from 'electron';
import { ipcRenderer, webFrame, remote } from 'electron';
import * as childProcess from 'child_process';
import * as fs from 'fs';

Expand All @@ -12,6 +12,7 @@ import * as fs from 'fs';
export class ElectronService {
ipcRenderer: typeof ipcRenderer;
webFrame: typeof webFrame;
remote: typeof remote;
childProcess: typeof childProcess;
fs: typeof fs;

Expand All @@ -24,6 +25,7 @@ export class ElectronService {
if (this.isElectron) {
this.ipcRenderer = window.require('electron').ipcRenderer;
this.webFrame = window.require('electron').webFrame;
this.remote = window.require('electron').remote;

this.childProcess = window.require('child_process');
this.fs = window.require('fs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('PageNotFoundComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PageNotFoundComponent ]
declarations: [PageNotFoundComponent]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/directives/webview/webview.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { Directive } from '@angular/core';
selector: 'webview'
})
export class WebviewDirective {
constructor() {}
constructor() { }
}
9 changes: 9 additions & 0 deletions src/eslintrc.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../.eslintrc.json",
"parserOptions": {
"project": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
]
}
}
6 changes: 0 additions & 6 deletions src/eslintrc.config.json

This file was deleted.

11 changes: 10 additions & 1 deletion src/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
"baseUrl": "",
"types": []
},
"include": [
"**/*.ts",

],
"exclude": [
"**/*.spec.ts"
]
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"preserveWhitespaces": true
}
}

0 comments on commit 92d7419

Please sign in to comment.