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

Fix linting errors

Benjamin Bädorf3cc5ea205ef6
diff --git a/frontend/src/app/core/path-helper/apiv3-paths.ts b/frontend/src/app/core/path-helper/apiv3-paths.ts
new file mode 100644
index 00000000000..24eda1a02c8
--- /dev/null
+++ b/frontend/src/app/core/path-helper/apiv3-paths.ts
@@ -0,0 +1,58 @@
+import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
+
+export class Apiv3Paths {
+ readonly apiV3Base:string;
+
+ constructor(basePath:string) {
+ this.apiV3Base = `${basePath}/api/v3`;
+ }
+
+ public get openApiSpecPath():string {
+ return `${this.apiV3Base}/spec.json`;
+ }
+
+ /**
+ * Preview markup path
+ *
+ * Primarily used from ckeditor-augmented-textarea
+ * https://github.com/opf/commonmark-ckeditor-build/
+ *
+ * @param context
+ */
+ public previewMarkup(context:string) {
+ const base = `${this.apiV3Base}/render/markdown`;
+
+ if (context) {
+ return `${base}?context=${context}`;
+ }
+ return base;
+ }
+
+ /**
+ * Principals autocompleter path
+ *
+ * Primarily used from ckeditor-augmented-textarea
+ * https://github.com/opf/commonmark-ckeditor-build/
+ *
+ */
+ public principals(projectId:string|number, term:string|null) {
+ const filters:ApiV3FilterBuilder = new ApiV3FilterBuilder();
+ // Only real and activated users:
+ filters.add('status', '!', ['3']);
+ // that are members of that project:
+ filters.add('member', '=', [projectId.toString()]);
+ // That are users:
+ filters.add('type', '=', ['User', 'Group']);
+ // That are not the current user:
+ filters.add('id', '!', ['me']);
+
+ if (term && term.length > 0) {
+ // Containing the that substring:
+ filters.add('name', '~', [term]);
+ }
+
+ return `${this.apiV3Base
+ }/principals?${
+ filters.toParams({ sortBy: '[["name","asc"]]', offset: '1', pageSize: '10' })}`;
+ }
+}
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index fbf6d188a63..6fd992e0db8 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -27,64 +27,7 @@
//++
import { Injectable } from '@angular/core';
-import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
-
-class Apiv3Paths {
- readonly apiV3Base:string;
-
- constructor(basePath:string) {
- this.apiV3Base = `${basePath}/api/v3`;
- }
-
- public get openApiSpecPath():string {
- return `${this.apiV3Base}/spec.json`;
- }
-
- /**
- * Preview markup path
- *
- * Primarily used from ckeditor-augmented-textarea
- * https://github.com/opf/commonmark-ckeditor-build/
- *
- * @param context
- */
- public previewMarkup(context:string) {
- const base = `${this.apiV3Base}/render/markdown`;
-
- if (context) {
- return `${base}?context=${context}`;
- }
- return base;
- }
-
- /**
- * Principals autocompleter path
- *
- * Primarily used from ckeditor-augmented-textarea
- * https://github.com/opf/commonmark-ckeditor-build/
- *
- */
- public principals(projectId:string|number, term:string|null) {
- const filters:ApiV3FilterBuilder = new ApiV3FilterBuilder();
- // Only real and activated users:
- filters.add('status', '!', ['3']);
- // that are members of that project:
- filters.add('member', '=', [projectId.toString()]);
- // That are users:
- filters.add('type', '=', ['User', 'Group']);
- // That are not the current user:
- filters.add('id', '!', ['me']);
-
- if (term && term.length > 0) {
- // Containing the that substring:
- filters.add('name', '~', [term]);
- }
-
- return `${this.apiV3Base
- }/principals?${
- filters.toParams({ sortBy: '[["name","asc"]]', offset: '1', pageSize: '10' })}`;
- }
-}
+import { Apiv3Paths } from './apiv3-paths';
@Injectable({ providedIn: 'root' })
export class PathHelperService {
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
index d6c7a5353e6..f7aa31ca888 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
@@ -111,10 +111,10 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im
}
// For shared template compliance
- updateTitleName(val:string):void {}
+ updateTitleName(val:string):void {} // eslint-disable-line class-methods-use-this no-unused-vars
// For shared template compliance
- changeChangesFromTitle(val:string):void {}
+ changeChangesFromTitle(val:string):void {} // eslint-disable-line class-methods-use-this no-unused-vars
private backButtonFn():void {
if (this.backRoute) {
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
index d08ac58b43d..189d88cc50b 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts
@@ -30,6 +30,7 @@ import { take } from 'rxjs/internal/operators/take';
import { StateService } from '@uirouter/angular';
import { InAppNotificationsQuery } from 'core-app/features/in-app-notifications/store/in-app-notifications.query';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
+import { BackRouteOptions } from 'core-app/features/work-packages/components/back-routing/back-routing.service';
@Component({
selector: 'op-in-app-notification-entry',
@@ -141,13 +142,13 @@ export class InAppNotificationEntryComponent implements OnInit {
)
.subscribe((wp) => {
void this.state.go(
- `${this.state.current.data.baseRoute}.details.tabs`,
+ `${(this.state.current.data as BackRouteOptions).baseRoute}.details.tabs`,
{ workPackageId: wp.id, tabIdentifier: 'activity' },
);
});
}
- projectClicked(event:MouseEvent):void {
+ projectClicked(event:MouseEvent):void { // eslint-disable-line class-methods-use-this
event.stopPropagation();
}
diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts
index e7e4a608e94..1d94ac55d18 100644
--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts
+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { QueryEntity } from '@datorama/akita';
import { map, switchMap } from 'rxjs/operators';
-import { NEVER, Observable, throwError } from 'rxjs';
+import { Observable, throwError } from 'rxjs';
import {
InAppNotificationsState,
InAppNotificationsStore,
@@ -22,11 +22,11 @@ export class InAppNotificationsQuery extends QueryEntity<InAppNotificationsState
return this.unreadOrKept$;
case 'all':
return this.selectAll();
+ default:
+ return throwError(new Error(`Invalid facet ${facet}`));
}
-
- return throwError(new Error(`Invalid facet ${facet}`));
- })
- )
+ }),
+ );
/** Notifications grouped by resource */
aggregatedNotifications$:Observable<{ [key:string]:InAppNotification[] }> = this
diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts
index 9a4e4f940f5..c50d263e14f 100644
--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts
+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.service.ts
@@ -85,7 +85,7 @@ export class InAppNotificationsService {
});
}
- markAsRead(notifications:InAppNotification[], keep = false) {
+ markAsRead(notifications:InAppNotification[], keep = false):void {
const ids = notifications.map((n) => n.id);
this
@@ -97,7 +97,7 @@ export class InAppNotificationsService {
)
.subscribe(() => {
applyTransaction(() => {
- this.store.update(ids, { readIAN: true, keep: keep });
+ this.store.update(ids, { readIAN: true, keep });
this.store.update(
({ unreadCount }) => ({ unreadCount: unreadCount - ids.length }),
);
diff --git a/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts b/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts
index c8015f1da5e..a94051e48b1 100644
--- a/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts
+++ b/frontend/src/app/features/work-packages/components/back-routing/back-routing.service.ts
@@ -49,7 +49,7 @@ export class BackRoutingService {
constructor(readonly injector:Injector) {
}
- public goToOtherState(route:string, params:{}):Promise<any> {
+ public goToOtherState(route:string, params:Record<string, unknown>):Promise<unknown> {
return this.$state.go(route, params);
}
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
index eb103b27148..969041170cf 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
@@ -29,7 +29,6 @@
import {
ChangeDetectionStrategy,
Component,
- ComponentRef,
OnDestroy,
OnInit,
} from '@angular/core';
diff --git a/frontend/src/app/shared/components/principal/principal-list.component.ts b/frontend/src/app/shared/components/principal/principal-list.component.ts
index 9ff57a52675..f4ad56bec12 100644
--- a/frontend/src/app/shared/components/principal/principal-list.component.ts
+++ b/frontend/src/app/shared/components/principal/principal-list.component.ts
@@ -2,6 +2,7 @@ import {
ChangeDetectionStrategy,
Component,
Input,
+ HostBinding,
} from '@angular/core';
import { PrincipalLike } from 'core-app/shared/components/principal/principal-types';
@@ -10,12 +11,9 @@ import { PrincipalLike } from 'core-app/shared/components/principal/principal-ty
templateUrl: './principal-list.component.html',
styleUrls: [],
changeDetection: ChangeDetectionStrategy.OnPush,
- host: {
- class: 'op-principal-list',
- },
})
export class OpPrincipalListComponent {
- @Input() principals:PrincipalLike[];
+ @HostBinding('class.op-principal-list') className = true;
- constructor() {}
+ @Input() principals:PrincipalLike[];
}