build: Replace Codelyzer and TSLint with Angular ESLint

Migrate from the deprecated TSLint to Angluar ESLint. Also fix current
linting issues in the code, in particular:

- Use strict equals operators (=== and !==)
- Remove empty lifecycle methods (mostly ngOnInit)
- Output bindings including aliases should not be named as standard dom
  events (submit)
- Async pipe results should not be negated
This commit is contained in:
Ralph Hopman
2024-11-08 09:37:08 +01:00
committed by Adam Saghy
parent e910679673
commit 9034ce2847
204 changed files with 2184 additions and 1173 deletions
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { GLAccount } from 'app/shared/models/general.model';
@Component({
@@ -6,7 +6,7 @@ import { GLAccount } from 'app/shared/models/general.model';
templateUrl: './gl-account-display.component.html',
styleUrls: ['./gl-account-display.component.scss']
})
export class GlAccountDisplayComponent implements OnInit {
export class GlAccountDisplayComponent {
@Input() glAccount: GLAccount | null = null;
@Input() accountTitle: string | null = null;
@@ -15,9 +15,6 @@ export class GlAccountDisplayComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
glAccountValue(): string {
if (this.glAccount) {
return '(' + this.glAccount.glCode + ') ' + (this.glAccount.nameDecorated ? this.glAccount.nameDecorated : this.glAccount.name);
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, Inject } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
/**
@@ -10,7 +10,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
templateUrl: './view-journal-entry.component.html',
styleUrls: ['./view-journal-entry.component.scss']
})
export class ViewJournalEntryComponent implements OnInit {
export class ViewJournalEntryComponent {
existsPaymentDetails = false;
/**
@@ -23,7 +23,4 @@ export class ViewJournalEntryComponent implements OnInit {
this.existsPaymentDetails = (data.journalEntry.transactionDetails != null && data.journalEntry.transactionDetails.paymentDetails != null);
}
ngOnInit() {
}
}
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { Accounting } from 'app/core/utils/accounting';
import { OptionData } from 'app/shared/models/option-data.model';
@@ -7,16 +7,13 @@ import { OptionData } from 'app/shared/models/option-data.model';
templateUrl: './view-savings-accounting-details.component.html',
styleUrls: ['./view-savings-accounting-details.component.scss']
})
export class ViewSavingsAccountingDetailsComponent implements OnInit {
export class ViewSavingsAccountingDetailsComponent {
@Input() accountingRule: OptionData;
@Input() accountingMappings: any[] = [];
constructor(private accounting: Accounting) { }
ngOnInit(): void {
}
isCashOrAccrualAccounting(): boolean {
if (this.accountingRule) {
return this.accounting.isCashOrAccrualAccounting(this.accountingRule);
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, Inject } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
/**
@@ -10,7 +10,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
templateUrl: './cancel-dialog.component.html',
styleUrls: ['./cancel-dialog.component.scss']
})
export class CancelDialogComponent implements OnInit {
export class CancelDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
@@ -18,7 +18,4 @@ export class CancelDialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<CancelDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit() {
}
}
@@ -10,7 +10,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
templateUrl: './delete-dialog.component.html',
styleUrls: ['./delete-dialog.component.scss']
})
export class DeleteDialogComponent implements OnInit {
export class DeleteDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
@@ -19,7 +19,4 @@ export class DeleteDialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<DeleteDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit() {
}
}
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, Inject } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
/**
@@ -10,7 +10,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
templateUrl: './disable-dialog.component.html',
styleUrls: ['./disable-dialog.component.scss']
})
export class DisableDialogComponent implements OnInit {
export class DisableDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
@@ -19,7 +19,4 @@ export class DisableDialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<DisableDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit() {
}
}
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
@@ -7,7 +7,7 @@ import { TranslateService } from '@ngx-translate/core';
templateUrl: './dropdown.component.html',
styleUrls: ['./dropdown.component.scss']
})
export class DropdownComponent implements OnInit {
export class DropdownComponent {
@Input() placeHolderText: string;
@Input() labelText: string;
@@ -17,9 +17,6 @@ export class DropdownComponent implements OnInit {
constructor(private translateService: TranslateService) { }
ngOnInit(): void {
}
getPlaceHolderText(): string {
return this.placeHolderText ? this.translateService.instant('labels.inputs.' + this.placeHolderText) : '';
}
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, Inject } from '@angular/core';
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
/**
@@ -10,7 +10,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
templateUrl: './enable-dialog.component.html',
styleUrls: ['./enable-dialog.component.scss']
})
export class EnableDialogComponent implements OnInit {
export class EnableDialogComponent {
/**
* @param {MatDialogRef} dialogRef Component reference to dialog.
@@ -19,7 +19,4 @@ export class EnableDialogComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<EnableDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit() {
}
}
@@ -1,4 +1,4 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, Input } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { FormfieldBase } from './model/formfield-base';
@@ -8,14 +8,11 @@ import { FormfieldBase } from './model/formfield-base';
templateUrl: './formfield.component.html',
styleUrls: ['./formfield.component.scss']
})
export class FormfieldComponent implements OnInit {
export class FormfieldComponent {
@Input() form: UntypedFormGroup;
@Input() formfield: FormfieldBase;
constructor() { }
ngOnInit() {
}
}
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { Currency } from '../models/general.model';
import { UntypedFormControl } from '@angular/forms';
@@ -7,7 +7,7 @@ import { UntypedFormControl } from '@angular/forms';
templateUrl: './input-amount.component.html',
styleUrls: ['./input-amount.component.scss']
})
export class InputAmountComponent implements OnInit {
export class InputAmountComponent {
@Input() isRequired = false;
@Input() currency: Currency;
@@ -18,9 +18,6 @@ export class InputAmountComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
numberOnly(event: any): boolean {
const charCode = (event.which) ? event.which : event.keyCode;
if (charCode === 46) {
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
/** Custom Services */
@@ -17,7 +17,7 @@ import { SettingsService } from 'app/settings/settings.service';
templateUrl: './language-selector.component.html',
styleUrls: ['./language-selector.component.scss']
})
export class LanguageSelectorComponent implements OnInit {
export class LanguageSelectorComponent {
/** Language selector form control. */
languageSelector = new UntypedFormControl();
@@ -31,9 +31,6 @@ export class LanguageSelectorComponent implements OnInit {
this.languageSelector.setValue(this.currentLanguage);
}
ngOnInit() {
}
/**
* Sets a new language to be used by the application.
* @param {string} language New language.
@@ -5,14 +5,11 @@ import { Component, Input, OnInit } from '@angular/core';
templateUrl: './stepper-buttons.component.html',
styleUrls: ['./stepper-buttons.component.scss']
})
export class StepperButtonsComponent implements OnInit {
export class StepperButtonsComponent {
@Input() disablePrevious = false;
@Input() disableNext = false;
constructor() { }
ngOnInit(): void {
}
}
@@ -1,11 +1,11 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
@Component({
selector: 'mifosx-svg-icon',
templateUrl: './svg-icon.component.html',
styleUrls: ['./svg-icon.component.scss']
})
export class SvgIconComponent implements OnInit {
export class SvgIconComponent {
@Input() iconFile: string;
@Input() iconName: string;
@Input() iconClass: string;
@@ -13,7 +13,4 @@ export class SvgIconComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
@@ -27,7 +27,7 @@
<table #dataTable mat-table [dataSource]="datatableData" class="mat-elevation-z1 m-b-25" [fxHide]="isLoading">
<ng-container *ngFor="let datatableColumn of datatableColumns;let i = index" [matColumnDef]="datatableColumn">
<ng-container *ngIf="i == 0">
<ng-container *ngIf="i === 0">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let data">
<mat-checkbox class="center" (click)="$event.stopPropagation()"
@@ -1,11 +1,11 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
@Component({
selector: 'mifosx-entity-datatable-tab',
templateUrl: './entity-datatable-tab.component.html',
styleUrls: ['./entity-datatable-tab.component.scss']
})
export class EntityDatatableTabComponent implements OnInit {
export class EntityDatatableTabComponent {
@Input() multiRowDatatableFlag = false;
@Input() entityDatatable: any;
@@ -14,7 +14,4 @@ export class EntityDatatableTabComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { PaymentDetail } from './payment-detail-model';
@@ -7,14 +7,12 @@ import { PaymentDetail } from './payment-detail-model';
templateUrl: './transaction-payment-detail.component.html',
styleUrls: ['./transaction-payment-detail.component.scss']
})
export class TransactionPaymentDetailComponent implements OnInit {
export class TransactionPaymentDetailComponent {
@Input() paymentDetailData: PaymentDetail;
constructor() {}
ngOnInit(): void {}
hasSomeValue(): boolean {
return (
this.isNotNullOrEmpty(this.paymentDetailData.accountNumber) ||