From 9df52d660feb722404be00a50f3c8a612bec1c15 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 14:42:53 +0200 Subject: Migrate client to eslint --- .../app/shared/shared-main/account/account.model.ts | 2 +- .../src/app/shared/shared-main/account/actor.model.ts | 2 +- .../shared/shared-main/angular/autofocus.directive.ts | 2 +- .../app/shared/shared-main/angular/link.component.ts | 2 +- .../shared-main/angular/peertube-template.directive.ts | 1 + .../app/shared/shared-main/feeds/syndication.model.ts | 4 ++-- .../src/app/shared/shared-main/misc/help.component.ts | 12 ++++++------ .../shared/shared-main/misc/list-overflow.component.ts | 4 ++-- .../shared-main/misc/simple-search-input.component.ts | 2 +- .../shared-main/misc/top-menu-dropdown.component.ts | 2 +- .../shared-main/users/user-notification.service.ts | 6 +++--- .../shared/shared-main/users/user-quota.component.ts | 2 +- .../shared-main/video-channel/video-channel.model.ts | 5 ++--- .../shared-main/video-channel/video-channel.service.ts | 12 ++++++------ .../app/shared/shared-main/video/redundancy.service.ts | 4 ++-- .../app/shared/shared-main/video/video-edit.model.ts | 12 ++++++------ client/src/app/shared/shared-main/video/video.model.ts | 2 +- .../src/app/shared/shared-main/video/video.service.ts | 18 +++++++++--------- 18 files changed, 47 insertions(+), 47 deletions(-) (limited to 'client/src/app/shared/shared-main') diff --git a/client/src/app/shared/shared-main/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.ts index 7b5611f35..92606e7fa 100644 --- a/client/src/app/shared/shared-main/account/account.model.ts +++ b/client/src/app/shared/shared-main/account/account.model.ts @@ -1,4 +1,4 @@ -import { Account as ServerAccount, Actor as ServerActor, ActorImage } from '@shared/models' +import { Account as ServerAccount, ActorImage } from '@shared/models' import { Actor } from './actor.model' export class Account extends Actor implements ServerAccount { diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index 2fccc472a..082f44fb9 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts @@ -20,7 +20,7 @@ export abstract class Actor implements ServerActor { static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) { if (actor?.avatar?.url) return actor.avatar.url - if (actor && actor.avatar) { + if (actor?.avatar) { const absoluteAPIUrl = getAbsoluteAPIUrl() return absoluteAPIUrl + actor.avatar.path diff --git a/client/src/app/shared/shared-main/angular/autofocus.directive.ts b/client/src/app/shared/shared-main/angular/autofocus.directive.ts index 5f087d79d..2da492ea1 100644 --- a/client/src/app/shared/shared-main/angular/autofocus.directive.ts +++ b/client/src/app/shared/shared-main/angular/autofocus.directive.ts @@ -1,7 +1,7 @@ import { AfterViewInit, Directive, ElementRef } from '@angular/core' @Directive({ - selector: '[autofocus]' + selector: '[myAutofocus]' }) export class AutofocusDirective implements AfterViewInit { constructor (private host: ElementRef) { } diff --git a/client/src/app/shared/shared-main/angular/link.component.ts b/client/src/app/shared/shared-main/angular/link.component.ts index 597a16871..ecbd9151c 100644 --- a/client/src/app/shared/shared-main/angular/link.component.ts +++ b/client/src/app/shared/shared-main/angular/link.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, ViewEncapsulation } from '@angular/core' +import { Component, Input } from '@angular/core' @Component({ selector: 'my-link', diff --git a/client/src/app/shared/shared-main/angular/peertube-template.directive.ts b/client/src/app/shared/shared-main/angular/peertube-template.directive.ts index e04c25d9a..dc0cde12d 100644 --- a/client/src/app/shared/shared-main/angular/peertube-template.directive.ts +++ b/client/src/app/shared/shared-main/angular/peertube-template.directive.ts @@ -1,6 +1,7 @@ import { Directive, Input, TemplateRef } from '@angular/core' @Directive({ + // eslint-disable-next-line @angular-eslint/directive-selector selector: '[ptTemplate]' }) export class PeerTubeTemplateDirective { diff --git a/client/src/app/shared/shared-main/feeds/syndication.model.ts b/client/src/app/shared/shared-main/feeds/syndication.model.ts index 2466ae7c6..cd6fbdb48 100644 --- a/client/src/app/shared/shared-main/feeds/syndication.model.ts +++ b/client/src/app/shared/shared-main/feeds/syndication.model.ts @@ -1,7 +1,7 @@ import { FeedFormat } from '@shared/models' export interface Syndication { - format: FeedFormat, - label: string, + format: FeedFormat + label: string url: string } diff --git a/client/src/app/shared/shared-main/misc/help.component.ts b/client/src/app/shared/shared-main/misc/help.component.ts index 76e255d99..37e2abd97 100644 --- a/client/src/app/shared/shared-main/misc/help.component.ts +++ b/client/src/app/shared/shared-main/misc/help.component.ts @@ -71,18 +71,18 @@ export class HelpComponent implements OnInit, OnChanges, AfterContentInit { } private formatMarkdownSupport (rules: string[]) { - // tslint:disable:max-line-length + /* eslint-disable max-len */ return $localize`Markdown compatible that supports:` + this.createMarkdownList(rules) } private createMarkdownList (rules: string[]) { const rulesToText = { - 'emphasis': $localize`Emphasis`, - 'link': $localize`Links`, - 'newline': $localize`New lines`, - 'list': $localize`Lists`, - 'image': $localize`Images` + emphasis: $localize`Emphasis`, + link: $localize`Links`, + newline: $localize`New lines`, + list: $localize`Lists`, + image: $localize`Images` } const bullets = rules.map(r => rulesToText[r]) diff --git a/client/src/app/shared/shared-main/misc/list-overflow.component.ts b/client/src/app/shared/shared-main/misc/list-overflow.component.ts index 144e0f156..fbc481093 100644 --- a/client/src/app/shared/shared-main/misc/list-overflow.component.ts +++ b/client/src/app/shared/shared-main/misc/list-overflow.component.ts @@ -22,7 +22,7 @@ export interface ListOverflowItem { } @Component({ - selector: 'list-overflow', + selector: 'my-list-overflow', templateUrl: './list-overflow.component.html', styleUrls: [ './list-overflow.component.scss' ], changeDetection: ChangeDetectionStrategy.OnPush @@ -65,7 +65,7 @@ export class ListOverflowComponent implements AfterV let showItemsUntilIndexExcluded: number let accWidth = 0 - for (const [index, el] of this.itemsRendered.toArray().entries()) { + for (const [ index, el ] of this.itemsRendered.toArray().entries()) { accWidth += el.nativeElement.getBoundingClientRect().width if (showItemsUntilIndexExcluded === undefined) { showItemsUntilIndexExcluded = (parentWidth < accWidth) ? index : undefined diff --git a/client/src/app/shared/shared-main/misc/simple-search-input.component.ts b/client/src/app/shared/shared-main/misc/simple-search-input.component.ts index 224d71134..292ec4c82 100644 --- a/client/src/app/shared/shared-main/misc/simple-search-input.component.ts +++ b/client/src/app/shared/shared-main/misc/simple-search-input.component.ts @@ -4,7 +4,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } import { ActivatedRoute, Router } from '@angular/router' @Component({ - selector: 'simple-search-input', + selector: 'my-simple-search-input', templateUrl: './simple-search-input.component.html', styleUrls: [ './simple-search-input.component.scss' ] }) diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index 2cafb6c55..e7e34ce1e 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts @@ -66,7 +66,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { .subscribe(() => this.updateChildLabels(window.location.pathname)) this.hasIcons = this.menuEntries.some( - e => e.children && e.children.some(c => !!c.iconName) + e => e.children?.some(c => !!c.iconName) ) } diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts index 9014b48a8..09fee87a3 100644 --- a/client/src/app/shared/shared-main/users/user-notification.service.ts +++ b/client/src/app/shared/shared-main/users/user-notification.service.ts @@ -1,11 +1,11 @@ +import { SortMeta } from 'primeng/api' import { catchError, map, tap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' -import { ComponentPaginationLight, RestExtractor, RestService, User, PeerTubeSocket, AuthService } from '@app/core' +import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core' import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' import { environment } from '../../../../environments/environment' import { UserNotification } from './user-notification.model' -import { SortMeta } from 'primeng/api' @Injectable() export class UserNotificationService { @@ -23,7 +23,7 @@ export class UserNotificationService { listMyNotifications (parameters: { pagination: ComponentPaginationLight ignoreLoadingBar?: boolean - unread?: boolean, + unread?: boolean sort?: SortMeta }) { const { pagination, ignoreLoadingBar, unread, sort } = parameters diff --git a/client/src/app/shared/shared-main/users/user-quota.component.ts b/client/src/app/shared/shared-main/users/user-quota.component.ts index b38619186..5a95f1209 100644 --- a/client/src/app/shared/shared-main/users/user-quota.component.ts +++ b/client/src/app/shared/shared-main/users/user-quota.component.ts @@ -6,7 +6,7 @@ import { BytesPipe } from '../angular' @Component({ selector: 'my-user-quota', templateUrl: './user-quota.component.html', - styleUrls: ['./user-quota.component.scss'] + styleUrls: [ './user-quota.component.scss' ] }) export class UserQuotaComponent implements OnInit { diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index a9dcf2fa2..66d4cac68 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts @@ -1,6 +1,5 @@ import { getAbsoluteAPIUrl } from '@app/helpers' import { Account as ServerAccount, ActorImage, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@shared/models' -import { Account } from '../account/account.model' import { Actor } from '../account/actor.model' export class VideoChannel extends Actor implements ServerVideoChannel { @@ -25,14 +24,14 @@ export class VideoChannel extends Actor implements ServerVideoChannel { viewsPerDay?: ViewsPerDate[] - static GET_ACTOR_AVATAR_URL (actor: object) { + static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) { return Actor.GET_ACTOR_AVATAR_URL(actor) } static GET_ACTOR_BANNER_URL (channel: ServerVideoChannel) { if (channel?.banner?.url) return channel.banner.url - if (channel && channel.banner) { + if (channel?.banner) { const absoluteAPIUrl = getAbsoluteAPIUrl() return absoluteAPIUrl + channel.banner.path diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts index a89f1065a..7560a35a8 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts @@ -15,6 +15,12 @@ export class VideoChannelService { videoChannelLoaded = new ReplaySubject(1) + constructor ( + private authHttp: HttpClient, + private restService: RestService, + private restExtractor: RestExtractor + ) { } + static extractVideoChannels (result: ResultList) { const videoChannels: VideoChannel[] = [] @@ -25,12 +31,6 @@ export class VideoChannelService { return { data: videoChannels, total: result.total } } - constructor ( - private authHttp: HttpClient, - private restService: RestService, - private restExtractor: RestExtractor - ) { } - getVideoChannel (videoChannelName: string) { return this.authHttp.get(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName) .pipe( diff --git a/client/src/app/shared/shared-main/video/redundancy.service.ts b/client/src/app/shared/shared-main/video/redundancy.service.ts index 6e839e655..966d7fafd 100644 --- a/client/src/app/shared/shared-main/video/redundancy.service.ts +++ b/client/src/app/shared/shared-main/video/redundancy.service.ts @@ -30,8 +30,8 @@ export class RedundancyService { } listVideoRedundancies (options: { - pagination: RestPagination, - sort: SortMeta, + pagination: RestPagination + sort: SortMeta target?: VideoRedundanciesTarget }): Observable> { const { pagination, sort, target } = options diff --git a/client/src/app/shared/shared-main/video/video-edit.model.ts b/client/src/app/shared/shared-main/video/video-edit.model.ts index 757b686c0..ea0456942 100644 --- a/client/src/app/shared/shared-main/video/video-edit.model.ts +++ b/client/src/app/shared/shared-main/video/video-edit.model.ts @@ -29,11 +29,11 @@ export class VideoEdit implements VideoUpdate { constructor ( video?: Video & { - tags: string[], - commentsEnabled: boolean, - downloadEnabled: boolean, - support: string, - thumbnailUrl: string, + tags: string[] + commentsEnabled: boolean + downloadEnabled: boolean + support: string + thumbnailUrl: string previewUrl: string }) { if (video) { @@ -64,7 +64,7 @@ export class VideoEdit implements VideoUpdate { patch (values: { [ id: string ]: any }) { Object.keys(values).forEach((key) => { - this[ key ] = values[ key ] + this[key] = values[key] }) // If schedule publication, the video is private and will be changed to public privacy diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index b7720c8d2..7471a933b 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -100,7 +100,7 @@ export class Video implements VideoServerModel { return '/videos/update/' + video.uuid } - constructor (hash: VideoServerModel, translations = {}) { + constructor (hash: VideoServerModel, translations: { [ id: string ]: string } = {}) { const absoluteAPIUrl = getAbsoluteAPIUrl() this.createdAt = new Date(hash.createdAt.toString()) diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 4a97719fa..60cc9d160 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -30,10 +30,10 @@ import { Video } from './video.model' export interface VideosProvider { getVideos (parameters: { - videoPagination: ComponentPaginationLight, - sort: VideoSortField, - filter?: VideoFilter, - categoryOneOf?: number[], + videoPagination: ComponentPaginationLight + sort: VideoSortField + filter?: VideoFilter + categoryOneOf?: number[] languageOneOf?: string[] nsfwPolicy: NSFWPolicyType }): Observable> @@ -145,8 +145,8 @@ export class VideoService implements VideosProvider { } getAccountVideos (parameters: { - account: Pick, - videoPagination: ComponentPaginationLight, + account: Pick + videoPagination: ComponentPaginationLight sort: VideoSortField nsfwPolicy?: NSFWPolicyType videoFilter?: VideoFilter @@ -180,9 +180,9 @@ export class VideoService implements VideosProvider { } getVideoChannelVideos (parameters: { - videoChannel: Pick, - videoPagination: ComponentPaginationLight, - sort: VideoSortField, + videoChannel: Pick + videoPagination: ComponentPaginationLight + sort: VideoSortField nsfwPolicy?: NSFWPolicyType videoFilter?: VideoFilter }): Observable> { -- cgit v1.2.3