[AAE-7100] ESLint support for ADF Core and DemoShell projects (#7481)

* remove tsconfig.base as per eslint schematics

* add schematics

* upgrade demoshell to eslint

* fix eslint issues for demoshell

* integrate eslint for ADF core and fix some issues

* turn into warn

* fix code

* workaround for Chrome clipboard issue

* exclude e2e tests

* exclude e2e
This commit is contained in:
Denys Vuika
2022-02-02 18:01:47 +00:00
committed by GitHub
parent 6ef4838688
commit b8bb234410
192 changed files with 2553 additions and 483 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, ViewEncapsulation } from '@angular/core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from '../services/cloud-layout.service';
@@ -31,7 +31,7 @@ import { CloudLayoutService } from '../services/cloud-layout.service';
`],
encapsulation: ViewEncapsulation.None
})
export class CommunityCloudComponent {
export class CommunityCloudComponent implements OnInit {
constructor(
private router: Router,

View File

@@ -31,13 +31,13 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Pagination } from '@alfresco/js-api';
const PROCESS_FILTER_PROPERTY_KEYS = 'adf-edit-process-filter';
const ACTION_SAVE_AS = 'saveAs';
@Component({
templateUrl: './community-processes-cloud.component.html'
})
export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
public static ACTION_SAVE_AS = 'saveAs';
static PROCESS_FILTER_PROPERTY_KEYS = 'adf-edit-process-filter';
@ViewChild('processCloud')
processCloud: ProcessListCloudComponent;
@@ -66,7 +66,7 @@ export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
private processFilterCloudService: ProcessFilterCloudService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(
CommunityProcessesCloudDemoComponent.PROCESS_FILTER_PROPERTY_KEYS
PROCESS_FILTER_PROPERTY_KEYS
);
if (properties) {
@@ -138,7 +138,7 @@ export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
onProcessFilterAction(filterAction: any) {
this.cloudLayoutService.setCurrentProcessFilterParam({ id: filterAction.filter.id });
if (filterAction.actionType === CommunityProcessesCloudDemoComponent.ACTION_SAVE_AS) {
if (filterAction.actionType === ACTION_SAVE_AS) {
this.router.navigate([`/cloud/community/processes/`], { queryParams: filterAction.filter });
}
}

View File

@@ -24,17 +24,14 @@ import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Pagination } from '@alfresco/js-api';
const ACTION_SAVE_AS = 'saveAs';
const TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
@Component({
templateUrl: './community-task-cloud.component.html',
styles: [`.adf-cloud-layout-tab-body .mat-tab-body-wrapper {
height: 100%;
}
`]
styles: [`.adf-cloud-layout-tab-body .mat-tab-body-wrapper { height: 100%; }`]
})
export class CommunityTasksCloudDemoComponent implements OnInit, OnDestroy {
public static ACTION_SAVE_AS = 'saveAs';
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
@ViewChild('taskCloud')
taskCloud: TaskListCloudComponent;
@@ -63,7 +60,7 @@ export class CommunityTasksCloudDemoComponent implements OnInit, OnDestroy {
private userPreference: UserPreferencesService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(CommunityTasksCloudDemoComponent.TASK_FILTER_PROPERTY_KEYS);
const properties = this.appConfig.get<Array<any>>(TASK_FILTER_PROPERTY_KEYS);
if (properties) {
this.taskFilterProperties = properties;
}
@@ -137,7 +134,7 @@ export class CommunityTasksCloudDemoComponent implements OnInit, OnDestroy {
onTaskFilterAction(filterAction: any) {
this.cloudLayoutService.setCurrentTaskFilterParam({ id: filterAction.filter.id });
if (filterAction.actionType === CommunityTasksCloudDemoComponent.ACTION_SAVE_AS) {
if (filterAction.actionType === ACTION_SAVE_AS) {
this.router.navigate([`/cloud/community/tasks/`], { queryParams: filterAction.filter });
}
}

View File

@@ -17,7 +17,7 @@
import { Component, OnInit } from '@angular/core';
import { FormService, WidgetComponent } from '@alfresco/adf-core';
// tslint:disable:component-selector
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'custom-editor-widget',

View File

@@ -27,7 +27,7 @@
<input matInput (input)="setPeopleAppName($any($event).target?.value)" data-automation-id="app-people-app-input" />
</mat-form-field>
<mat-form-field class="app-preselect-value-full">
<mat-label>{{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }} {{ DEFAULT_PEOPLE_PLACEHOLDER }}</mat-label>
<mat-label>{{ 'PEOPLE_GROUPS_CLOUD.PRESELECTED_VALUE' | translate }} {{ defaultPeoplePlaceholder }}</mat-label>
<input matInput (input)="setPeoplePreselectValue($any($event).target?.value)" data-automation-id="app-people-preselect-input" />
</mat-form-field>
<mat-checkbox class="app-preselect-value" (change)="onChangePeopleValidation($event)">{{
@@ -102,7 +102,7 @@
data-automation-id="app-group-app-input"/>
</mat-form-field>
<mat-form-field class="app-preselect-value-full">
<mat-label>Preselect: {{ DEFAULT_GROUP_PLACEHOLDER }}</mat-label>
<mat-label>Preselect: {{ defaultGroupPlaceholder }}</mat-label>
<input matInput
(input)="setGroupsPreselectValue($any($event).target?.value)"
data-automation-id="app-group-preselect-input" />

View File

@@ -29,16 +29,16 @@ import { IdentityGroupModel, IdentityUserModel } from '@alfresco/adf-core';
})
export class PeopleGroupCloudDemoComponent {
DEFAULT_FILTER_MODE: string = 'appName';
DEFAULT_GROUP_PLACEHOLDER: string = `[{"id": "1", "name":"activitiUserGroup"}]`;
DEFAULT_PEOPLE_PLACEHOLDER: string = `[{"id": "1", email": "user@user.com", "firstName":"user", "lastName": "lastName", "username": "user"}]`;
defaultFilterMode: string = 'appName';
defaultGroupPlaceholder: string = `[{"id": "1", "name":"activitiUserGroup"}]`;
defaultPeoplePlaceholder: string = `[{"id": "1", email": "user@user.com", "firstName":"user", "lastName": "lastName", "username": "user"}]`;
peopleMode: ComponentSelectionMode = 'single';
preSelectUsers: IdentityUserModel[] = [];
invalidUsers: IdentityUserModel[] = [];
peopleRoles: string[] = [];
peopleAppName: string;
peopleFilterMode: string = this.DEFAULT_FILTER_MODE;
peopleFilterMode: string = this.defaultFilterMode;
peoplePreselectValidation = false;
groupPreselectValidation = false;
peopleReadonly = false;
@@ -49,7 +49,7 @@ export class PeopleGroupCloudDemoComponent {
invalidGroups: IdentityGroupModel[] = [];
groupRoles: string[];
groupAppName: string;
groupFilterMode: string = this.DEFAULT_FILTER_MODE;
groupFilterMode: string = this.defaultFilterMode;
setPeoplePreselectValue(value: string): void {
this.preSelectUsers = this.getArrayFromString(value);

View File

@@ -39,7 +39,7 @@ export class ProcessCloudLayoutComponent {
'custom-something': () => CustomWidgetComponent,
'custom-boolean': () => CustomWidgetComponent,
'custom-date': () => CustomWidgetComponent,
'custom': () => CustomWidgetComponent
custom: () => CustomWidgetComponent
});
}
}

View File

@@ -41,8 +41,8 @@ export class ProcessesCloudDemoComponent implements OnInit, OnDestroy {
actionMenu: boolean;
contextMenu: boolean;
actions: any[] = [];
selectedAction: { id: number, name: string, actionType: string};
selectedContextAction: { id: number, name: string, actionType: string};
selectedAction: { id: number; name: string; actionType: string};
selectedContextAction: { id: number; name: string; actionType: string};
filterProperties: string[];
filterSortProperties: string[];
@@ -145,14 +145,12 @@ export class ProcessesCloudDemoComponent implements OnInit, OnDestroy {
}
onShowRowContextMenu(event: DataCellEvent) {
event.value.actions = this.actions.map((action) => {
return {
event.value.actions = this.actions.map((action) => ({
data: event.value.row['obj'],
model: action,
subject: this.performAction$
};
});
}));
}
onExecuteRowAction(row: any) {

View File

@@ -22,15 +22,12 @@ import { CloudLayoutService, CloudServiceSettings } from './services/cloud-layou
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
const TASK_FILTER_PROPERTY_KEYS = 'adf-edit-service-task-filter';
@Component({
templateUrl: './service-task-list-cloud-demo.component.html'
})
export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
public static ACTION_SAVE_AS = 'saveAs';
public static ACTION_DELETE = 'delete';
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-service-task-filter';
@ViewChild('taskCloud')
taskCloud: ServiceTaskListCloudComponent;
@@ -49,8 +46,8 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
actionMenu: boolean;
contextMenu: boolean;
actions: any[] = [];
selectedAction: { id: number, name: string, actionType: string};
selectedContextAction: { id: number, name: string, actionType: string};
selectedAction: { id: number; name: string; actionType: string};
selectedContextAction: { id: number; name: string; actionType: string};
selectionMode: string;
filterId: string;
@@ -61,7 +58,7 @@ export class ServiceTaskListCloudDemoComponent implements OnInit, OnDestroy {
private userPreference: UserPreferencesService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(ServiceTaskListCloudDemoComponent.TASK_FILTER_PROPERTY_KEYS);
const properties = this.appConfig.get<Array<any>>(TASK_FILTER_PROPERTY_KEYS);
if (properties === this.taskFilterProperties) {
this.taskFilterProperties = properties;
}

View File

@@ -45,11 +45,11 @@ export class CloudProcessFiltersService {
);
}
readQueryParams(obj: Object): ProcessFilterCloudModel {
readQueryParams(obj: any): ProcessFilterCloudModel {
return this.processFilterCloudService.readQueryParams(obj);
}
writeQueryParams(value: Object, appName?: string, id?: string): Object {
writeQueryParams(value: any, appName?: string, id?: string): any {
return this.processFilterCloudService.writeQueryParams(value, this.filterProperties, appName, id);
}
}

View File

@@ -114,7 +114,7 @@ export class CloudSettingsComponent implements OnInit, OnDestroy {
}
addAction() {
this.actions.push(<ActionMenuModel> this.actionMenuForm.value);
this.actions.push(this.actionMenuForm.value);
this.actionMenuForm.get('key').reset();
this.actionMenuForm.get('title').reset();
this.actionMenuForm.get('icon').reset();

View File

@@ -23,15 +23,14 @@ import { CloudLayoutService } from './services/cloud-layout.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
const ACTION_SAVE_AS = 'saveAs';
const ACTION_DELETE = 'delete';
const TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
@Component({
templateUrl: './tasks-cloud-demo.component.html'
})
export class TasksCloudDemoComponent implements OnInit, OnDestroy {
public static ACTION_SAVE_AS = 'saveAs';
public static ACTION_DELETE = 'delete';
static TASK_FILTER_PROPERTY_KEYS = 'adf-edit-task-filter';
@ViewChild('taskCloud')
taskCloud: TaskListCloudComponent;
@@ -51,8 +50,8 @@ export class TasksCloudDemoComponent implements OnInit, OnDestroy {
actionMenu: boolean;
contextMenu: boolean;
actions: any[] = [];
selectedAction: { id: number, name: string, actionType: string};
selectedContextAction: { id: number, name: string, actionType: string};
selectedAction: { id: number; name: string; actionType: string};
selectedContextAction: { id: number; name: string; actionType: string};
testingMode: boolean;
selectionMode: string;
taskDetailsRedirection: boolean;
@@ -67,7 +66,7 @@ export class TasksCloudDemoComponent implements OnInit, OnDestroy {
private userPreference: UserPreferencesService,
private appConfig: AppConfigService) {
const properties = this.appConfig.get<Array<any>>(TasksCloudDemoComponent.TASK_FILTER_PROPERTY_KEYS);
const properties = this.appConfig.get<Array<any>>(TASK_FILTER_PROPERTY_KEYS);
if (properties) {
this.taskFilterProperties = properties;
}
@@ -134,13 +133,13 @@ export class TasksCloudDemoComponent implements OnInit, OnDestroy {
onTaskFilterAction(filterAction: any) {
if (filterAction.actionType === TasksCloudDemoComponent.ACTION_DELETE) {
if (filterAction.actionType === ACTION_DELETE) {
this.cloudLayoutService.setCurrentTaskFilterParam({ index: 0 });
} else {
this.cloudLayoutService.setCurrentTaskFilterParam({ id: filterAction.filter.id });
}
if (filterAction.actionType === TasksCloudDemoComponent.ACTION_SAVE_AS) {
if (filterAction.actionType === ACTION_SAVE_AS) {
this.router.navigate([`/cloud/${this.appName}/tasks/`], { queryParams: filterAction.filter });
}
}
@@ -150,14 +149,12 @@ export class TasksCloudDemoComponent implements OnInit, OnDestroy {
}
onShowRowContextMenu(event: DataCellEvent) {
event.value.actions = this.actions.map((action) => {
return {
event.value.actions = this.actions.map((action) => ({
data: event.value.row['obj'],
model: action,
subject: this.performAction$
};
});
}));
}
onExecuteRowAction(row: any) {