Skip to content

Commit

Permalink
Add lines between class members eslint rule (#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored Oct 5, 2023
1 parent d2a51bf commit 550422c
Show file tree
Hide file tree
Showing 38 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = {
'property': 'asObservable',
'message': 'Please use a typecast or explicitly instantiate a new Observable.'
}],
'lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }],

'jsdoc/require-example': ['off'],
'jsdoc/newline-after-description': ['off'],
Expand Down
1 change: 1 addition & 0 deletions client/src/app/domain/models/projector/projection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class Projection extends BaseModel<Projection> {
public options!: {
[key: string]: any;
};

public weight!: number;

// Calculated field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ class MockWaitForActionDialogService {
delete currentDialogs[workerId];
this.currentDialogs.next(currentDialogs);
}

public async openClosingPrompt(snapshot: Partial<ActionWorker> & { closed: number }): Promise<void> {
this.closingPromptOpenFor.push(snapshot);
}

public addNewDialog(reason: WaitForActionReason, data: WaitForActionData): void {
const currentDialogs = copy(this.currentDialogs.value);
currentDialogs[data.workerId] = { reason, data };
Expand Down Expand Up @@ -154,6 +156,7 @@ class MockActionWorkerRepositoryService {
public set viewModelList(list: ViewActionWorker[]) {
this._viewModelListSubject.next(list);
}

public get viewModelList(): ViewActionWorker[] {
return this._viewModelListSubject.value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MockHttpService {
header?: HttpHeaders;
responseType?: ResponseType;
}[] = [];

public async get<T>(
path: string,
data?: any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export abstract class BaseAgendaItemAndListOfSpeakersContentObjectRepository<
) {
super(repositoryServiceCollector, baseModelCtor);
}

public getAgendaListTitle(viewModel: V): AgendaListTitle {
// Return the agenda title with the model's verbose name appended
const numberPrefix = this.agendaItemRepo.getItemNumberPrefix(viewModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class PointOfOrderCategoryRepositoryService

public getVerboseName = (plural?: boolean): string =>
plural ? `Point of order categories` : `Point of order category`;

public getTitle = (viewModel: PointOfOrderCategory): string => viewModel.text;

public create(pointOfOrderCategory: any, meeting_id: Id = this.activeMeetingId): Action<Identifiable> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class ProjectorMessageRepositoryService extends BaseMeetingRelatedReposit
public constructor(repositoryServiceCollector: RepositoryMeetingServiceCollectorService) {
super(repositoryServiceCollector, ProjectorMessage);
}

public getTitle = () => this.getVerboseName();

public getVerboseName = (plural = false) => this.translate.instant(plural ? `Messages` : `Message`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ export class ThemeRepositoryService extends BaseRepository<ViewTheme, Theme> {
const payload = themes;
return this.sendBulkActionToBackend(ThemeAction.CREATE, payload);
}

public update(update: any, id: Id): Promise<void> {
const payload = {
id,
...update
};
return this.sendActionToBackend(ThemeAction.UPDATE, payload);
}

public delete(...ids: Id[]): Promise<void> {
const payload = ids.map(id => ({ id }));
return this.sendBulkActionToBackend(ThemeAction.DELETE, payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export abstract class BaseImportService<MainModel extends Identifiable> implemen
private _afterImportHandler: {
[key: string]: { mainHandler: AfterImportHandler; additionalHandlers: AdditionalImportHandler[] };
} = {};

private _otherMainImportHelper: MainImportHandler[] = [];

private _modelHeadersAndVerboseNames: { [key: string]: string } = {};
Expand Down
5 changes: 5 additions & 0 deletions client/src/app/site/base/base-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ export abstract class BaseViewModel<M extends BaseModel = any> implements Detail
public getModel(): M {
return this._model;
}

public toString(): string {
return this.getTitle();
}

public toJSON(): M {
return this.getModel();
}

public getUpdatedModelData(update: Partial<M>): object {
return this.getModel().getUpdatedData(update);
}

public canAccess(): boolean {
return true;
}

/**
* Override in children
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class GlobalSearchComponent implements OnDestroy {
user: _(`Participants`),
mediafile: _(`Files`)
};

public currentlyAvailableFilters = [];

public currentFilters = this.formBuilder.group({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export abstract class BaseHasMeetingUserViewModel<M extends BaseModel<any> = any
public get user(): ViewUser {
return this.meeting_user?.user;
}

public get user_id(): number {
return this.meeting_user?.user_id;
}
Expand All @@ -25,6 +26,7 @@ export abstract class BaseHasMeetingUsersViewModel<M extends BaseModel<any> = an
public get calculated_users(): ViewUser[] {
return this.meeting_users?.flatMap(user => user.user ?? []);
}

public get calculated_user_ids(): number[] {
return this.meeting_users?.flatMap(user => user.user_id ?? []);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class AttachmentControlComponent extends BaseFormControlComponent<ViewMed
public get empty(): boolean {
return !this.contentForm.value.length;
}

public get controlType(): string {
return `attachment-control`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class SlideContainerComponent {

@ViewChild(`slide`, { read: ViewContainerRef, static: true })
private slide: ViewContainerRef | null = null;

private slideRef!: ComponentRef<BaseSlideComponent<object>>;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export class ChangeRecommendationUnifiedChange implements ChangeRecommendationDa
public constructor(data: ChangeRecommendationData) {
Object.assign(this, data);
}

public getTitle(): string {
return `Recommendation`;
}

public getModificationType(): ModificationType {
throw new Error(`Method not implemented.`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export class CallRestrictionService {
public isJitsiActiveInAnotherTab: Observable<boolean> = this.storageMap
.watch(RTC_LOGGED_STORAGE_KEY, { type: `boolean` })
.pipe(distinctUntilChanged() as any);

private userClosPosition = this.closService.currentListOfSpeakersObservable.pipe(
map(los => los?.findUserIndexOnList(this.operator.operatorId!) ?? -1),
distinctUntilChanged()
);

private amountNextSpeakerAutoConnect: Observable<number> = this.settingService.get(
`conference_auto_connect_next_speakers`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ export class InteractionReceiveService {
}
return this._showLiveConfObservable;
}

private _showLiveConfObservable: Observable<boolean>;

public get conferenceState(): ConferenceState {
return this.conferenceStateSubject.value;
}

public set conferenceState(state: ConferenceState) {
this.setConferenceState(state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class InteractionService {
private get conferenceState(): ConferenceState {
return this.interactionReceive.conferenceState;
}

private set conferenceState(state: ConferenceState) {
this.interactionReceive.conferenceState = state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ export class CategoryDetailComponent extends BaseMeetingComponent {
public get selectedCategory(): ViewMotionCategory {
return this._selectedCategory;
}

public set selectedCategory(category: ViewMotionCategory) {
this._selectedCategory = category;
}

private _selectedCategory!: ViewMotionCategory;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export class MotionDetailDiffSummaryComponent extends BaseMeetingComponent imple

@Input()
public changes: ViewUnifiedChange[] = [];

@Input()
public scrollToChange: ViewUnifiedChange | null = null;

@Input()
public elContainer: any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,30 @@ export class MotionDetailDiffComponent extends BaseMeetingComponent implements A

@Input()
public motion!: ViewMotion;

@Input()
public changes: ViewUnifiedChange[] = [];

@Input()
public scrollToChange: ViewUnifiedChange | null = null;

@Input()
public highlightedLine!: number;

@Input()
public lineNumberingMode!: LineNumberingMode;

@Input()
public showAllAmendments = false;

@Input()
public showSummary = true;

@Input()
public set showPreamble(value: boolean) {
this._showPreamble = value;
}

@Input()
public lineRange: LineRange | null = null;

Expand All @@ -95,6 +103,7 @@ export class MotionDetailDiffComponent extends BaseMeetingComponent implements A
public get showPreamble(): boolean {
return this.motion.showPreamble ? this._showPreamble : false;
}

private _showPreamble = true;

public get nativeElement(): any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class MotionDetailOriginalChangeRecommendationsComponent implements OnIni
this._changeRecommendations = recos;
this.setTextChangeRecommendations(recos);
}

public get changeRecommendations(): ViewUnifiedChange[] {
return this._changeRecommendations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class MotionCsvExportService {

this.csvExport.export(motions, exportProperties, this.translate.instant(`Motions`) + `.csv`);
}

/**numberOrTitle
* Exports the call list.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class ViewMotion extends BaseProjectableViewModel<Motion> {
recoMode: ChangeRecoMode,
includeUnchanged?: boolean
) => DiffLinesInParagraph[] = () => [];

public getParagraphTitleByParagraph!: (paragraph: DiffLinesInParagraph) => string | null;
// This is set by the repository
public getNumberOrTitle!: () => string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export class ViewPollCandidateList extends BaseViewModel<PollCandidateList> impl
public get entries(): SortedListEntry[] {
return this.poll_candidates;
}

public get poll_candidate_list(): PollCandidateList {
return this._model;
}

public static COLLECTION = PollCandidateList.COLLECTION;

public getShortenedTitle(length: number): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class ViewPollCandidate extends BaseViewModel<PollCandidate> implements S
public get poll_candidate(): PollCandidate {
return this._model;
}

public static COLLECTION = PollCandidate.COLLECTION;

public getSubtitle(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ViewPoll<C extends PollContentObject = any>
public get poll(): Poll {
return this._model;
}

public static COLLECTION = Poll.COLLECTION;

public set hasVoted(value: boolean | undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export class MeetingComponentServiceCollectorService {
public get titleService(): Title {
return this.componentServiceCollector.titleService;
}

public get matSnackBar(): MatSnackBar {
return this.componentServiceCollector.matSnackBar;
}

public get storage(): StorageService {
return this.componentServiceCollector.storage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export class AccountDetailComponent extends BaseComponent implements OnInit {
this.isEditingUser = false;
}
}

/**
* (Re)- send an invitation email for this user after confirmation
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class CommitteeExportService {
private csvExport: CsvExportService,
private meetingRepo: MeetingControllerService
) {}

public export(committees: ViewCommittee[]): void {
const properties: CsvColumnsDefinition<ViewCommittee> = [
{
Expand Down
6 changes: 6 additions & 0 deletions client/src/app/site/services/operator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,20 @@ export class OperatorService {
private get activeMeetingId(): number | null {
return this.activeMeetingService.meetingId;
}

private get activeMeeting(): ViewMeeting | null {
return this.activeMeetingService.meeting;
}

private get anonymousEnabled(): boolean {
return this.activeMeetingService.guestsEnabled;
}

private get defaultGroupId(): number | null {
const activeMeeting = this.activeMeetingService.meeting;
return activeMeeting ? activeMeeting.default_group_id : null;
}

private get adminGroupId(): number | null {
const activeMeeting = this.activeMeetingService.meeting;
return activeMeeting ? activeMeeting.admin_group_id : null;
Expand All @@ -171,6 +175,7 @@ export class OperatorService {
private readonly _operatorShortNameSubject: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(
null
);

private readonly _userSubject = new BehaviorSubject<ViewUser | null>(null);
private readonly _operatorReadySubject = new BehaviorSubject<boolean>(false);

Expand All @@ -195,6 +200,7 @@ export class OperatorService {
private set _permissions(perms: Permission[] | undefined) {
this._permissionsSubject.next(perms);
}

private get _permissions(): Permission[] | undefined {
return this._permissionsSubject.value;
}
Expand Down
3 changes: 3 additions & 0 deletions client/src/app/ui/base/base-form-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,17 @@ export abstract class BaseFormControlComponent<T> implements ControlValueAccesso
public writeValue(value: T): void {
this.value = value;
}

public registerOnChange(fn: any): void {
this._onChange = fn;
this.push(this.value);
}

public registerOnTouched(fn: any): void {
this._onTouched = fn;
this.push(this.value);
}

public setDisabledState?(isDisabled: boolean): void {
this.disabled = isDisabled;
}
Expand Down
Loading

0 comments on commit 550422c

Please sign in to comment.