Moved from tslint to eslint as tslint was depreciated.

Added prettier and also prettied all the typescript files using prettier

ESLint is using the AirBnB rules which are the most strict to lint the files.
This commit is contained in:
2020-10-01 21:28:12 +05:30
parent 40e79ff949
commit 1350870f9e
545 changed files with 8455 additions and 7036 deletions
@@ -2,28 +2,48 @@
<mat-card fxFlex>
<mat-card-title-group>
<mat-card-title>Account</mat-card-title>
<mat-icon matSuffix (click)="item.isStarred = !item.isStarred" class="pointer" [class.gold]="item.isStarred">
<mat-icon
matSuffix
(click)="item.isStarred = !item.isStarred"
class="pointer"
[class.gold]="item.isStarred"
>
{{ item.isStarred ? 'star' : 'star_border' }}
</mat-icon>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Code</mat-label>
<input matInput placeholder="Code" formControlName="code">
<input matInput placeholder="Code" formControlName="code" />
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Name</mat-label>
<input matInput #nameElement placeholder="Name" formControlName="name">
<input matInput #nameElement placeholder="Name" formControlName="name" />
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Account Type</mat-label>
<mat-select placeholder="Account Type" formControlName="type">
@@ -33,13 +53,23 @@
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="isActive">Is Active?</mat-checkbox>
<mat-checkbox formControlName="isReconcilable">Is Reconcilable?</mat-checkbox>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Cost Centre</mat-label>
<mat-select placeholder="Cost Centre" formControlName="costCentre">
@@ -53,7 +83,9 @@
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" (click)="save()">Save</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
</mat-card>
</div>
@@ -1,6 +1,6 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {AccountDetailComponent} from './account-detail.component';
import { AccountDetailComponent } from './account-detail.component';
describe('AccountDetailComponent', () => {
let component: AccountDetailComponent;
@@ -8,9 +8,8 @@ describe('AccountDetailComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AccountDetailComponent]
})
.compileComponents();
declarations: [AccountDetailComponent],
}).compileComponents();
}));
beforeEach(() => {
@@ -1,18 +1,18 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ToasterService} from '../../core/toaster.service';
import {ActivatedRoute, Router} from '@angular/router';
import {AccountService} from '../../core/account.service';
import {Account} from '../../core/account';
import {AccountType} from '../../core/account-type';
import {CostCentre} from '../../core/cost-centre';
import {ConfirmDialogComponent} from '../../shared/confirm-dialog/confirm-dialog.component';
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { ToasterService } from '../../core/toaster.service';
import { ActivatedRoute, Router } from '@angular/router';
import { AccountService } from '../../core/account.service';
import { Account } from '../../core/account';
import { AccountType } from '../../core/account-type';
import { CostCentre } from '../../core/cost-centre';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import {FormBuilder, FormGroup} from '@angular/forms';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-account-detail',
templateUrl: './account-detail.component.html',
styleUrls: ['./account-detail.component.css']
styleUrls: ['./account-detail.component.css'],
})
export class AccountDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@@ -27,29 +27,30 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
private dialog: MatDialog,
private fb: FormBuilder,
private toaster: ToasterService,
private ser: AccountService
private ser: AccountService,
) {
this.createForm();
}
createForm() {
this.form = this.fb.group({
code: {value: '', disabled: true},
code: { value: '', disabled: true },
name: '',
type: '',
isActive: '',
isReconcilable: '',
costCentre: ''
costCentre: '',
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: Account, accountTypes: AccountType[], costCentres: CostCentre[] }) => {
this.route.data.subscribe(
(data: { item: Account; accountTypes: AccountType[]; costCentres: CostCentre[] }) => {
this.accountTypes = data.accountTypes;
this.costCentres = data.costCentres;
this.showItem(data.item);
});
},
);
}
showItem(item: Account) {
@@ -60,7 +61,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
type: this.item.type,
isActive: this.item.isActive,
isReconcilable: this.item.isReconcilable,
costCentre: this.item.costCentre.id
costCentre: this.item.costCentre.id,
});
}
@@ -71,35 +72,33 @@ export class AccountDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/accounts');
},
(error) => {
this.toaster.show('Danger', error);
}
);
this.ser.saveOrUpdate(this.getItem()).subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/accounts');
},
(error) => {
this.toaster.show('Danger', error);
},
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/accounts');
},
(error) => {
this.toaster.show('Danger', error);
}
);
this.ser.delete(this.item.id).subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/accounts');
},
(error) => {
this.toaster.show('Danger', error);
},
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete Account?', content: 'Are you sure? This cannot be undone.'}
data: { title: 'Delete Account?', content: 'Are you sure? This cannot be undone.' },
});
dialogRef.afterClosed().subscribe((result: boolean) => {