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

@@ -53,7 +53,7 @@ export class CloudFiltersDemoComponent implements OnInit {
this.currentProcessFilter$ = this.cloudLayoutService.processFilter$;
let root = '';
if (this.route.snapshot && this.route.snapshot.firstChild) {
if (this.route.snapshot?.firstChild) {
root = this.route.snapshot.firstChild.url[0].path;
if (root === 'tasks') {
this.expandTaskFilter = true;

View File

@@ -41,7 +41,7 @@ export class CloudLayoutComponent implements OnInit {
this.appName = params.appName;
});
if (this.route.snapshot && this.route.snapshot.firstChild) {
if (this.route.snapshot?.firstChild) {
root = this.route.snapshot.firstChild.url[0].path;
}

View File

@@ -185,7 +185,7 @@ export class ProcessesCloudDemoComponent implements OnInit, OnDestroy {
}
private loadFilter(model: ProcessFilterCloudModel) {
if (model && model.appName && model.id) {
if (model?.appName && model.id) {
this.editedFilter = model;
}
}

View File

@@ -84,7 +84,7 @@ export class FileViewComponent implements OnInit {
if (id) {
this.nodeApiService.getNode(id).subscribe(
(node) => {
if (node && node.isFile) {
if (node?.isFile) {
this.isCommentEnabled = this.contentServices.hasPermissions(node, PermissionsEnum.NOT_CONSUMER) ||
this.contentServices.hasAllowableOperations(node, AllowableOperationsEnum.UPDATE);
this.nodeId = id;

View File

@@ -231,7 +231,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
showFile(event) {
const entry = event.value.entry;
if (entry && entry.isFile) {
if (entry?.isFile) {
this.preview.showResource(entry.id);
}
}
@@ -296,7 +296,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
ngOnChanges(changes: SimpleChanges) {
if (changes.nodeResult && changes.nodeResult.currentValue) {
if (changes.nodeResult?.currentValue) {
this.nodeResult = changes.nodeResult.currentValue;
this.pagination = this.nodeResult.list.pagination;
}
@@ -468,7 +468,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
if (selection && selection.length === 1) {
const entry = selection[0].entry;
if (entry && entry.isFolder) {
if (entry?.isFolder) {
return this.contentService.hasAllowableOperations(entry, 'update');
}
}
@@ -570,7 +570,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
searchResultsHighlight(search: SearchEntry): string {
if (search && search.highlight) {
if (search?.highlight) {
return search.highlight.map((currentHighlight) => currentHighlight.snippets).join(', ');
}
return '';
@@ -588,7 +588,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
const objectFromMap = {};
activeFilters.forEach((filter: FilterSearch) => {
let paramValue = null;
if (filter.value && filter.value.from && filter.value.to) {
if (filter.value?.from && filter.value.to) {
paramValue = `${filter.value.from}||${filter.value.to}`;
} else {
paramValue = filter.value;

View File

@@ -41,9 +41,9 @@ export class VersionManagerDialogAdapterComponent {
private containingDialog?: MatDialogRef<VersionManagerDialogAdapterComponent>
) {
this.contentEntry = data.contentEntry;
this.newFileVersion = data.hasOwnProperty('newFileVersion') ? data.newFileVersion : this.newFileVersion;
this.showComments = data.hasOwnProperty('showComments') ? data.showComments : this.showComments;
this.allowDownload = data.hasOwnProperty('allowDownload') ? data.allowDownload : this.allowDownload;
this.newFileVersion = Object.prototype.hasOwnProperty.call(data, 'newFileVersion') ? data.newFileVersion : this.newFileVersion;
this.showComments = Object.prototype.hasOwnProperty.call(data, 'showComments') ? data.showComments : this.showComments;
this.allowDownload = Object.prototype.hasOwnProperty.call(data, 'allowDownload') ? data.allowDownload : this.allowDownload;
}
uploadError(event: FileUploadErrorEvent) {

View File

@@ -124,7 +124,7 @@ export class ProcessListDemoComponent implements OnInit, OnDestroy {
}
isFormValid() {
return this.processListForm && this.processListForm.dirty && this.processListForm.valid;
return this.processListForm?.dirty && this.processListForm.valid;
}
resetProcessForm() {

View File

@@ -93,7 +93,7 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges, OnDestroy
}
isCompletedProcess(): boolean {
return this.processInstance && this.processInstance.ended !== undefined && this.processInstance.ended !== null;
return this.processInstance?.ended != null;
}
}

View File

@@ -180,7 +180,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
.subscribe(
(validateDynamicTableRowEvent: ValidateDynamicTableRowEvent) => {
const row: DynamicTableRow = validateDynamicTableRowEvent.row;
if (row && row.value && row.value.name === 'admin') {
if (row?.value && row.value.name === 'admin') {
validateDynamicTableRowEvent.summary.isValid = false;
validateDynamicTableRowEvent.summary.message = 'Sorry, wrong value. You cannot use "admin".';
validateDynamicTableRowEvent.preventDefault();

View File

@@ -92,7 +92,7 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
}
isCompletedTask(): boolean {
return this.taskDetails && this.taskDetails.endDate !== undefined && this.taskDetails.endDate !== null;
return this.taskDetails?.endDate != null;
}
}

View File

@@ -51,7 +51,7 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.onDestroy$))
.subscribe(([params, searchConfig]) => {
this.updateSearchSetting(searchConfig);
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
this.searchedWord = Object.prototype.hasOwnProperty.call(params, this.queryParamName) ? params[this.queryParamName] : null;
const query = this.formatSearchQuery(this.searchedWord, searchConfig['app:fields']);
if (query) {
this.queryBuilder.userQuery = query;
@@ -87,7 +87,7 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
if (this.route) {
this.route.params.forEach((params: Params) => {
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
this.searchedWord = Object.prototype.hasOwnProperty.call(params, this.queryParamName) ? params[this.queryParamName] : null;
if (this.searchedWord) {
this.queryBuilder.update();
} else {

View File

@@ -50,7 +50,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
combineLatest([this.route.params, this.queryBuilder.configUpdated])
.pipe(takeUntil(this.onDestroy$))
.subscribe(([params, searchConfig]) => {
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
this.searchedWord = Object.prototype.hasOwnProperty.call(params, this.queryParamName) ? params[this.queryParamName] : null;
const query = this.formatSearchQuery(this.searchedWord, searchConfig['app:fields']);
if (query) {
this.queryBuilder.userQuery = query;
@@ -86,7 +86,7 @@ export class SearchResultComponent implements OnInit, OnDestroy {
if (this.route) {
this.route.params.forEach((params: Params) => {
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
this.searchedWord = Object.prototype.hasOwnProperty.call(params, this.queryParamName) ? params[this.queryParamName] : null;
if (this.searchedWord) {
this.queryBuilder.update();
} else {

View File

@@ -21,7 +21,7 @@ import { AppConfigService, AppConfigValues, StorageService, AlfrescoApiService,
import { ENTER } from '@angular/cdk/keycodes';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
export const HOST_REGEX = '^(http|https):\/\/.*[^/]$';
export const HOST_REGEX = '^(http|https)://.*[^/]$';
@Component({
providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { floatLabel: 'always' } }],

View File

@@ -190,7 +190,7 @@ export class TaskListDemoComponent implements OnInit, OnDestroy {
}
isFormValid() {
return this.taskListForm && this.taskListForm.dirty && this.taskListForm.valid;
return this.taskListForm?.dirty && this.taskListForm.valid;
}
private getControl<T extends AbstractControl>(key: string): T {