diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-15 15:16:41 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-15 15:16:41 +0100 |
commit | 7dcd7d81406f4869363d2a5595d5c68f7106eb22 (patch) | |
tree | 6da3b6fa6c58db11187cde99b66756ef621360b7 | |
parent | 99b757488c077cee7d0ab89eeec181a7ee6290eb (diff) | |
download | PeerTube-7dcd7d81406f4869363d2a5595d5c68f7106eb22.tar.gz PeerTube-7dcd7d81406f4869363d2a5595d5c68f7106eb22.tar.zst PeerTube-7dcd7d81406f4869363d2a5595d5c68f7106eb22.zip |
Fix client lint
9 files changed, 14 insertions, 14 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts index 25203de1b..460c37a38 100644 --- a/client/src/app/+videos/+video-edit/video-add.component.ts +++ b/client/src/app/+videos/+video-edit/video-add.component.ts | |||
@@ -143,7 +143,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
143 | return text | 143 | return text |
144 | } | 144 | } |
145 | 145 | ||
146 | canDeactivate (): { canDeactivate: boolean, text?: string} { | 146 | canDeactivate (): { canDeactivate: boolean, text?: string } { |
147 | if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate() | 147 | if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate() |
148 | if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate() | 148 | if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate() |
149 | if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate() | 149 | if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate() |
diff --git a/client/src/app/core/routing/preload-selected-modules-list.ts b/client/src/app/core/routing/preload-selected-modules-list.ts index b5c3195b0..1abcdb015 100644 --- a/client/src/app/core/routing/preload-selected-modules-list.ts +++ b/client/src/app/core/routing/preload-selected-modules-list.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import { Observable, of as ofObservable, timer as observableTimer } from 'rxjs' | 1 | import { Observable, of as ofObservable, timer as observableTimer } from 'rxjs' |
2 | import { switchMap } from 'rxjs/operators' | 2 | import { switchMap } from 'rxjs/operators' |
3 | import { PreloadingStrategy, Route } from '@angular/router' | ||
4 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { PreloadingStrategy, Route } from '@angular/router' | ||
5 | 5 | ||
6 | @Injectable() | 6 | @Injectable() |
7 | export class PreloadSelectedModulesList implements PreloadingStrategy { | 7 | export class PreloadSelectedModulesList implements PreloadingStrategy { |
8 | 8 | ||
9 | preload (route: Route, load: () => Observable<any>): Observable<any> { | 9 | preload (route: Route, load: () => Observable<any>): Observable<any> { |
10 | if (!route.data || !route.data.preload) return ofObservable(null) | 10 | if (!route.data?.preload) return ofObservable(null) |
11 | 11 | ||
12 | if (typeof route.data.preload === 'number') { | 12 | if (typeof route.data.preload === 'number') { |
13 | return observableTimer(route.data.preload).pipe(switchMap(() => load())) | 13 | return observableTimer(route.data.preload).pipe(switchMap(() => load())) |
diff --git a/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts b/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts index 7c18b7f67..e0cb475fc 100644 --- a/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts +++ b/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts | |||
@@ -13,11 +13,11 @@ export class NumberFormatterPipe implements PipeTransform { | |||
13 | static getDecimalForNumber (x: number, n = 1) { | 13 | static getDecimalForNumber (x: number, n = 1) { |
14 | const v = x.toString().split('.') | 14 | const v = x.toString().split('.') |
15 | const f = v[1] || '' | 15 | const f = v[1] || '' |
16 | if (f.length > n) return +f.substr(0, n) | 16 | if (f.length > n) return +f.substring(0, n) |
17 | return +f | 17 | return +f |
18 | } | 18 | } |
19 | 19 | ||
20 | private dictionary: Array<{max: number, type: string}> = [ | 20 | private dictionary: Array<{ max: number, type: string }> = [ |
21 | { max: 1000, type: '' }, | 21 | { max: 1000, type: '' }, |
22 | { max: 1000000, type: 'K' }, | 22 | { max: 1000000, type: 'K' }, |
23 | { max: 1000000000, type: 'M' } | 23 | { max: 1000000000, type: 'M' } |
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 7e4e1b1d1..b6ce21641 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 | |||
@@ -32,7 +32,7 @@ export interface ListOverflowItem { | |||
32 | }) | 32 | }) |
33 | export class ListOverflowComponent<T extends ListOverflowItem> implements AfterViewInit { | 33 | export class ListOverflowComponent<T extends ListOverflowItem> implements AfterViewInit { |
34 | @Input() items: T[] | 34 | @Input() items: T[] |
35 | @Input() itemTemplate: TemplateRef<{item: T}> | 35 | @Input() itemTemplate: TemplateRef<{ item: T }> |
36 | 36 | ||
37 | @ViewChild('modal', { static: true }) modal: ElementRef | 37 | @ViewChild('modal', { static: true }) modal: ElementRef |
38 | @ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement> | 38 | @ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement> |
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index 667cb107f..4135542dc 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts | |||
@@ -10,7 +10,7 @@ import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' | |||
10 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoFileTokenService, VideoService } from '../shared-main' | 10 | import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoFileTokenService, VideoService } from '../shared-main' |
11 | 11 | ||
12 | type DownloadType = 'video' | 'subtitles' | 12 | type DownloadType = 'video' | 'subtitles' |
13 | type FileMetadata = { [key: string]: { label: string, value: string }} | 13 | type FileMetadata = { [key: string]: { label: string, value: string } } |
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
16 | selector: 'my-video-download', | 16 | selector: 'my-video-download', |
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts index 7a2574345..79b7b9a50 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts | |||
@@ -74,7 +74,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | buildRouterQuery () { | 76 | buildRouterQuery () { |
77 | if (!this.playlistElement || !this.playlistElement.video) return {} | 77 | if (!this.playlistElement?.video) return {} |
78 | 78 | ||
79 | return { | 79 | return { |
80 | playlistPosition: this.playlistElement.position, | 80 | playlistPosition: this.playlistElement.position, |
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 7e25e3067..ffbe64408 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts | |||
@@ -32,7 +32,7 @@ function isSafari () { | |||
32 | 32 | ||
33 | // https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts | 33 | // https://github.com/danrevah/ngx-pipes/blob/master/src/pipes/math/bytes.ts |
34 | // Don't import all Angular stuff, just copy the code with shame | 34 | // Don't import all Angular stuff, just copy the code with shame |
35 | const dictionaryBytes: Array<{max: number, type: string}> = [ | 35 | const dictionaryBytes: Array<{ max: number, type: string }> = [ |
36 | { max: 1024, type: 'B' }, | 36 | { max: 1024, type: 'B' }, |
37 | { max: 1048576, type: 'KB' }, | 37 | { max: 1048576, type: 'KB' }, |
38 | { max: 1073741824, type: 'MB' }, | 38 | { max: 1073741824, type: 'MB' }, |
diff --git a/client/src/standalone/videos/shared/playlist-tracker.ts b/client/src/standalone/videos/shared/playlist-tracker.ts index 9ea4be83f..d8708826d 100644 --- a/client/src/standalone/videos/shared/playlist-tracker.ts +++ b/client/src/standalone/videos/shared/playlist-tracker.ts | |||
@@ -32,7 +32,7 @@ export class PlaylistTracker { | |||
32 | 32 | ||
33 | const next = this.playlistElements.find(e => e.position === position) | 33 | const next = this.playlistElements.find(e => e.position === position) |
34 | 34 | ||
35 | if (!next || !next.video) { | 35 | if (!next?.video) { |
36 | return this.getNextPlaylistElement(position + 1) | 36 | return this.getNextPlaylistElement(position + 1) |
37 | } | 37 | } |
38 | 38 | ||
@@ -52,7 +52,7 @@ export class PlaylistTracker { | |||
52 | 52 | ||
53 | const prev = this.playlistElements.find(e => e.position === position) | 53 | const prev = this.playlistElements.find(e => e.position === position) |
54 | 54 | ||
55 | if (!prev || !prev.video) { | 55 | if (!prev?.video) { |
56 | return this.getNextPlaylistElement(position - 1) | 56 | return this.getNextPlaylistElement(position - 1) |
57 | } | 57 | } |
58 | 58 | ||
@@ -68,7 +68,7 @@ export class PlaylistTracker { | |||
68 | 68 | ||
69 | setPosition (position: number) { | 69 | setPosition (position: number) { |
70 | this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) | 70 | this.currentPlaylistElement = this.playlistElements.find(e => e.position === position) |
71 | if (!this.currentPlaylistElement || !this.currentPlaylistElement.video) { | 71 | if (!this.currentPlaylistElement?.video) { |
72 | logger.error('Current playlist element is not valid.', this.currentPlaylistElement) | 72 | logger.error('Current playlist element is not valid.', this.currentPlaylistElement) |
73 | this.currentPlaylistElement = this.getNextPlaylistElement() | 73 | this.currentPlaylistElement = this.getNextPlaylistElement() |
74 | } | 74 | } |
diff --git a/client/src/standalone/videos/tsconfig.json b/client/src/standalone/videos/tsconfig.json index e0cab7ca3..7d532985c 100644 --- a/client/src/standalone/videos/tsconfig.json +++ b/client/src/standalone/videos/tsconfig.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "extends": "../../../tsconfig.json", | 2 | "extends": "../../../tsconfig.json", |
3 | "include": [ | 3 | "include": [ |
4 | "src/standalone/videos/embed.ts", | 4 | "./embed.ts", |
5 | "src/standalone/videos/test-embed.ts" | 5 | "./test-embed.ts" |
6 | ] | 6 | ] |
7 | } | 7 | } |