Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Linting

Oliver Güntherd190e401d75d
diff --git a/frontend/src/app/core/apiv3/paths/apiv3-resource.ts b/frontend/src/app/core/apiv3/paths/apiv3-resource.ts
index a808f555a8d..479caab428d 100644
--- a/frontend/src/app/core/apiv3/paths/apiv3-resource.ts
+++ b/frontend/src/app/core/apiv3/paths/apiv3-resource.ts
@@ -1,3 +1,5 @@
+/* eslint-disable max-classes-per-file */
+
import { Constructor } from '@angular/cdk/table';
import { SimpleResource, SimpleResourceCollection } from 'core-app/core/apiv3/paths/path-resources';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-searchable-multiselect-value/filter-searchable-multiselect-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-searchable-multiselect-value/filter-searchable-multiselect-value.component.ts
index d6e7c71cba1..25af8f383c5 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-searchable-multiselect-value/filter-searchable-multiselect-value.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/filter-searchable-multiselect-value/filter-searchable-multiselect-value.component.ts
@@ -80,6 +80,7 @@ export class FilterSearchableMultiselectValueComponent extends UntilDestroyedMix
public loadAvailable(matching:string):Observable<HalResource[]> {
const filters:ApiV3FilterBuilder = this.createFilters(matching);
+ /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
const { href } = this.filter.currentSchema!.values!.allowedValues as { href:string };
const filteredData = (this.apiV3Service.collectionFromString(href) as
@@ -93,7 +94,7 @@ export class FilterSearchableMultiselectValueComponent extends UntilDestroyedMix
return filteredData;
}
- protected createFilters(matching:string) {
+ protected createFilters(matching:string):ApiV3FilterBuilder {
const filters = new ApiV3FilterBuilder();
if (matching) {
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.html
index 195aecb6e98..311c4e8b302 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.html
@@ -6,7 +6,7 @@
class="advanced-filters--ng-select -multi-select"
[id]="'values-' + filter.id"
[items]="availableOptions"
- [classes]="{'-required-highlighting' : isEmpty}"
+ [classes]="{'-required-highlighting' : value.length === 0}"
[virtualScroll]
[closeOnSelect]="false"
[placeholder]="text.placeholder"
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.ts
index 1857aebfbab..a48dbaba957 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/filter-toggled-multiselect-value/filter-toggled-multiselect-value.component.ts
@@ -63,8 +63,6 @@ export class FilterToggledMultiselectValueComponent implements OnInit, AfterView
public availableOptions:HalResource[] = [];
- private _isEmpty:boolean;
-
readonly text = {
placeholder: this.I18n.t('js.placeholders.selection'),
};
@@ -79,6 +77,7 @@ export class FilterToggledMultiselectValueComponent implements OnInit, AfterView
}
ngOnInit():void {
+ /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
const values = (this.filter.currentSchema!.values!.allowedValues as HalResource[]);
this.availableOptions = this.halSorting.sort(values);
}
@@ -98,8 +97,4 @@ export class FilterToggledMultiselectValueComponent implements OnInit, AfterView
this.filterChanged.emit(this.filter);
this.cdRef.detectChanges();
}
-
- public get isEmpty():boolean {
- return this._isEmpty = this.value.length === 0;
- }
}
diff --git a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
index 28868e39e64..3da5b84e582 100644
--- a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
+++ b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts
@@ -1,31 +1,37 @@
+/* We just forward the ng-select outputs without renaming */
+/* eslint-disable @angular-eslint/no-output-native */
import {
AfterViewInit,
- OnChanges,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
EventEmitter,
+ HostBinding,
Input,
NgZone,
+ OnChanges,
Output,
+ SimpleChanges,
TemplateRef,
ViewChild,
- SimpleChanges,
- HostBinding,
} from '@angular/core';
-import { DropdownPosition, NgSelectComponent } from '@ng-select/ng-select';
import {
- Observable,
+ DropdownPosition,
+ NgSelectComponent,
+} from '@ng-select/ng-select';
+import {
+ BehaviorSubject,
+ merge,
NEVER,
+ Observable,
of,
Subject,
- merge,
- BehaviorSubject,
} from 'rxjs';
import {
debounceTime,
- distinctUntilChanged, filter,
+ distinctUntilChanged,
+ filter,
switchMap,
tap,
} from 'rxjs/operators';
@@ -137,7 +143,7 @@ export class OpAutocompleterComponent extends UntilDestroyedMixin implements Aft
@Input() public maxSelectedItems?:number;
- @Input() public groupBy?:string | Function;
+ @Input() public groupBy?:string|(() => string);
@Input() public groupValue?:GroupValueFn;
@@ -169,28 +175,28 @@ export class OpAutocompleterComponent extends UntilDestroyedMixin implements Aft
@Input() public editableSearchTerm?:boolean = false;
- @Input() public keyDownFn ? = (_:KeyboardEvent) => true;
+ @Input() public keyDownFn ? = ():boolean => true;
@Input() public typeahead:BehaviorSubject<string|null> = new BehaviorSubject(null);
// a function for setting the options of ng-select
- @Input() public getOptionsFn:(searchTerm:string) => any;
+ @Input() public getOptionsFn:(searchTerm:string) => Observable<unknown>;
- @Output() public open = new EventEmitter<any>();
+ @Output() public open = new EventEmitter<unknown>();
- @Output() public close = new EventEmitter<any>();
+ @Output() public close = new EventEmitter<unknown>();
- @Output() public change = new EventEmitter<any>();
+ @Output() public change = new EventEmitter<unknown>();
- @Output() public focus = new EventEmitter<any>();
+ @Output() public focus = new EventEmitter<unknown>();
- @Output() public blur = new EventEmitter<any>();
+ @Output() public blur = new EventEmitter<unknown>();
- @Output() public search = new EventEmitter<{ term:string, items:any[] }>();
+ @Output() public search = new EventEmitter<{ term:string, items:unknown[] }>();
- @Output() public keydown = new EventEmitter<any>();
+ @Output() public keydown = new EventEmitter<unknown>();
- @Output() public clear = new EventEmitter<any>();
+ @Output() public clear = new EventEmitter<unknown>();
@Output() public add = new EventEmitter();
@@ -231,7 +237,7 @@ export class OpAutocompleterComponent extends UntilDestroyedMixin implements Aft
super();
}
- ngOnChanges(changes:SimpleChanges) {
+ ngOnChanges(changes:SimpleChanges):void {
if (changes.items) {
this.items$.next(changes.items.currentValue);
}
@@ -242,8 +248,6 @@ export class OpAutocompleterComponent extends UntilDestroyedMixin implements Aft
return;
}
- this.loading$.subscribe(console.log);
-
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
this.results$ = merge(
@@ -253,12 +257,17 @@ export class OpAutocompleterComponent extends UntilDestroyedMixin implements Aft
distinctUntilChanged(),
debounceTime(250),
tap(() => this.loading$.next(true)),
- (this.defaultData
- ? switchMap((queryString:string) => this.opAutocompleterService.loadData(queryString, this.resource, this.filters, this.searchKey))
- : this.getOptionsFn
- ? switchMap((queryString:string) => this.getOptionsFn(queryString))
- : switchMap(() => NEVER)
- ),
+ switchMap((queryString:string) => {
+ if (this.defaultData) {
+ return this.opAutocompleterService.loadData(queryString, this.resource, this.filters, this.searchKey);
+ }
+
+ if (this.getOptionsFn) {
+ return this.getOptionsFn(queryString);
+ }
+
+ return NEVER;
+ }),
tap(() => this.loading$.next(false)),
),
);