fix "ng lint" command (#5012)

* update to latest js-api

* fix the "ng lint" command

* fix linting issues

* fix lint issues

* lint fixes

* code fixes

* fix html

* fix html

* update tests

* test fixes

* update tests

* fix tests and api

* fix code
This commit is contained in:
Denys Vuika
2019-08-29 16:35:30 +01:00
committed by Eugenio Romano
parent 140c64b79f
commit edc0945f39
162 changed files with 537 additions and 530 deletions

View File

@@ -59,7 +59,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
this.apps$ = this.appsProcessCloudService.getDeployedApplicationsByStatus(AppListCloudComponent.RUNNING_STATUS)
.pipe(
catchError((error) => {
catchError(() => {
this.loadingError$.next(true);
return of();
})

View File

@@ -86,7 +86,7 @@ describe('AppsProcessCloudService', () => {
spyOn(service, 'getDeployedApplicationsByStatus').and.returnValue(throwError(errorResponse));
service.getDeployedApplicationsByStatus('fake')
.subscribe(
(users) => fail('expected an error, not applications'),
() => fail('expected an error, not applications'),
(error) => {
expect(error.status).toEqual(404);
expect(error.statusText).toEqual('Not Found');

View File

@@ -317,7 +317,7 @@ describe('FormCloudComponent', () => {
let saved = false;
formComponent.form = formModel;
formComponent.formSaved.subscribe((v) => saved = true);
formComponent.formSaved.subscribe(() => saved = true);
spyOn(formComponent, 'completeTaskForm').and.stub();
const result = formComponent.onOutcomeClicked(outcome);
@@ -368,7 +368,7 @@ describe('FormCloudComponent', () => {
let saved = false;
formComponent.form = formModel;
formComponent.formSaved.subscribe((v) => saved = true);
formComponent.formSaved.subscribe(() => saved = true);
const result = formComponent.onOutcomeClicked(outcome);
expect(result).toBeTruthy();

View File

@@ -178,8 +178,8 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
return taskRepresentation.processDefinitionId && taskRepresentation.processDefinitionDeploymentId !== 'null';
}
getFormByTaskId(appName, taskId: string): Promise<FormCloud> {
return new Promise<FormCloud>((resolve, reject) => {
getFormByTaskId(appName: string, taskId: string): Promise<FormCloud> {
return new Promise<FormCloud>(resolve => {
forkJoin(this.formCloudService.getTaskForm(appName, taskId),
this.formCloudService.getTaskVariables(appName, taskId))
.pipe(takeUntil(this.onDestroy$))
@@ -261,7 +261,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
() => {
this.onTaskSaved(this.form);
},
(error) => this.onTaskSavedError(this.form, error)
(error) => this.onTaskSavedError(error)
);
}
}
@@ -275,7 +275,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
() => {
this.onTaskCompleted(this.form);
},
(error) => this.onTaskCompletedError(this.form, error)
(error) => this.onTaskCompletedError(error)
);
}
}
@@ -328,7 +328,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
this.formSaved.emit(form);
}
protected onTaskSavedError(form: FormCloud, error: any) {
protected onTaskSavedError(error: any) {
this.handleError(error);
}
@@ -336,7 +336,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
this.formCompleted.emit(form);
}
protected onTaskCompletedError(form: FormCloud, error: any) {
protected onTaskCompletedError(error: any) {
this.handleError(error);
}

View File

@@ -32,7 +32,7 @@ export class ContentCloudNodeSelectorService {
private dialog: MatDialog) {
}
openUploadFileDialog(contentHost: string, title?: string, actionName?: string): Observable<Node[]> {
openUploadFileDialog(contentHost: string): Observable<Node[]> {
const changedConfig = this.apiService.lastConfig;
changedConfig.provider = 'ALL';
changedConfig.hostEcm = contentHost.replace('/alfresco', '');

View File

@@ -1,5 +1,5 @@
<mat-accordion [hideToggle]="isLoading">
<mat-expansion-panel (afterExpand)="onExpand($event)" (closed)="onClose($event)">
<mat-expansion-panel (afterExpand)="onExpand()" (closed)="onClose()">
<mat-expansion-panel-header *ngIf="processFilter" id="adf-edit-process-filter-expansion-header">
<ng-container *ngIf="!isLoading; else loadingTemplate">
<mat-panel-title fxLayoutAlign="space-between center" id="adf-edit-process-filter-title-id">{{processFilter.name | translate}}</mat-panel-title>

View File

@@ -559,7 +559,7 @@ describe('EditProcessFilterCloudComponent', () => {
second: 59
});
component.filterChange.subscribe((res) => {
component.filterChange.subscribe(() => {
expect(component.changedProcessFilter.lastModifiedTo.toISOString()).toEqual(lastModifiedToFilter.toISOString());
done();
});

View File

@@ -395,11 +395,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
return this.showFilterActions;
}
onExpand(event: any) {
onExpand() {
this.toggleFilterActions = true;
}
onClose(event: any) {
onClose() {
this.toggleFilterActions = false;
}

View File

@@ -63,7 +63,7 @@ describe('ProcessFiltersCloudComponent', () => {
observer.complete();
});
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalFilterPromise = new Promise(function (resolve) {
resolve(fakeGlobalFilter);
});

View File

@@ -38,7 +38,7 @@ describe('Activiti ProcessList Cloud Service', () => {
function returnCallQueryParameters() {
return {
oauth2Auth: {
callCustomApi: (queryUrl, operation, context, queryParams) => {
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
return Promise.resolve(queryParams);
}
}
@@ -48,7 +48,7 @@ describe('Activiti ProcessList Cloud Service', () => {
function returnCallUrl() {
return {
oauth2Auth: {
callCustomApi: (queryUrl, operation, context, queryParams) => {
callCustomApi: (queryUrl) => {
return Promise.resolve(queryUrl);
}
}

View File

@@ -30,7 +30,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
* @param appName Name of the target app
* @returns List of local preferences
*/
getPreferences(appName: string, key: string): Observable<any> {
getPreferences(_: string, key: string): Observable<any> {
if (key || key === '') {
return of(this.prepareLocalPreferenceResponse(key));
}
@@ -42,7 +42,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
* @param key Key of the target preference
* @returns Observable of local preference
*/
getPreferenceByKey(appName: string, key: string): Observable<any> {
getPreferenceByKey(_: string, key: string): Observable<any> {
return of(JSON.parse(this.storage.getItem(key)) || []);
}
@@ -53,7 +53,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
* @newPreference Details of new local preference
* @returns Observable of created local preferences
*/
createPreference(appName: string, key: string, newPreference: any): Observable<any> {
createPreference(_: string, key: string, newPreference: any): Observable<any> {
const storedFilters = JSON.parse(this.storage.getItem(key) || '[]');
storedFilters.push(...newPreference);
this.storage.setItem(key, JSON.stringify(storedFilters));
@@ -67,7 +67,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
* @param updatedPreference Details of updated preference
* @returns Observable of updated local preferences
*/
updatePreference(appName: string, key: string, updatedPreference: any): Observable<any> {
updatePreference(_: string, key: string, updatedPreference: any): Observable<any> {
if (key) {
this.storage.setItem(key, JSON.stringify(updatedPreference));
return of(updatedPreference);

View File

@@ -92,7 +92,7 @@ describe('PreferenceService', () => {
getInstanceSpy.and.returnValue(apiErrorMock);
service.getPreferences('mock-app-name')
.subscribe(
(preferences) => fail('expected an error, not preferences'),
() => fail('expected an error, not preferences'),
(error) => {
expect(error.state).toEqual(404);
expect(error.stateText).toEqual('Not Found');
@@ -119,7 +119,7 @@ describe('PreferenceService', () => {
getInstanceSpy.and.returnValue(apiErrorMock);
service.getPreferenceByKey('mock-app-name', 'mock-preference-key')
.subscribe(
(preference) => fail('expected an error, not preference'),
() => fail('expected an error, not preference'),
(error) => {
expect(error.state).toEqual(404);
expect(error.stateText).toEqual('Not Found');
@@ -144,7 +144,7 @@ describe('PreferenceService', () => {
getInstanceSpy.and.returnValue(apiErrorMock);
service.createPreference('mock-app-name', 'mock-preference-key', createMockPreference)
.subscribe(
(preference) => fail('expected an error, not to create preference'),
() => fail('expected an error, not to create preference'),
(error) => {
expect(error.state).toEqual(404);
expect(error.stateText).toEqual('Not Found');
@@ -169,7 +169,7 @@ describe('PreferenceService', () => {
getInstanceSpy.and.returnValue(apiErrorMock);
service.createPreference('mock-app-name', 'mock-preference-key', updateMockPreference)
.subscribe(
(preference) => fail('expected an error, not to update preference'),
() => fail('expected an error, not to update preference'),
(error) => {
expect(error.state).toEqual(404);
expect(error.stateText).toEqual('Not Found');
@@ -190,7 +190,7 @@ describe('PreferenceService', () => {
getInstanceSpy.and.returnValue(apiErrorMock);
service.deletePreference('mock-app-name', 'mock-preference-key')
.subscribe(
(preference) => fail('expected an error, not to delete preference'),
() => fail('expected an error, not to delete preference'),
(error) => {
expect(error.state).toEqual(404);
expect(error.stateText).toEqual('Not Found');

View File

@@ -26,7 +26,7 @@ import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock';
describe('ClaimTaskDirective', () => {
@Component({
selector: 'adf-claim-test-component',
selector: 'adf-cloud-claim-test-component',
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameMock"></button>'
})
class TestComponent {
@@ -70,7 +70,7 @@ describe('ClaimTaskDirective', () => {
describe('Claim Task Directive validation errors', () => {
@Component({
selector: 'adf-claim-no-fields-validation-component',
selector: 'adf-cloud-claim-no-fields-validation-component',
template: '<button adf-cloud-claim-task></button>'
})
class ClaimTestMissingInputDirectiveComponent {
@@ -84,7 +84,7 @@ describe('Claim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-no-taskid-validation-component',
selector: 'adf-cloud-claim-no-taskid-validation-component',
template: '<button adf-cloud-claim-task [appName]="appName"></button>'
})
class ClaimTestMissingTaskIdDirectiveComponent {
@@ -96,7 +96,7 @@ describe('Claim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-undefined-appname-component',
selector: 'adf-cloud-claim-undefined-appname-component',
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameUndefined"></button>'
})
class ClaimTestInvalidAppNameUndefineddDirectiveComponent {
@@ -109,7 +109,7 @@ describe('Claim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-null-appname-component',
selector: 'adf-cloud-claim-null-appname-component',
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameNull"></button>'
})
class ClaimTestInvalidAppNameNulldDirectiveComponent {

View File

@@ -19,6 +19,7 @@ import { IdentityUserService } from '@alfresco/adf-core';
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
selector: '[adf-cloud-claim-task]'
})
export class ClaimTaskDirective implements OnInit {

View File

@@ -26,7 +26,7 @@ import { TaskCloudService } from '../services/task-cloud.service';
describe('CompleteTaskDirective', () => {
@Component({
selector: 'adf-test-component',
selector: 'adf-cloud-test-component',
template: `<button adf-cloud-complete-task [taskId]='taskMock' [appName]='appNameMock' (success)="onCompleteTask($event)"></button>`
})
class TestComponent {
@@ -73,7 +73,7 @@ describe('CompleteTaskDirective', () => {
describe('Complete Task Directive validation errors', () => {
@Component({
selector: 'adf-no-fields-validation-component',
selector: 'adf-cloud-no-fields-validation-component',
template: '<button adf-cloud-complete-task (success)="onCompleteTask($event)"></button>'
})
class TestMissingInputDirectiveComponent {
@@ -91,7 +91,7 @@ describe('Complete Task Directive validation errors', () => {
}
@Component({
selector: 'adf-no-taskid-validation-component',
selector: 'adf-cloud-no-taskid-validation-component',
template: '<button adf-cloud-complete-task [appName]="appName" (success)="onCompleteTask($event)"></button>'
})
class TestMissingTaskIdDirectiveComponent {
@@ -107,7 +107,7 @@ describe('Complete Task Directive validation errors', () => {
}
@Component({
selector: 'adf-undefined-appname-component',
selector: 'adf-cloud-undefined-appname-component',
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameUndefined" (success)="onCompleteTask($event)"></button>'
})
class TestInvalidAppNameUndefineddDirectiveComponent {
@@ -124,7 +124,7 @@ describe('Complete Task Directive validation errors', () => {
}
@Component({
selector: 'adf-null-appname-component',
selector: 'adf-cloud-null-appname-component',
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameNull" (success)="onCompleteTask($event)"></button>'
})
class TestInvalidAppNameNulldDirectiveComponent {

View File

@@ -18,6 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
selector: '[adf-cloud-complete-task]'
})
export class CompleteTaskDirective implements OnInit {

View File

@@ -18,6 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
import { TaskCloudService } from '../services/task-cloud.service';
@Directive({
// tslint:disable-next-line: directive-selector
selector: '[adf-cloud-unclaim-task]'
})
export class UnClaimTaskDirective implements OnInit {

View File

@@ -26,7 +26,7 @@ import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock';
describe('UnClaimTaskDirective', () => {
@Component({
selector: 'adf-test-component',
selector: 'adf-cloud-test-component',
template: '<button adf-cloud-unclaim-task [taskId]="taskIdMock" [appName]="appName"></button>'
})
class TestComponent {
@@ -71,7 +71,7 @@ describe('UnClaimTaskDirective', () => {
describe('UnClaim Task Directive validation errors', () => {
@Component({
selector: 'adf-claim-no-fields-validation-component',
selector: 'adf-cloud-claim-no-fields-validation-component',
template: '<button adf-cloud-unclaim-task></button>'
})
class ClaimTestMissingInputDirectiveComponent {
@@ -85,7 +85,7 @@ describe('UnClaim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-no-taskid-validation-component',
selector: 'adf-cloud-claim-no-taskid-validation-component',
template: '<button adf-cloud-unclaim-task [appName]="appName"></button>'
})
class ClaimTestMissingTaskIdDirectiveComponent {
@@ -97,7 +97,7 @@ describe('UnClaim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-undefined-appname-component',
selector: 'adf-cloud-claim-undefined-appname-component',
template: '<button adf-cloud-unclaim-task [taskId]="taskMock" [appName]="appNameUndefined"></button>'
})
class ClaimTestInvalidAppNameUndefineddDirectiveComponent {
@@ -110,7 +110,7 @@ describe('UnClaim Task Directive validation errors', () => {
}
@Component({
selector: 'adf-claim-null-appname-component',
selector: 'adf-cloud-claim-null-appname-component',
template: '<button adf-cloud-unclaim-task [taskId]="taskMock" [appName]="appNameNull"></button>'
})
class ClaimTestInvalidAppNameNulldDirectiveComponent {

View File

@@ -96,7 +96,7 @@ describe('Task Cloud Service', () => {
const appName = 'simple-app';
const taskId = '68d54a8f';
service.completeTask(appName, taskId).toPromise().then( (res: any) => {
service.completeTask(appName, taskId).toPromise().then(() => {
}, (error) => {
expect(error).toBeDefined();
done();

View File

@@ -1,5 +1,5 @@
<mat-accordion [hideToggle]="isLoading">
<mat-expansion-panel (afterExpand)="onExpand($event)" (closed)="onClose($event)">
<mat-expansion-panel (afterExpand)="onExpand()" (closed)="onClose()">
<mat-expansion-panel-header *ngIf="taskFilter" id="adf-edit-task-filter-expansion-header">
<ng-container *ngIf="!isLoading; else loadingTemplate">
<mat-panel-title fxLayoutAlign="space-between center" id="adf-edit-task-filter-title-id">{{taskFilter.name | translate}}</mat-panel-title>

View File

@@ -470,7 +470,7 @@ describe('EditTaskFilterCloudComponent', () => {
second: 59
});
component.filterChange.subscribe( (res) => {
component.filterChange.subscribe(() => {
expect(component.changedTaskFilter.lastModifiedTo.toISOString()).toEqual(lastModifiedToFilter.toISOString());
done();
});

View File

@@ -18,7 +18,7 @@
import { Component, OnChanges, Input, Output, EventEmitter, SimpleChanges, OnInit, OnDestroy } from '@angular/core';
import { AbstractControl, FormGroup, FormBuilder } from '@angular/forms';
import { MatDialog, DateAdapter } from '@angular/material';
import { debounceTime, filter, takeUntil } from 'rxjs/operators';
import { debounceTime, filter, takeUntil, finalize } from 'rxjs/operators';
import { Subject } from 'rxjs';
import moment from 'moment-es6';
import { Moment } from 'moment';
@@ -191,14 +191,15 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
retrieveTaskFilterAndBuildForm() {
this.isLoading = true;
this.taskFilterCloudService.getTaskFilterById(this.appName, this.id)
.pipe(takeUntil(this.onDestroy$)).subscribe((response) => {
this.isLoading = false;
.pipe(
finalize(() => this.isLoading = false),
takeUntil(this.onDestroy$)
)
.subscribe(response => {
this.taskFilter = new TaskFilterCloudModel(response);
this.taskFilterProperties = this.createAndFilterProperties();
this.taskFilterActions = this.createAndFilterActions();
this.buildForm(this.taskFilterProperties);
}, (error) => {
this.isLoading = false;
});
}
@@ -403,11 +404,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
return this.showFilterActions;
}
onExpand(event: any) {
onExpand() {
this.toggleFilterActions = true;
}
onClose(event: any) {
onClose() {
this.toggleFilterActions = false;
}

View File

@@ -40,7 +40,7 @@ describe('TaskFiltersCloudComponent', () => {
observer.complete();
});
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalFilterPromise = new Promise(function (resolve) {
resolve(fakeGlobalFilter);
});

View File

@@ -425,7 +425,7 @@ describe('TaskFormCloudComponent', () => {
});
@Component({
selector: 'adf-task-form-cloud-with-custom-outcomes',
selector: 'adf-cloud-task-form-cloud-with-custom-outcomes',
template: `
<adf-cloud-form #adfCloudForm>
<adf-cloud-form-custom-outcomes>

View File

@@ -262,7 +262,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy {
this.router.navigate([`/cloud/${this.appName}/`]);
}
onCompletedTask(event: any) {
// @deprecated: not used anymore
onCompletedTask() {
this.goBack();
}

View File

@@ -40,7 +40,7 @@ describe('Activiti TaskList Cloud Service', () => {
function returnCallQueryParameters() {
return {
oauth2Auth: {
callCustomApi : (queryUrl, operation, context, queryParams) => {
callCustomApi : (_queryUrl, _operation, _context, queryParams) => {
return Promise.resolve(queryParams);
}
}
@@ -50,7 +50,7 @@ describe('Activiti TaskList Cloud Service', () => {
function returnCallUrl() {
return {
oauth2Auth: {
callCustomApi : (queryUrl, operation, context, queryParams) => {
callCustomApi : (queryUrl) => {
return Promise.resolve(queryUrl);
}
}