Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of linter warnings #3644

Merged
merged 5 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/app/gateways/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ export class Action<T = void> {
}
}

export const createEmptyAction = () => new Action(async () => []);
export const createEmptyAction = (): Action<any> => new Action(async () => []);
2 changes: 1 addition & 1 deletion client/src/app/gateways/base-icc-gateway.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export abstract class BaseICCGatewayService<ICCResponseType> {
msgSub.unsubscribe();
onClosedSub.unsubscribe();
});
this.connectionClosingFn = () => {
this.connectionClosingFn = (): void => {
onReastartSub.unsubscribe();
msgSub.unsubscribe();
onClosedSub.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class PdfCreator {
});

// the result of the worker
this._pdfWorker.onmessage = ({ data }) => {
this._pdfWorker.onmessage = ({ data }): void => {
// if the worker returns a numbers, is always the progress
if (typeof data === `number`) {
// update progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import * as pdfMake from 'pdfmake/build/pdfmake';

const osTableLayout = {
switchColorTableLayout: {
hLineWidth: (rowIndex: any) => rowIndex === 1,
vLineWidth: () => 0,
fillColor: (rowIndex: any) => (rowIndex % 2 === 0 ? `#EEEEEE` : null)
hLineWidth: (rowIndex: any): boolean => rowIndex === 1,
vLineWidth: (): number => 0,
fillColor: (rowIndex: any): string => (rowIndex % 2 === 0 ? `#EEEEEE` : null)
},
metaboxLayout: {
fillColor: () => `#dddddd`,
hLineWidth: (i: any, node: any) => (i === 0 || i === node.table.body.length ? 0 : 0.5),
vLineWidth: () => 0,
hLineColor: () => `white`
fillColor: (): string => `#dddddd`,
hLineWidth: (i: any, node: any): 0 | 0.5 => (i === 0 || i === node.table.body.length ? 0 : 0.5),
vLineWidth: (): number => 0,
hLineColor: (): string => `white`
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface HistoryPresenterResponse {

const HISTORY_ENDPOINT = `/system/autoupdate/history_information`;

const getUniqueItems = (positions: Position[]) => {
const getUniqueItems = (positions: Position[]): Position[] => {
const positionMap: { [positionNumber: number]: Position } = {};
for (const position of positions) {
positionMap[position.position] = position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AgendaItemRepositoryService extends BaseMeetingRelatedRepository<Vi
this.setSortFunction((a, b) => a.tree_weight - b.tree_weight); // leave the sorting as it is
}

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Items` : `Item`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Items` : `Item`);

private getAgendaTitle(viewAgendaItem: ViewAgendaItem): AgendaListTitle {
if (viewAgendaItem.content_object) {
Expand All @@ -36,9 +36,9 @@ export class AgendaItemRepositoryService extends BaseMeetingRelatedRepository<Vi
return { title: `-` }; // Default: Clarify which is the default
}

public getTitle = (viewAgendaItem: ViewAgendaItem) => this.getAgendaTitle(viewAgendaItem).title;
public getTitle = (viewAgendaItem: ViewAgendaItem): string => this.getAgendaTitle(viewAgendaItem).title;

public getSubtitle = (viewAgendaItem: ViewAgendaItem) => this.getAgendaTitle(viewAgendaItem).subtitle;
public getSubtitle = (viewAgendaItem: ViewAgendaItem): string => this.getAgendaTitle(viewAgendaItem).subtitle;

public getItemNumberPrefix(viewModel: HasAgendaItem): string {
return viewModel.agenda_item && viewModel.agenda_item.item_number
Expand Down Expand Up @@ -128,7 +128,7 @@ export class AgendaItemRepositoryService extends BaseMeetingRelatedRepository<Vi
*/
protected override createViewModel(model: AgendaItem): ViewAgendaItem {
const viewModel = super.createViewModel(model);
viewModel.getSubtitle = () => this.getSubtitle(viewModel) as string;
viewModel.getSubtitle = (): string => this.getSubtitle(viewModel) as string;
return viewModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ export class AssignmentCandidateRepositoryService extends BaseMeetingRelatedRepo
super(repositoryServiceCollector, AssignmentCandidate);
}

public getTitle = (viewAssignmentCandidate: ViewAssignmentCandidate) =>
public getTitle = (viewAssignmentCandidate: ViewAssignmentCandidate): string =>
viewAssignmentCandidate.user?.getTitle() ?? UnknownUserLabel;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Candidates` : `Candidate`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Candidates` : `Candidate`);

public async create(assignment: Identifiable, meetingUserId: Id): Promise<Identifiable> {
const payload = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export class AssignmentRepositoryService extends BaseAgendaItemAndListOfSpeakers
return this.sendBulkActionToBackend(AssignmentAction.DELETE, payload);
}

public getTitle = (viewAssignment: ViewAssignment) => viewAssignment.title;
public getTitle = (viewAssignment: ViewAssignment): string => viewAssignment.title;

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Elections` : `Election`);
public getVerboseName = (plural = false): string => this.translate.instant(plural ? `Elections` : `Election`);

private getPartialPayload(model: Partial<ViewAssignment>): any {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ export abstract class BaseAgendaItemAndListOfSpeakersContentObjectRepository<
return numberPrefix + this.getTitle(viewModel);
}

public getListOfSpeakersTitle = (viewModel: V) => this.getAgendaListTitle(viewModel).title;
public getListOfSpeakersTitle = (viewModel: V): string => this.getAgendaListTitle(viewModel).title;

public getListOfSpeakersSlideTitle = (viewModel: V) => this.getAgendaSlideTitle(viewModel);
public getListOfSpeakersSlideTitle = (viewModel: V): string => this.getAgendaSlideTitle(viewModel);

protected override createViewModel(model: M): V {
const viewModel = super.createViewModel(model);
viewModel.getAgendaListTitle = () => this.getAgendaListTitle(viewModel);
viewModel.getAgendaSlideTitle = () => this.getAgendaSlideTitle(viewModel);
viewModel.getListOfSpeakersTitle = () => this.getListOfSpeakersTitle(viewModel);
viewModel.getListOfSpeakersSlideTitle = () => this.getListOfSpeakersSlideTitle(viewModel);
viewModel.getAgendaListTitle = (): AgendaListTitle => this.getAgendaListTitle(viewModel);
viewModel.getAgendaSlideTitle = (): string => this.getAgendaSlideTitle(viewModel);
viewModel.getListOfSpeakersTitle = (): string => this.getListOfSpeakersTitle(viewModel);
viewModel.getListOfSpeakersSlideTitle = (): string => this.getListOfSpeakersSlideTitle(viewModel);
return viewModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export abstract class BaseAgendaItemContentObjectRepository<
*/
protected override createViewModel(model: M): V {
const viewModel = super.createViewModel(model);
viewModel.getAgendaListTitle = () => this.getAgendaListTitle(viewModel);
viewModel.getAgendaSlideTitle = () => this.getAgendaSlideTitle(viewModel);
viewModel.getAgendaListTitle = (): AgendaListTitle => this.getAgendaListTitle(viewModel);
viewModel.getAgendaSlideTitle = (): string => this.getAgendaSlideTitle(viewModel);
return viewModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export abstract class BaseListOfSpeakersContentObjectRepository<
*/
protected override createViewModel(model: M): V {
const viewModel = super.createViewModel(model);
viewModel.getListOfSpeakersTitle = () => this.getListOfSpeakersTitle(viewModel);
viewModel.getListOfSpeakersSlideTitle = () => this.getListOfSpeakersSlideTitle(viewModel);
viewModel.getListOfSpeakersTitle = (): string => this.getListOfSpeakersTitle(viewModel);
viewModel.getListOfSpeakersSlideTitle = (): string => this.getListOfSpeakersSlideTitle(viewModel);
return viewModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export abstract class BaseMeetingRelatedRepository<V extends BaseViewModel, M ex

protected override createViewModel(model: M): V {
const viewModel = super.createViewModel(model);
viewModel.getActiveMeetingId = () => this.repositoryMeetingServiceCollector.activeMeetingIdService.meetingId;
viewModel.getActiveMeetingId = (): number =>
this.repositoryMeetingServiceCollector.activeMeetingIdService.meetingId;
return viewModel;
}
}
8 changes: 4 additions & 4 deletions client/src/app/gateways/repositories/base-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
protected createViewModel(model?: M): V {
const viewModel = this.createViewModelProxy(model);

viewModel.getTitle = () => this.getTitle(viewModel);
viewModel.getListTitle = () => this.getListTitle(viewModel);
viewModel.getTitle = (): string => this.getTitle(viewModel);
viewModel.getListTitle = (): string => this.getListTitle(viewModel);
viewModel.getVerboseName = this.getVerboseName;

this.onCreateViewModel(viewModel);
Expand Down Expand Up @@ -588,7 +588,7 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
*/
private resortAndUpdateForeignBaseKeys(key: string): void {
const resortAction = {
funct: async () => {
funct: async (): Promise<void> => {
const sortListService = this.sortListServices[key];
this.updateForeignBaseKeys(key);
await sortListService.hasLoaded;
Expand All @@ -612,7 +612,7 @@ export abstract class BaseRepository<V extends BaseViewModel, M extends BaseMode
if (this.foreignSortBaseKeys[key][collection].some(key => keys.includes(key))) {
this.sortedViewModelLists[key] = await sortListService.sort(this.sortedViewModelLists[key]);
const resortAction = {
funct: async () => {
funct: async (): Promise<void> => {
this.sortedViewModelLists[key] = await sortListService.sort(this.sortedViewModelLists[key]);
},
type: PipelineActionType.Resort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export class SpeakingTimesComponent implements OnDestroy {
}
}

private updateSpeakingTime(speakingTime: ViewStructureLevelListOfSpeakers) {
private updateSpeakingTime(speakingTime: ViewStructureLevelListOfSpeakers): void {
if (speakingTime) {
if (speakingTime.isInactive) {
this.structureLevels.delete(speakingTime.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class SpeakerUserSelectDialogComponent {
public userRepo: UserRepositoryService
) {}

public setCurrentUser(selection: UserSelectionData) {
public setCurrentUser(selection: UserSelectionData): void {
if (selection.userId) {
const meeting_user = this.userRepo
.getViewModel(selection.userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export class ProjectableListComponent<V extends BaseViewModel | BaseProjectableV
public getSpeakerButtonObject: ((viewModel: V) => BaseViewModel & HasListOfSpeakers) | null = null;

@Input()
public override toRestrictFn = (restriction: ColumnRestriction<Permission>) =>
public override toRestrictFn = (restriction: ColumnRestriction<Permission>): boolean =>
!this.operator.hasPerms(restriction.permission);

@Input()
public override toHideFn = () => {
const columnsToHide = [];
public override toHideFn = (): string[] => {
let columnsToHide: string[];

// hide the projector columns
if (this.multiSelect || this.isMobile || !this.allowProjector) {
Expand Down Expand Up @@ -90,7 +90,7 @@ export class ProjectableListComponent<V extends BaseViewModel | BaseProjectableV

public readonly permission = Permission;

public readonly isProjectedFn = (model: BaseProjectableViewModel) =>
public readonly isProjectedFn = (model: BaseProjectableViewModel): boolean =>
this.service.isProjectedOnReferenceProjector(model);

public constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class ParticipantSearchSelectorComponent extends BaseUiComponent implemen
/**
* This function ensures that a selected user is quickly removed from the selection list
*/
private removeUserFromSelectorList(userId: number) {
private removeUserFromSelectorList(userId: number): void {
this._filteredUsersSubject.next(
this._filteredUsersSubject.value.filter(user => {
return user.id !== userId;
Expand All @@ -143,7 +143,7 @@ export class ParticipantSearchSelectorComponent extends BaseUiComponent implemen
* Sets the current value of the filteredUsersSubject to an Array that holds exactly every single user,
* who should be available for selection (i.e. who is not included in nonSelectableUsersSubject.value)
*/
private filterUsers() {
private filterUsers(): void {
const notAvailable = this._nonSelectableUserIds;
const availableUsers = this._users.filter(user => !notAvailable.includes(user.id));
this._filteredUsersSubject.next(availableUsers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export abstract class BasePollVoteComponent<C extends PollContentObject = any> e
return this.votingService.getVotingProhibitionReasonVerbose(this.poll, user) || ``;
}

public getVotingErrorFromName(errorName: string) {
public getVotingErrorFromName(errorName: string): string {
return this.votingService.getVotingProhibitionReasonVerboseFromName(errorName) || ``;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class CheckInputComponent extends BaseUiComponent implements OnInit, Cont
/**
* Helper function to determine which information to give to the parent form
*/
private propagateChange = (_: any) => {};
private propagateChange = (_: any): void => {};

/**
* Initially build the form-control.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SingleOptionChartTableComponent {
this.cd.markForCheck();
}

public get pollService() {
public get pollService(): PollService {
return this._pollService || this.defaultPollService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class VotingService {
}
}

public getVotingProhibitionReasonVerboseFromName(reasonName: string) {
public getVotingProhibitionReasonVerboseFromName(reasonName: string): string {
return VotingProhibitionVerbose[VotingProhibition[reasonName]] ?? _(`There is an unknown voting problem.`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class PollSlideComponent extends BaseSlideComponent<PollSlideData> {
}

private createPollData(data: PollSlideData): PollData {
const getContentObjectTitle = () => {
const getContentObjectTitle = (): string => {
if (data.title_information) {
modifyAgendaItemNumber(data.title_information);
const repo = this.collectionMapperService.getRepository(data.title_information.collection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class TopicPollDetailContentComponent extends BaseUiComponent {
return this._tableData;
}

public get colors() {
public get colors(): {
backgroundColor: string[];
} {
return this.chartColors[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class TopicPollDialogComponent extends BasePollDialogComponent implements
this.optionTypeText = true;
}

public ngAfterViewInit() {
public ngAfterViewInit(): void {
if (this.scrollFrame) {
this.scrollContainer = this.scrollFrame.nativeElement;
this.itemElements.changes.subscribe(_ => this.onItemElementsChanged());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class TopicPollVoteComponent extends BasePollVoteComponent<ViewTopic> imp
this.handleVotingMethodYOrN(maxVotesAmount, tmpVoteRequest, user);
}

public handleVotingMethodYOrN(maxVotesAmount: number, tmpVoteRequest: any, user: ViewUser = this.user) {
public handleVotingMethodYOrN(maxVotesAmount: number, tmpVoteRequest: any, user: ViewUser = this.user): void {
// check if you can still vote
const countedVotes = Object.keys(tmpVoteRequest).filter(key => tmpVoteRequest[key]).length;
if (countedVotes <= maxVotesAmount) {
Expand Down Expand Up @@ -347,7 +347,7 @@ export class TopicPollVoteComponent extends BasePollVoteComponent<ViewTopic> imp
}
}

protected override updatePoll() {
protected override updatePoll(): void {
super.updatePoll();
this.defineVoteOptions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class TopicDetailComponent extends BaseMeetingComponent implements OnInit

private _topicId: Id | null = null;

public getTitleFn = () => this.topic.getListTitle();
public getTitleFn = (): string => this.topic.getListTitle();

public get showNavigateButtons(): boolean {
return this.enableNavigation && (!!this.previousTopic || !!this.nextTopic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,20 @@ export class AgendaItemMultiselectService {
}
}

private async addTags(agendaItems: ViewAgendaItem[], selectedChoice: ChoiceAnswer<ViewTag>) {
private async addTags(
agendaItems: ViewAgendaItem[],
selectedChoice: ChoiceAnswer<ViewTag>
): Promise<Promise<void>[]> {
return agendaItems.map(agendaItem => {
const tagIds = new Set((agendaItem.tag_ids || []).concat(selectedChoice.ids));
return this.repo.update({ tag_ids: Array.from(tagIds) }, agendaItem);
});
}

private async removeTags(agendaItems: ViewAgendaItem[], selectedChoice: ChoiceAnswer<ViewTag>) {
private async removeTags(
agendaItems: ViewAgendaItem[],
selectedChoice: ChoiceAnswer<ViewTag>
): Promise<Promise<void>[]> {
return agendaItems.map(agendaItem => {
const remainingTagIds = new Set(
agendaItem.tag_ids.filter(tagId => selectedChoice.ids.indexOf(tagId) === -1)
Expand All @@ -81,7 +87,7 @@ export class AgendaItemMultiselectService {
});
}

private async clearTags(agendaItems: ViewAgendaItem[]) {
private async clearTags(agendaItems: ViewAgendaItem[]): Promise<Promise<void>[]> {
return agendaItems.map(agendaItem => this.repo.update({ tag_ids: [] }, agendaItem));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export class ViewAgendaItem extends BaseProjectableViewModel<AgendaItem> {
return type ? type.name : ``;
}

public override getProjectorTitle = (_projection: Projection) => {
public override getProjectorTitle = (
_projection: Projection
): {
title: string;
subtitle: string;
} => {
const subtitle = this.item.comment || undefined;
return { title: this.getTitle(), subtitle };
};
Expand Down
Loading
Loading