From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- shared/extra-utils/videos/video-blacklist.ts | 28 ++++++------ shared/extra-utils/videos/video-captions.ts | 6 +-- shared/extra-utils/videos/video-channels.ts | 20 +++++---- shared/extra-utils/videos/video-comments.ts | 2 + shared/extra-utils/videos/video-imports.ts | 2 +- shared/extra-utils/videos/video-playlists.ts | 50 +++++++++++----------- .../videos/video-streaming-playlists.ts | 2 +- shared/extra-utils/videos/videos.ts | 21 ++++----- 8 files changed, 68 insertions(+), 63 deletions(-) (limited to 'shared/extra-utils/videos') diff --git a/shared/extra-utils/videos/video-blacklist.ts b/shared/extra-utils/videos/video-blacklist.ts index e25a292fc..ba139ef95 100644 --- a/shared/extra-utils/videos/video-blacklist.ts +++ b/shared/extra-utils/videos/video-blacklist.ts @@ -13,11 +13,11 @@ function addVideoToBlacklist ( const path = '/api/v1/videos/' + videoId + '/blacklist' return request(url) - .post(path) - .send({ reason, unfederate }) - .set('Accept', 'application/json') - .set('Authorization', 'Bearer ' + token) - .expect(specialStatus) + .post(path) + .send({ reason, unfederate }) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .expect(specialStatus) } function updateVideoBlacklist (url: string, token: string, videoId: number, reason?: string, specialStatus = 204) { @@ -35,20 +35,20 @@ function removeVideoFromBlacklist (url: string, token: string, videoId: number | const path = '/api/v1/videos/' + videoId + '/blacklist' return request(url) - .delete(path) - .set('Accept', 'application/json') - .set('Authorization', 'Bearer ' + token) - .expect(specialStatus) + .delete(path) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .expect(specialStatus) } function getBlacklistedVideosList (parameters: { - url: string, - token: string, - sort?: string, - type?: VideoBlacklistType, + url: string + token: string + sort?: string + type?: VideoBlacklistType specialStatus?: number }) { - let { url, token, sort, type, specialStatus = 200 } = parameters + const { url, token, sort, type, specialStatus = 200 } = parameters const path = '/api/v1/videos/blacklist/' const query = { sort, type } diff --git a/shared/extra-utils/videos/video-captions.ts b/shared/extra-utils/videos/video-captions.ts index 8d67f617b..5bd533bba 100644 --- a/shared/extra-utils/videos/video-captions.ts +++ b/shared/extra-utils/videos/video-captions.ts @@ -6,12 +6,12 @@ import { buildAbsoluteFixturePath } from '../miscs/miscs' const expect = chai.expect function createVideoCaption (args: { - url: string, + url: string accessToken: string videoId: string | number language: string - fixture: string, - mimeType?: string, + fixture: string + mimeType?: string statusCodeExpected?: number }) { const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.language diff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.ts index 053842331..51d433940 100644 --- a/shared/extra-utils/videos/video-channels.ts +++ b/shared/extra-utils/videos/video-channels.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-floating-promises */ + import * as request from 'supertest' import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' @@ -22,11 +24,11 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: } function getAccountVideoChannelsList (parameters: { - url: string, - accountName: string, - start?: number, - count?: number, - sort?: string, + url: string + accountName: string + start?: number + count?: number + sort?: string specialStatus?: number }) { const { url, accountName, start, count, sort = 'createdAt', specialStatus = 200 } = parameters @@ -113,9 +115,9 @@ function getVideoChannel (url: string, channelName: string) { } function updateVideoChannelAvatar (options: { - url: string, - accessToken: string, - fixture: string, + url: string + accessToken: string + fixture: string videoChannelName: string | number }) { @@ -129,7 +131,7 @@ function setDefaultVideoChannel (servers: ServerInfo[]) { for (const server of servers) { const p = getMyUserInformation(server.url, server.accessToken) - .then(res => server.videoChannel = (res.body as User).videoChannels[0]) + .then(res => { server.videoChannel = (res.body as User).videoChannels[0] }) tasks.push(p) } diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.ts index 0ebf69ced..81c48412d 100644 --- a/shared/extra-utils/videos/video-comments.ts +++ b/shared/extra-utils/videos/video-comments.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-floating-promises */ + import * as request from 'supertest' import { makeDeleteRequest } from '../requests/requests' diff --git a/shared/extra-utils/videos/video-imports.ts b/shared/extra-utils/videos/video-imports.ts index 150cc94ed..8e5abd2f5 100644 --- a/shared/extra-utils/videos/video-imports.ts +++ b/shared/extra-utils/videos/video-imports.ts @@ -7,7 +7,7 @@ function getYoutubeVideoUrl () { } function getMagnetURI () { - // tslint:disable:max-line-length + // eslint-disable-next-line max-len return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4' } diff --git a/shared/extra-utils/videos/video-playlists.ts b/shared/extra-utils/videos/video-playlists.ts index 6762c5973..5bcc02570 100644 --- a/shared/extra-utils/videos/video-playlists.ts +++ b/shared/extra-utils/videos/video-playlists.ts @@ -123,9 +123,9 @@ function deleteVideoPlaylist (url: string, token: string, playlistId: number | s } function createVideoPlaylist (options: { - url: string, - token: string, - playlistAttrs: VideoPlaylistCreate, + url: string + token: string + playlistAttrs: VideoPlaylistCreate expectedStatus?: number }) { const path = '/api/v1/video-playlists' @@ -148,10 +148,10 @@ function createVideoPlaylist (options: { } function updateVideoPlaylist (options: { - url: string, - token: string, - playlistAttrs: VideoPlaylistUpdate, - playlistId: number | string, + url: string + token: string + playlistAttrs: VideoPlaylistUpdate + playlistId: number | string expectedStatus?: number }) { const path = '/api/v1/video-playlists/' + options.playlistId @@ -174,9 +174,9 @@ function updateVideoPlaylist (options: { } async function addVideoInPlaylist (options: { - url: string, - token: string, - playlistId: number | string, + url: string + token: string + playlistId: number | string elementAttrs: VideoPlaylistElementCreate | { videoId: string } expectedStatus?: number }) { @@ -194,11 +194,11 @@ async function addVideoInPlaylist (options: { } function updateVideoPlaylistElement (options: { - url: string, - token: string, - playlistId: number | string, - playlistElementId: number | string, - elementAttrs: VideoPlaylistElementUpdate, + url: string + token: string + playlistId: number | string + playlistElementId: number | string + elementAttrs: VideoPlaylistElementUpdate expectedStatus?: number }) { const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId @@ -213,10 +213,10 @@ function updateVideoPlaylistElement (options: { } function removeVideoFromPlaylist (options: { - url: string, - token: string, - playlistId: number | string, - playlistElementId: number, + url: string + token: string + playlistId: number | string + playlistElementId: number expectedStatus?: number }) { const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId @@ -230,14 +230,14 @@ function removeVideoFromPlaylist (options: { } function reorderVideosPlaylist (options: { - url: string, - token: string, - playlistId: number | string, + url: string + token: string + playlistId: number | string elementAttrs: { - startPosition: number, - insertAfterPosition: number, + startPosition: number + insertAfterPosition: number reorderLength?: number - }, + } expectedStatus?: number }) { const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/reorder' diff --git a/shared/extra-utils/videos/video-streaming-playlists.ts b/shared/extra-utils/videos/video-streaming-playlists.ts index eb25011cb..e54da84aa 100644 --- a/shared/extra-utils/videos/video-streaming-playlists.ts +++ b/shared/extra-utils/videos/video-streaming-playlists.ts @@ -37,7 +37,7 @@ async function checkSegmentHash ( const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url) - const sha256Server = resSha.body[ videoName ][range] + const sha256Server = resSha.body[videoName][range] expect(sha256(res2.body)).to.equal(sha256Server) } diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index aa13273ae..39a06b0d7 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts @@ -1,4 +1,4 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ import { expect } from 'chai' import { pathExists, readdir, readFile } from 'fs-extra' @@ -488,7 +488,7 @@ async function completeVideoCheck ( description: string publishedAt?: string support: string - originallyPublishedAt?: string, + originallyPublishedAt?: string account: { name: string host: string @@ -509,7 +509,7 @@ async function completeVideoCheck ( files: { resolution: number size: number - }[], + }[] thumbnailfile?: string previewfile?: string } @@ -583,9 +583,10 @@ async function completeVideoCheck ( const minSize = attributeFile.size - ((10 * attributeFile.size) / 100) const maxSize = attributeFile.size + ((10 * attributeFile.size) / 100) - expect(file.size, - 'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')') - .to.be.above(minSize).and.below(maxSize) + expect( + file.size, + 'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')' + ).to.be.above(minSize).and.below(maxSize) const torrent = await webtorrentAdd(file.magnetUri, true) expect(torrent.files).to.be.an('array') @@ -608,10 +609,10 @@ async function videoUUIDToId (url: string, id: number | string) { } async function uploadVideoAndGetId (options: { - server: ServerInfo, - videoName: string, - nsfw?: boolean, - privacy?: VideoPrivacy, + server: ServerInfo + videoName: string + nsfw?: boolean + privacy?: VideoPrivacy token?: string }) { const videoAttrs: any = { name: options.videoName } -- cgit v1.2.3