Improved ESLint configuration, integrated spellcheck and error fixes (#8931)

* integrate cspell with eslint, improved configuration

* core: fix linting errors

* core: fix lint warnings

* content: lint fixes

* process service lint fixes

* lint: process services cloud

* lint: insights

* lint: extensions

* [ci:force] lint: cli fixes

* [ci:force] comment out dead code

* [ci:force] exclude dead code

* fix code and tests

* rollback some changes

* fix testing lib

* fix demo shell

* minor lint warning fixes

* minor lint fixes

* fix process services
This commit is contained in:
Denys Vuika
2023-09-26 13:46:53 +01:00
committed by GitHub
parent 8370a3de66
commit ef551a9c71
134 changed files with 2436 additions and 2269 deletions

View File

@@ -578,7 +578,7 @@ describe('FormCloudComponent', () => {
spyOn(formComponent, 'handleError').and.stub();
spyOn(formCloudService, 'getTaskForm').and.callFake(() => throwError(error));
formComponent.getFormByTaskId('test-app', '123').then((_) => {
formComponent.getFormByTaskId('test-app', '123').then(() => {
expect(formComponent.handleError).toHaveBeenCalledWith(error);
done();
});
@@ -1049,7 +1049,7 @@ describe('FormCloudComponent', () => {
pfx_property_five: 'orange',
pfx_property_none: 'no_form_field'
}, 'Complete', 123).subscribe({
next: _ => done.fail('expected an error, not data'),
next: () => done.fail('expected an error, not data'),
error: error => {
expect(error).toBe(errorMessage);
expect(formComponent.disableSaveButton).toBeFalse();

View File

@@ -94,7 +94,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
this.contentModelFormFileHandler(files[0]);
}
this.field.params.displayableCMProperties = this.field.params.displayableCMProperties ?? [];
this.displayedColumns.splice(2, 0, ...this.field.params.displayableCMProperties?.map(property => property?.name));
this.displayedColumns.splice(2, 0, ...(this.field.params.displayableCMProperties?.map(property => property?.name) || []));
}
isPathStaticType(): boolean {

View File

@@ -128,7 +128,7 @@ export class DataTableWidgetComponent extends WidgetComponent implements OnInit
const properties = path.split('.');
const currentProperty = properties.shift();
if (!data.hasOwnProperty(currentProperty)) {
if (!Object.prototype.hasOwnProperty.call(data, currentProperty)) {
return [];
}

View File

@@ -132,7 +132,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
const properties = path.split('.');
const currentProperty = properties.shift();
if (!data.hasOwnProperty(currentProperty)) {
if (!Object.prototype.hasOwnProperty.call(data, currentProperty)) {
this.handleError(`${currentProperty} not found in ${JSON.stringify(data)}`);
this.variableOptionsFailed = true;
return [];

View File

@@ -213,7 +213,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
getFormControlsConfig(processFilterProperties: ProcessFilterProperties[]): any {
const properties = processFilterProperties.map((property) => {
if (!!property.attributes) {
if (property.attributes) {
return this.getAttributesControlConfig(property);
} else {
return { [property.key]: property.value };
@@ -288,7 +288,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
}
if (this.filterProperties.includes('initiator')) {
this.initiatorOptions = !!this.processFilter.initiator
this.initiatorOptions = this.processFilter.initiator
? this.processFilter.initiator.split(',').map((username) => Object.assign({}, { username }))
: [];
}

View File

@@ -19,7 +19,7 @@
import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
import { ComponentSelectionMode } from '../../../types';
import { ComponentSelectionMode } from '../../../types';
export class ProcessFilterCloudModel {
id: string;

View File

@@ -40,17 +40,17 @@ export class ProcessFilterCloudService {
readQueryParams(obj: any): ProcessFilterCloudModel {
const model = Object.assign({}, obj) as ProcessFilterCloudModel;
if (obj.hasOwnProperty('appVersion') && obj['appVersion']) {
if (Object.prototype.hasOwnProperty.call(obj, 'appVersion') && obj['appVersion']) {
if (typeof obj['appVersion'] === 'string') {
model.appVersion = obj['appVersion'].split(',').map((str) => parseInt(str, 10));
}
}
if (obj.hasOwnProperty('lastModifiedFrom')) {
if (Object.prototype.hasOwnProperty.call(obj, 'lastModifiedFrom')) {
model.lastModifiedFrom = new Date(parseInt(obj['lastModifiedFrom'], 10));
}
if (obj.hasOwnProperty('lastModifiedTo')) {
if (Object.prototype.hasOwnProperty.call(obj, 'lastModifiedTo')) {
model.lastModifiedTo = new Date(parseInt(obj['lastModifiedTo'], 10));
}
@@ -82,7 +82,7 @@ export class ProcessFilterCloudService {
if (value['lastModifiedTo']) {
result['lastModifiedTo'] = value['lastModifiedTo'].valueOf();
}
} else if (value.hasOwnProperty(prop)) {
} else if (Object.prototype.hasOwnProperty.call(value, prop)) {
result[prop] = value[prop];
}
}

View File

@@ -365,7 +365,7 @@ export class ProcessListCloudComponent
}
private isPropertyChanged(changes: SimpleChanges, property: string): boolean {
return changes.hasOwnProperty(property);
return Object.prototype.hasOwnProperty.call(changes, property);
}
isListEmpty(): boolean {

View File

@@ -107,7 +107,7 @@ export class ProcessListCloudService extends BaseCloudService {
const queryParam = {};
for (const property in requestNode) {
if (requestNode.hasOwnProperty(property) && !this.isExcludedField(property) && this.isPropertyValueValid(requestNode, property)) {
if (Object.prototype.hasOwnProperty.call(requestNode, property) && !this.isExcludedField(property) && this.isPropertyValueValid(requestNode, property)) {
queryParam[property] = this.getQueryParamValueFromRequestNode(requestNode, property as keyof ProcessQueryCloudRequestModel);
}
}

View File

@@ -60,7 +60,7 @@ export class ProcessTaskListCloudService extends BaseCloudService implements Tas
protected buildQueryParams(requestNode: TaskQueryCloudRequestModel): any {
const queryParam: any = {};
for (const property in requestNode) {
if (requestNode.hasOwnProperty(property) && !this.isExcludedField(property) && this.isPropertyValueValid(requestNode, property)) {
if (Object.prototype.hasOwnProperty.call(requestNode, property) && !this.isExcludedField(property) && this.isPropertyValueValid(requestNode, property)) {
queryParam[property] = requestNode[property];
}
}

View File

@@ -377,7 +377,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
}
getProcessDefinitionValue(process: ProcessDefinitionCloud): string {
return !!process.name ? process.name : process.key;
return process.name ? process.name : process.key;
}
get processInstanceName(): UntypedFormControl {

View File

@@ -81,7 +81,7 @@ export class NotificationCloudService extends BaseCloudService {
if (graphQLErrors) {
for (const err of graphQLErrors) {
switch (err.extensions.code) {
case 'UNAUTHENTICATED':
case 'UNAUTHENTICATED': {
const oldHeaders = operation.getContext().headers;
operation.setContext({
headers: {
@@ -92,7 +92,9 @@ export class NotificationCloudService extends BaseCloudService {
});
forward(operation);
break;
}
default:
break;
}
}
}

View File

@@ -434,7 +434,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
getFormControlsConfig(taskFilterProperties: TaskFilterProperties[]): any {
const properties = taskFilterProperties.map((property) => {
if (!!property.attributes) {
if (property.attributes) {
return this.getAttributesControlConfig(property);
} else {
return { [property.key]: property.value };

View File

@@ -318,7 +318,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
}
hasAssignee(): boolean {
return !!this.taskDetails.assignee ? true : false;
return this.taskDetails.assignee ? true : false;
}
isTaskValid(): boolean {

View File

@@ -86,7 +86,7 @@ export class ServiceTaskListCloudService extends BaseCloudService {
protected buildQueryParams(requestNode: ServiceTaskQueryCloudRequestModel): any {
const queryParam: any = {};
for (const property in requestNode) {
if (requestNode.hasOwnProperty(property) &&
if (Object.prototype.hasOwnProperty.call(requestNode, property) &&
!this.isExcludedField(property) &&
this.isPropertyValueValid(requestNode, property)) {
queryParam[property] = requestNode[property];

View File

@@ -61,7 +61,7 @@ export class TaskListCloudService extends BaseCloudService implements TaskListCl
const queryParam: any = {};
for (const propertyKey in requestNode) {
if (
requestNode.hasOwnProperty(propertyKey) &&
Object.prototype.hasOwnProperty.call(requestNode, propertyKey) &&
!this.isExcludedField(propertyKey) &&
this.isPropertyValueValid(requestNode, propertyKey)
) {