Skip to content

Commit

Permalink
Cleanup of linter warnings (#3594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elblinator authored Apr 23, 2024
1 parent c563606 commit c296edc
Show file tree
Hide file tree
Showing 26 changed files with 73 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export abstract class BasePollFormComponent extends BaseComponent implements OnI
);
}

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

private _data: Partial<ViewPoll>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class AssignmentPollVoteComponent extends BasePollVoteComponent<ViewAssig
}
}

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 @@ -349,7 +349,7 @@ export class AssignmentDetailComponent extends BaseMeetingComponent implements O
this.updateCandidatesArray();
}

private updateCandidatesArray() {
private updateCandidatesArray(): void {
this.candidateUserIds = this._assignment.candidatesAsUsers.map(user => user.id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ChatGroupDialogComponent implements OnInit {

public readonly groupsObservable = this.groupsRepo.getViewModelListObservable();

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

public constructor(
private groupsRepo: GroupControllerService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class BroadcastService {

public constructor() {
this.broadcastChannel = new BroadcastChannel(BroadcastChannelName);
this.broadcastChannel.onmessage = message => this.onMessage.next(message.data);
this.broadcastChannel.onmessage = (message): any => this.onMessage.next(message.data);
}

public send(message: BroadcastMessage): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { MediafileCommonService } from '../../../../services/mediafile-common.se
export class MediafileUploadComponent extends OrganizationMediafileUploadComponent implements OnInit {
public availableGroups: Observable<ViewGroup[]> | null = null;

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

public constructor(
route: ActivatedRoute,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class AllocationListComponent implements ControlValueAccessor, OnInit {
/**
* Helper function to determine which information to give to the parent form
*/
private propagateChange = (_: any) => {};
private propagateChange = (_: any): void => {};

/**
* The value from the FormControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class MeetingSettingsGroupDetailFieldComponent extends BaseComponent impl
/** used by the groups config type */
public groupObservable: Observable<ViewGroup[]> | null = null;

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

public get watchProperties(): (keyof Settings)[] {
return this.setting.automaticChangesSetting?.watchProperties;
Expand All @@ -147,7 +147,7 @@ export class MeetingSettingsGroupDetailFieldComponent extends BaseComponent impl
public get getChangeFn(): (currentValue: any, currentWatchPropertyValues: any[]) => any {
return (
this.setting.automaticChangesSetting?.getChangeFn ??
((currentValue, _currentWatchPropertyValues) => currentValue)
((currentValue, _currentWatchPropertyValues): any => currentValue)
);
}

Expand Down Expand Up @@ -445,7 +445,7 @@ export class MeetingSettingsGroupDetailFieldComponent extends BaseComponent impl
*/
public getTinyMceSettings(): object {
return {
setup: (editor: any) => {
setup: (editor: any): void => {
editor.on(`Blur`, (ev: any) => {
if (ev.target.getContent() !== this.internalValue) {
this.sendUpdate(ev.target.getContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ export class MotionDiffService {

const type =
` data-change-type="` +
((type: ViewUnifiedChangeType) => {
((type: ViewUnifiedChangeType): 'amendment' | 'recommendation' | 'unknown' => {
switch (type) {
case ViewUnifiedChangeType.TYPE_AMENDMENT:
return `amendment`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class MotionPollDialogComponent extends BasePollDialogComponent implement
super(pollData);
}

public ngAfterViewInit() {
public ngAfterViewInit(): void {
this.dialogVoteForm.get(`options.${this.pollData.content_object?.fqid}`)?.valueChanges.subscribe(data => {
let newMajority = data[this.majority] === -1 ? this.majority : ``;
for (const option of Object.keys(data)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class CommentSectionListComponent extends BaseComponent implements OnInit

public groups: Observable<ViewGroup[]>;

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

public constructor(
protected override translate: TranslateService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class WorkflowExportService {
`allow_motion_forwarding`
];
const json = [];
const getNextWorkflowJson = (workflow: ViewMotionWorkflow) => {
const getNextWorkflowJson = (workflow: ViewMotionWorkflow): any => {
const nextWorkflow = workflowKeysToCopy.mapToObject<any>(key => ({ [key]: workflow[key] }));
nextWorkflow[`states`] = [];
for (const state of workflow.states) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ export class MotionControllerService extends BaseMeetingControllerService<ViewMo
}

private onCreateViewModel(viewModel: ViewMotion): void {
viewModel.getParagraphTitleByParagraph = (paragraph: DiffLinesInParagraph) =>
viewModel.getParagraphTitleByParagraph = (paragraph: DiffLinesInParagraph): string =>
this.motionLineNumbering.getAmendmentParagraphLinesTitle(paragraph);
if (viewModel.lead_motion && viewModel.isParagraphBasedAmendment()) {
viewModel.getAmendmentParagraphLines = (recoMode: ChangeRecoMode, includeUnchanged = false) => {
viewModel.getAmendmentParagraphLines = (
recoMode: ChangeRecoMode,
includeUnchanged = false
): DiffLinesInParagraph[] => {
const changeRecos = viewModel.change_recommendations.filter(changeReco => changeReco.showInFinalView());
return this.motionLineNumbering.getAmendmentParagraphLines(
viewModel,
Expand All @@ -249,9 +252,9 @@ export class MotionControllerService extends BaseMeetingControllerService<ViewMo
);
};
} else {
viewModel.getAmendmentParagraphLines = () => [];
viewModel.getAmendmentParagraphLines = (): DiffLinesInParagraph[] => [];
}
viewModel.getExtendedStateLabel = () => this.getExtendedStateLabel(viewModel);
viewModel.getExtendedRecommendationLabel = () => this.getExtendedRecommendationLabel(viewModel);
viewModel.getExtendedStateLabel = (): string => this.getExtendedStateLabel(viewModel);
viewModel.getExtendedRecommendationLabel = (): string => this.getExtendedRecommendationLabel(viewModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class MotionCsvExportService {
: this.commentRepo.getViewModel(commentId)!.getTitle();
return {
label,
map: (motion: ViewMotion) => {
map: (motion: ViewMotion): string => {
if (commentId === PERSONAL_NOTE_ID) {
return motion && motion.getPersonalNote()! && motion.getPersonalNote()!.note;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class MotionHtmlToPdfService extends HtmlToPdfService {
return newParagraph;
}

protected override addChildNodeIntoParagraphs(paragraph: any[], data: ChildNodeParagraphPayload) {
protected override addChildNodeIntoParagraphs(paragraph: any[], data: ChildNodeParagraphPayload): void {
const { child, parent, styles } = data;
const parsedElement = this.parseElement(child, styles);
const firstChild = parent.firstChild as Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ParticipantDetailViewComponent extends BaseMeetingComponent {
is_present: [``]
};

public sortFn = (groupA: ViewGroup, groupB: ViewGroup) => groupA.weight - groupB.weight;
public sortFn = (groupA: ViewGroup, groupB: ViewGroup): number => groupA.weight - groupB.weight;

public get randomPasswordFn(): () => string {
return () => this.getRandomPassword();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class ParticipantControllerService extends BaseMeetingControllerService<V

public update(patch: ExtendedUserPatchFn, ...users: ViewUser[]): Action<void> {
if (typeof patch === `function`) {
const updatePatch = (user: ViewUser) => {
const updatePatch = (user: ViewUser): any => {
const participantPayload = patch(user);
return this.validatePayload(participantPayload);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
type: `daterange`,
automaticChangesSetting: {
watchProperties: [`end_time`],
getChangeFn: (currentValue: number, currentWatchPropertyValues: number[]) => {
getChangeFn: (currentValue: number, currentWatchPropertyValues: number[]): number => {
return currentValue &&
currentWatchPropertyValues.length &&
currentValue > currentWatchPropertyValues[0]
Expand Down Expand Up @@ -736,7 +736,7 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
label: _(`Default voting type`),
type: `choice`,
choices: PollTypeVerbose,
restrictionFn: (orgaSettings, value: any) => {
restrictionFn: (orgaSettings, value: any): any => {
const isElectronicVotingEnabled = orgaSettings.instant(`enable_electronic_voting`);
if (!isElectronicVotingEnabled && typeof value !== `string`) {
return { analog: `analog` };
Expand Down Expand Up @@ -801,7 +801,7 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
label: _(`Default voting type`),
type: `choice`,
choices: PollTypeVerbose,
restrictionFn: (orgaSettings, value: any) => {
restrictionFn: (orgaSettings, value: any): any => {
const isElectronicVotingEnabled = orgaSettings.instant(`enable_electronic_voting`);
if (!isElectronicVotingEnabled && typeof value !== `string`) {
return { analog: `analog` };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ export class SequentialNumberMappingService {
}

private getSequentialNumberRequest(collection: string): SimplifiedModelRequest {
const createRoutingFollow = (idField: keyof ViewMeeting) => {
const createRoutingFollow = (
idField: keyof ViewMeeting
): {
idField: keyof ViewMeeting;
fieldset: any[];
additionalFields: string[];
} => {
return { idField, fieldset: [], additionalFields: SEQUENTIAL_NUMBER_REQUIRED_FIELDS };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ export class AccountControllerService extends BaseController<ViewUser, User> {
}

public bulkAddUserToMeeting(users: ViewUser[], ...meetings: ViewMeeting[]): Action<void> {
const patchFn = (user: ViewUser) => {
const patchFn = (
user: ViewUser
): {
id: number;
meeting_id: number;
group_ids: number[];
}[] => {
return meetings.map(meeting => {
const groupIds: number[] = user.group_ids(meeting.id);
return {
Expand All @@ -50,7 +56,13 @@ export class AccountControllerService extends BaseController<ViewUser, User> {
users: ViewUser[],
...meetings: Identifiable[]
): Promise<Action<void> | void> {
const patchFn = (user: ViewUser) => {
const patchFn = (
user: ViewUser
): {
id: number;
meeting_id: number;
group_ids: any[];
}[] => {
return meetings.map(meeting => ({ id: user.id, meeting_id: meeting.id, group_ids: [] }));
};
const title = _(`This action will remove you from one or more meetings.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class MeetingEditComponent extends BaseComponent implements OnInit {
public meetingForm!: UntypedFormGroup;
public theDuplicateFromId: Id | null = null;

public sortFn: (valueA: Selectable, valueB: Selectable) => number = (a, b) => {
public sortFn: (valueA: Selectable, valueB: Selectable) => number = (a, b): number => {
return a && typeof a.getTitle() === `string` ? a.getTitle().localeCompare(b.getTitle()) : -1;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class ThemeBuilderDialogComponent extends BaseUiComponent implements Afte
return GENERAL_DEFAULT_COLORS[key];
}

private generateHeadbarColorFromPrimaryHex(hex: string) {
private generateHeadbarColorFromPrimaryHex(hex: string): string {
return this.colorService.generateColorPaletteByHex(hex).find(def => def.name === `900`).hex;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,20 @@ export class GlobalSearchService {
results[addToFqid].matched_by_fqids.push(fqid);
}

private getResult(fqid: Fqid, results: GlobalSearchResponse) {
private getResult(
fqid: Fqid,
results: GlobalSearchResponse
): {
title: string;
text: string;
obj: any;
fqid: string;
collection: string;
url: string;
meeting: any;
committee: any;
score: number;
} {
const content = results[fqid].content;
const collection = collectionFromFqid(fqid);
const id = content.sequential_number || idFromFqid(fqid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export abstract class BaseSearchSelectorComponent extends BaseFormFieldControlCo
return 112 + this.panelHeight + `px`;
}

private _defaultSortFn = (a: Selectable, b: Selectable) =>
private _defaultSortFn = (a: Selectable, b: Selectable): number =>
a && typeof a.getTitle() === `string` ? a.getTitle().localeCompare(b.getTitle()) : 0;

private _sortFn: false | ((valueA: Selectable, valueB: Selectable) => number) = this._defaultSortFn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class ImageComponent {
}

private addListenersToReader(fileReader: FileReader): void {
fileReader.onprogress = event => this.handleReaderEvent(event, fileReader);
fileReader.onload = event => this.handleReaderEvent(event, fileReader);
fileReader.onprogress = (event): void => this.handleReaderEvent(event, fileReader);
fileReader.onload = (event): void => this.handleReaderEvent(event, fileReader);
}

private startLoading(): void {
Expand Down
8 changes: 4 additions & 4 deletions client/src/app/worker/autoupdate/autoupdate-stream-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class AutoupdateStreamPool extends HttpStreamPool<AutoupdateStream> {
this._handleResolvePromise = new Promise(async res => {
let cb: CallableFunction;
if (stream.failedConnects >= HTTP_POOL_CONFIG.RETRY_AMOUNT) {
cb = (s: AutoupdateStream) => {
cb = (s: AutoupdateStream): void => {
for (const subscription of s.subscriptions) {
subscription.sendError({
reason: `Repeated failure or client error`,
Expand All @@ -222,16 +222,16 @@ export class AutoupdateStreamPool extends HttpStreamPool<AutoupdateStream> {
}
};
} else if (await this.waitUntilEndpointHealthy()) {
cb = async (s: AutoupdateStream) => {
cb = async (s: AutoupdateStream): Promise<void> => {
await this.connectStream(s);
};
} else if (await WorkerHttpAuth.update()) {
cb = async (s: AutoupdateStream) => {
cb = async (s: AutoupdateStream): Promise<void> => {
s.failedCounter++;
await this.connectStream(s);
};
} else {
cb = (s: AutoupdateStream) => {
cb = (s: AutoupdateStream): void => {
for (const subscription of s.subscriptions) {
subscription.sendError({
reason: `Logout`,
Expand Down

0 comments on commit c296edc

Please sign in to comment.