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/form-validators/abuse-validators.ts | 24 +++--- .../form-validators/custom-config-validators.ts | 88 +++++++++++----------- .../shared/form-validators/form-validator.model.ts | 2 +- .../app/shared/form-validators/host-validators.ts | 20 ++--- .../shared/form-validators/instance-validators.ts | 24 +++--- .../app/shared/form-validators/login-validators.ts | 4 +- .../form-validators/reset-password-validators.ts | 2 +- .../app/shared/form-validators/user-validators.ts | 64 ++++++++-------- .../form-validators/video-block-validators.ts | 4 +- .../form-validators/video-captions-validators.ts | 4 +- .../form-validators/video-channel-validators.ts | 22 +++--- .../form-validators/video-comment-validators.ts | 6 +- .../video-ownership-change-validators.ts | 8 +- .../form-validators/video-playlist-validators.ts | 16 ++-- .../app/shared/form-validators/video-validators.ts | 32 ++++---- 15 files changed, 160 insertions(+), 160 deletions(-) (limited to 'client/src/app/shared/form-validators') diff --git a/client/src/app/shared/form-validators/abuse-validators.ts b/client/src/app/shared/form-validators/abuse-validators.ts index 75bfacf01..8d3c411b4 100644 --- a/client/src/app/shared/form-validators/abuse-validators.ts +++ b/client/src/app/shared/form-validators/abuse-validators.ts @@ -2,28 +2,28 @@ import { Validators } from '@angular/forms' import { BuildFormValidator } from './form-validator.model' export const ABUSE_REASON_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], + VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], MESSAGES: { - 'required': $localize`Report reason is required.`, - 'minlength': $localize`Report reason must be at least 2 characters long.`, - 'maxlength': $localize`Report reason cannot be more than 3000 characters long.` + required: $localize`Report reason is required.`, + minlength: $localize`Report reason must be at least 2 characters long.`, + maxlength: $localize`Report reason cannot be more than 3000 characters long.` } } export const ABUSE_MODERATION_COMMENT_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], + VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], MESSAGES: { - 'required': $localize`Moderation comment is required.`, - 'minlength': $localize`Moderation comment must be at least 2 characters long.`, - 'maxlength': $localize`Moderation comment cannot be more than 3000 characters long.` + required: $localize`Moderation comment is required.`, + minlength: $localize`Moderation comment must be at least 2 characters long.`, + maxlength: $localize`Moderation comment cannot be more than 3000 characters long.` } } export const ABUSE_MESSAGE_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], + VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], MESSAGES: { - 'required': $localize`Abuse message is required.`, - 'minlength': $localize`Abuse message must be at least 2 characters long.`, - 'maxlength': $localize`Abuse message cannot be more than 3000 characters long.` + required: $localize`Abuse message is required.`, + minlength: $localize`Abuse message must be at least 2 characters long.`, + maxlength: $localize`Abuse message cannot be more than 3000 characters long.` } } diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts index 1ed5700ff..fbf423d08 100644 --- a/client/src/app/shared/form-validators/custom-config-validators.ts +++ b/client/src/app/shared/form-validators/custom-config-validators.ts @@ -2,120 +2,120 @@ import { Validators } from '@angular/forms' import { BuildFormValidator } from './form-validator.model' export const INSTANCE_NAME_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required], + VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Instance name is required.` + required: $localize`Instance name is required.` } } export const INSTANCE_SHORT_DESCRIPTION_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.max(250)], + VALIDATORS: [ Validators.max(250) ], MESSAGES: { - 'max': $localize`Short description should not be longer than 250 characters.` + max: $localize`Short description should not be longer than 250 characters.` } } export const SERVICES_TWITTER_USERNAME_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required], + VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Twitter username is required.` + required: $localize`Twitter username is required.` } } export const CACHE_PREVIEWS_SIZE_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], + VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], MESSAGES: { - 'required': $localize`Previews cache size is required.`, - 'min': $localize`Previews cache size must be greater than 1.`, - 'pattern': $localize`Previews cache size must be a number.` + required: $localize`Previews cache size is required.`, + min: $localize`Previews cache size must be greater than 1.`, + pattern: $localize`Previews cache size must be a number.` } } export const CACHE_CAPTIONS_SIZE_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], + VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], MESSAGES: { - 'required': $localize`Captions cache size is required.`, - 'min': $localize`Captions cache size must be greater than 1.`, - 'pattern': $localize`Captions cache size must be a number.` + required: $localize`Captions cache size is required.`, + min: $localize`Captions cache size must be greater than 1.`, + pattern: $localize`Captions cache size must be a number.` } } export const SIGNUP_LIMIT_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+')], + VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ], MESSAGES: { - 'required': $localize`Signup limit is required.`, - 'min': $localize`Signup limit must be greater than 1. Use -1 to disable it.`, - 'pattern': $localize`Signup limit must be a number.` + required: $localize`Signup limit is required.`, + min: $localize`Signup limit must be greater than 1. Use -1 to disable it.`, + pattern: $localize`Signup limit must be a number.` } } export const SIGNUP_MINIMUM_AGE_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], + VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], MESSAGES: { - 'required': $localize`Signup minimum age is required.`, - 'min': $localize`Signup minimum age must be greater than 1.`, - 'pattern': $localize`Signup minimum age must be a number.` + required: $localize`Signup minimum age is required.`, + min: $localize`Signup minimum age must be greater than 1.`, + pattern: $localize`Signup minimum age must be a number.` } } export const ADMIN_EMAIL_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.email], + VALIDATORS: [ Validators.required, Validators.email ], MESSAGES: { - 'required': $localize`Admin email is required.`, - 'email': $localize`Admin email must be valid.` + required: $localize`Admin email is required.`, + email: $localize`Admin email must be valid.` } } export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(0)], + VALIDATORS: [ Validators.required, Validators.min(0) ], MESSAGES: { - 'required': $localize`Transcoding threads is required.`, - 'min': $localize`Transcoding threads must be greater or equal to 0.` + required: $localize`Transcoding threads is required.`, + min: $localize`Transcoding threads must be greater or equal to 0.` } } export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(-1)], + VALIDATORS: [ Validators.required, Validators.min(-1) ], MESSAGES: { - 'required': $localize`Max live duration is required.`, - 'min': $localize`Max live duration should be greater or equal to -1.` + required: $localize`Max live duration is required.`, + min: $localize`Max live duration should be greater or equal to -1.` } } export const MAX_INSTANCE_LIVES_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(-1)], + VALIDATORS: [ Validators.required, Validators.min(-1) ], MESSAGES: { - 'required': $localize`Max instance lives is required.`, - 'min': $localize`Max instance lives should be greater or equal to -1.` + required: $localize`Max instance lives is required.`, + min: $localize`Max instance lives should be greater or equal to -1.` } } export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(-1)], + VALIDATORS: [ Validators.required, Validators.min(-1) ], MESSAGES: { - 'required': $localize`Max user lives is required.`, - 'min': $localize`Max user lives should be greater or equal to -1.` + required: $localize`Max user lives is required.`, + min: $localize`Max user lives should be greater or equal to -1.` } } export const CONCURRENCY_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.min(1)], + VALIDATORS: [ Validators.required, Validators.min(1) ], MESSAGES: { - 'required': $localize`Concurrency is required.`, - 'min': $localize`Concurrency should be greater or equal to 1.` + required: $localize`Concurrency is required.`, + min: $localize`Concurrency should be greater or equal to 1.` } } export const INDEX_URL_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.pattern(/^https:\/\//)], + VALIDATORS: [ Validators.pattern(/^https:\/\//) ], MESSAGES: { - 'pattern': $localize`Index URL should be a URL` + pattern: $localize`Index URL should be a URL` } } export const SEARCH_INDEX_URL_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.pattern(/^https?:\/\//)], + VALIDATORS: [ Validators.pattern(/^https?:\/\//) ], MESSAGES: { - 'pattern': $localize`Search index URL should be a URL` + pattern: $localize`Search index URL should be a URL` } } diff --git a/client/src/app/shared/form-validators/form-validator.model.ts b/client/src/app/shared/form-validators/form-validator.model.ts index 07b1ea075..6f2472ccd 100644 --- a/client/src/app/shared/form-validators/form-validator.model.ts +++ b/client/src/app/shared/form-validators/form-validator.model.ts @@ -1,7 +1,7 @@ import { ValidatorFn } from '@angular/forms' export type BuildFormValidator = { - VALIDATORS: ValidatorFn[], + VALIDATORS: ValidatorFn[] MESSAGES: { [ name: string ]: string } } diff --git a/client/src/app/shared/form-validators/host-validators.ts b/client/src/app/shared/form-validators/host-validators.ts index 6f410a50a..3d9c476b5 100644 --- a/client/src/app/shared/form-validators/host-validators.ts +++ b/client/src/app/shared/form-validators/host-validators.ts @@ -4,7 +4,7 @@ import { BuildFormValidator } from './form-validator.model' export function validateHost (value: string) { // Thanks to http://stackoverflow.com/a/106223 const HOST_REGEXP = new RegExp( - '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' + '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$' ) return HOST_REGEXP.test(value) @@ -32,7 +32,7 @@ const validHosts: ValidatorFn = (control: AbstractControl) => { if (errors.length === 0) return null return { - 'validHosts': { + validHosts: { reason: 'invalid', value: errors.join('. ') + '.' } @@ -55,7 +55,7 @@ const validHostsOrHandles: ValidatorFn = (control: AbstractControl) => { if (errors.length === 0) return null return { - 'validHostsOrHandles': { + validHostsOrHandles: { reason: 'invalid', value: errors.join('. ') + '.' } @@ -80,7 +80,7 @@ export const unique: ValidatorFn = (control: AbstractControl) => { } return { - 'unique': { + unique: { reason: 'invalid' } } @@ -89,17 +89,17 @@ export const unique: ValidatorFn = (control: AbstractControl) => { export const UNIQUE_HOSTS_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, validHosts, unique ], MESSAGES: { - 'required': $localize`Domain is required.`, - 'validHosts': $localize`Hosts entered are invalid.`, - 'unique': $localize`Hosts entered contain duplicates.` + required: $localize`Domain is required.`, + validHosts: $localize`Hosts entered are invalid.`, + unique: $localize`Hosts entered contain duplicates.` } } export const UNIQUE_HOSTS_OR_HANDLE_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, validHostsOrHandles, unique ], MESSAGES: { - 'required': $localize`Domain is required.`, - 'validHostsOrHandles': $localize`Hosts or handles are invalid.`, - 'unique': $localize`Hosts or handles contain duplicates.` + required: $localize`Domain is required.`, + validHostsOrHandles: $localize`Hosts or handles are invalid.`, + unique: $localize`Hosts or handles contain duplicates.` } } diff --git a/client/src/app/shared/form-validators/instance-validators.ts b/client/src/app/shared/form-validators/instance-validators.ts index a72e28ba0..4b1f0d048 100644 --- a/client/src/app/shared/form-validators/instance-validators.ts +++ b/client/src/app/shared/form-validators/instance-validators.ts @@ -2,10 +2,10 @@ import { Validators } from '@angular/forms' import { BuildFormValidator } from './form-validator.model' export const FROM_EMAIL_VALIDATOR: BuildFormValidator = { - VALIDATORS: [Validators.required, Validators.email], + VALIDATORS: [ Validators.required, Validators.email ], MESSAGES: { - 'required': $localize`Email is required.`, - 'email': $localize`Email must be valid.` + required: $localize`Email is required.`, + email: $localize`Email must be valid.` } } @@ -16,9 +16,9 @@ export const FROM_NAME_VALIDATOR: BuildFormValidator = { Validators.maxLength(120) ], MESSAGES: { - 'required': $localize`Your name is required.`, - 'minlength': $localize`Your name must be at least 1 character long.`, - 'maxlength': $localize`Your name cannot be more than 120 characters long.` + required: $localize`Your name is required.`, + minlength: $localize`Your name must be at least 1 character long.`, + maxlength: $localize`Your name cannot be more than 120 characters long.` } } @@ -29,9 +29,9 @@ export const SUBJECT_VALIDATOR: BuildFormValidator = { Validators.maxLength(120) ], MESSAGES: { - 'required': $localize`A subject is required.`, - 'minlength': $localize`The subject must be at least 1 character long.`, - 'maxlength': $localize`The subject cannot be more than 120 characters long.` + required: $localize`A subject is required.`, + minlength: $localize`The subject must be at least 1 character long.`, + maxlength: $localize`The subject cannot be more than 120 characters long.` } } @@ -42,8 +42,8 @@ export const BODY_VALIDATOR: BuildFormValidator = { Validators.maxLength(5000) ], MESSAGES: { - 'required': $localize`A message is required.`, - 'minlength': $localize`The message must be at least 3 characters long.`, - 'maxlength': $localize`The message cannot be more than 5000 characters long.` + required: $localize`A message is required.`, + minlength: $localize`The message must be at least 3 characters long.`, + maxlength: $localize`The message cannot be more than 5000 characters long.` } } diff --git a/client/src/app/shared/form-validators/login-validators.ts b/client/src/app/shared/form-validators/login-validators.ts index 1ceae1be3..5b911ac47 100644 --- a/client/src/app/shared/form-validators/login-validators.ts +++ b/client/src/app/shared/form-validators/login-validators.ts @@ -6,7 +6,7 @@ export const LOGIN_USERNAME_VALIDATOR: BuildFormValidator = { Validators.required ], MESSAGES: { - 'required': $localize`Username is required.` + required: $localize`Username is required.` } } @@ -15,6 +15,6 @@ export const LOGIN_PASSWORD_VALIDATOR: BuildFormValidator = { Validators.required ], MESSAGES: { - 'required': $localize`Password is required.` + required: $localize`Password is required.` } } diff --git a/client/src/app/shared/form-validators/reset-password-validators.ts b/client/src/app/shared/form-validators/reset-password-validators.ts index b87f2eab9..70617a562 100644 --- a/client/src/app/shared/form-validators/reset-password-validators.ts +++ b/client/src/app/shared/form-validators/reset-password-validators.ts @@ -6,6 +6,6 @@ export const RESET_PASSWORD_CONFIRM_VALIDATOR: BuildFormValidator = { Validators.required ], MESSAGES: { - 'required': $localize`Confirmation of the password is required.` + required: $localize`Confirmation of the password is required.` } } diff --git a/client/src/app/shared/form-validators/user-validators.ts b/client/src/app/shared/form-validators/user-validators.ts index 976c97b87..6d0dea64e 100644 --- a/client/src/app/shared/form-validators/user-validators.ts +++ b/client/src/app/shared/form-validators/user-validators.ts @@ -11,10 +11,10 @@ export const USER_USERNAME_VALIDATOR: BuildFormValidator = { Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`)) ], MESSAGES: { - 'required': $localize`Username is required.`, - 'minlength': $localize`Username must be at least 1 character long.`, - 'maxlength': $localize`Username cannot be more than 50 characters long.`, - 'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.` + required: $localize`Username is required.`, + minlength: $localize`Username must be at least 1 character long.`, + maxlength: $localize`Username cannot be more than 50 characters long.`, + pattern: $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.` } } @@ -26,18 +26,18 @@ export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = { Validators.pattern(/^[a-z0-9][a-z0-9._]*$/) ], MESSAGES: { - 'required': $localize`Channel name is required.`, - 'minlength': $localize`Channel name must be at least 1 character long.`, - 'maxlength': $localize`Channel name cannot be more than 50 characters long.`, - 'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.` + required: $localize`Channel name is required.`, + minlength: $localize`Channel name must be at least 1 character long.`, + maxlength: $localize`Channel name cannot be more than 50 characters long.`, + pattern: $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.` } } export const USER_EMAIL_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, Validators.email ], MESSAGES: { - 'required': $localize`Email is required.`, - 'email': $localize`Email must be valid.` + required: $localize`Email is required.`, + email: $localize`Email must be valid.` } } @@ -47,8 +47,8 @@ export const USER_HANDLE_VALIDATOR: BuildFormValidator = { Validators.pattern(/@.+/) ], MESSAGES: { - 'required': $localize`Handle is required.`, - 'pattern': $localize`Handle must be valid (eg. chocobozzz@example.com).` + required: $localize`Handle is required.`, + pattern: $localize`Handle must be valid (eg. chocobozzz@example.com).` } } @@ -57,7 +57,7 @@ export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = { Validators.required ], MESSAGES: { - 'required': $localize`Password is required.` + required: $localize`Password is required.` } } @@ -68,9 +68,9 @@ export const USER_PASSWORD_VALIDATOR: BuildFormValidator = { Validators.maxLength(255) ], MESSAGES: { - 'required': $localize`Password is required.`, - 'minlength': $localize`Password must be at least 6 characters long.`, - 'maxlength': $localize`Password cannot be more than 255 characters long.` + required: $localize`Password is required.`, + minlength: $localize`Password must be at least 6 characters long.`, + maxlength: $localize`Password cannot be more than 255 characters long.` } } @@ -80,37 +80,37 @@ export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = { Validators.maxLength(255) ], MESSAGES: { - 'minlength': $localize`Password must be at least 6 characters long.`, - 'maxlength': $localize`Password cannot be more than 255 characters long.` + minlength: $localize`Password must be at least 6 characters long.`, + maxlength: $localize`Password cannot be more than 255 characters long.` } } export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = { VALIDATORS: [], MESSAGES: { - 'matchPassword': $localize`The new password and the confirmed password do not correspond.` + matchPassword: $localize`The new password and the confirmed password do not correspond.` } } export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, Validators.min(-1) ], MESSAGES: { - 'required': $localize`Video quota is required.`, - 'min': $localize`Quota must be greater than -1.` + required: $localize`Video quota is required.`, + min: $localize`Quota must be greater than -1.` } } export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, Validators.min(-1) ], MESSAGES: { - 'required': $localize`Daily upload limit is required.`, - 'min': $localize`Daily upload limit must be greater than -1.` + required: $localize`Daily upload limit is required.`, + min: $localize`Daily upload limit must be greater than -1.` } } export const USER_ROLE_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`User role is required.` + required: $localize`User role is required.` } } @@ -122,15 +122,15 @@ export const USER_DESCRIPTION_VALIDATOR: BuildFormValidator = { Validators.maxLength(1000) ], MESSAGES: { - 'minlength': $localize`Description must be at least 3 characters long.`, - 'maxlength': $localize`Description cannot be more than 1000 characters long.` + minlength: $localize`Description must be at least 3 characters long.`, + maxlength: $localize`Description cannot be more than 1000 characters long.` } } export const USER_TERMS_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.requiredTrue ], MESSAGES: { - 'required': $localize`You must agree with the instance terms in order to register on it.` + required: $localize`You must agree with the instance terms in order to register on it.` } } @@ -140,8 +140,8 @@ export const USER_BAN_REASON_VALIDATOR: BuildFormValidator = { Validators.maxLength(250) ], MESSAGES: { - 'minlength': $localize`Ban reason must be at least 3 characters long.`, - 'maxlength': $localize`Ban reason cannot be more than 250 characters long.` + minlength: $localize`Ban reason must be at least 3 characters long.`, + maxlength: $localize`Ban reason cannot be more than 250 characters long.` } } @@ -152,9 +152,9 @@ function buildDisplayNameValidator (required: boolean) { Validators.maxLength(120) ], MESSAGES: { - 'required': $localize`Display name is required.`, - 'minlength': $localize`Display name must be at least 1 character long.`, - 'maxlength': $localize`Display name cannot be more than 50 characters long.` + required: $localize`Display name is required.`, + minlength: $localize`Display name must be at least 1 character long.`, + maxlength: $localize`Display name cannot be more than 50 characters long.` } } diff --git a/client/src/app/shared/form-validators/video-block-validators.ts b/client/src/app/shared/form-validators/video-block-validators.ts index d3974aefe..cd2791b76 100644 --- a/client/src/app/shared/form-validators/video-block-validators.ts +++ b/client/src/app/shared/form-validators/video-block-validators.ts @@ -4,7 +4,7 @@ import { BuildFormValidator } from './form-validator.model' export const VIDEO_BLOCK_REASON_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.minLength(2), Validators.maxLength(300) ], MESSAGES: { - 'minlength': $localize`Block reason must be at least 2 characters long.`, - 'maxlength': $localize`Block reason cannot be more than 300 characters long.` + minlength: $localize`Block reason must be at least 2 characters long.`, + maxlength: $localize`Block reason cannot be more than 300 characters long.` } } diff --git a/client/src/app/shared/form-validators/video-captions-validators.ts b/client/src/app/shared/form-validators/video-captions-validators.ts index 9742d2925..a16216422 100644 --- a/client/src/app/shared/form-validators/video-captions-validators.ts +++ b/client/src/app/shared/form-validators/video-captions-validators.ts @@ -4,13 +4,13 @@ import { BuildFormValidator } from './form-validator.model' export const VIDEO_CAPTION_LANGUAGE_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Video caption language is required.` + required: $localize`Video caption language is required.` } } export const VIDEO_CAPTION_FILE_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Video caption file is required.` + required: $localize`Video caption file is required.` } } diff --git a/client/src/app/shared/form-validators/video-channel-validators.ts b/client/src/app/shared/form-validators/video-channel-validators.ts index ba502ed01..48f5b1a2c 100644 --- a/client/src/app/shared/form-validators/video-channel-validators.ts +++ b/client/src/app/shared/form-validators/video-channel-validators.ts @@ -7,10 +7,10 @@ export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = { VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS, MESSAGES: { - 'required': $localize`Name is required.`, - 'minlength': $localize`Name must be at least 1 character long.`, - 'maxlength': $localize`Name cannot be more than 50 characters long.`, - 'pattern': $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.` + required: $localize`Name is required.`, + minlength: $localize`Name must be at least 1 character long.`, + maxlength: $localize`Name cannot be more than 50 characters long.`, + pattern: $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.` } } @@ -21,9 +21,9 @@ export const VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR: BuildFormValidator = { Validators.maxLength(50) ], MESSAGES: { - 'required': $localize`Display name is required.`, - 'minlength': $localize`Display name must be at least 1 character long.`, - 'maxlength': $localize`Display name cannot be more than 50 characters long.` + required: $localize`Display name is required.`, + minlength: $localize`Display name must be at least 1 character long.`, + maxlength: $localize`Display name cannot be more than 50 characters long.` } } @@ -33,8 +33,8 @@ export const VIDEO_CHANNEL_DESCRIPTION_VALIDATOR: BuildFormValidator = { Validators.maxLength(1000) ], MESSAGES: { - 'minlength': $localize`Description must be at least 3 characters long.`, - 'maxlength': $localize`Description cannot be more than 1000 characters long.` + minlength: $localize`Description must be at least 3 characters long.`, + maxlength: $localize`Description cannot be more than 1000 characters long.` } } @@ -44,7 +44,7 @@ export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = { Validators.maxLength(1000) ], MESSAGES: { - 'minlength': $localize`Support text must be at least 3 characters long.`, - 'maxlength': $localize`Support text cannot be more than 1000 characters long` + minlength: $localize`Support text must be at least 3 characters long.`, + maxlength: $localize`Support text cannot be more than 1000 characters long` } } diff --git a/client/src/app/shared/form-validators/video-comment-validators.ts b/client/src/app/shared/form-validators/video-comment-validators.ts index c56564d34..9e8f95e7c 100644 --- a/client/src/app/shared/form-validators/video-comment-validators.ts +++ b/client/src/app/shared/form-validators/video-comment-validators.ts @@ -4,8 +4,8 @@ import { BuildFormValidator } from './form-validator.model' export const VIDEO_COMMENT_TEXT_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ], MESSAGES: { - 'required': $localize`Comment is required.`, - 'minlength': $localize`Comment must be at least 2 characters long.`, - 'maxlength': $localize`Comment cannot be more than 3000 characters long.` + required: $localize`Comment is required.`, + minlength: $localize`Comment must be at least 2 characters long.`, + maxlength: $localize`Comment cannot be more than 3000 characters long.` } } diff --git a/client/src/app/shared/form-validators/video-ownership-change-validators.ts b/client/src/app/shared/form-validators/video-ownership-change-validators.ts index e1a2df8a6..3e7823c49 100644 --- a/client/src/app/shared/form-validators/video-ownership-change-validators.ts +++ b/client/src/app/shared/form-validators/video-ownership-change-validators.ts @@ -4,21 +4,21 @@ import { BuildFormValidator } from './form-validator.model' export const OWNERSHIP_CHANGE_CHANNEL_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`The channel is required.` + required: $localize`The channel is required.` } } export const OWNERSHIP_CHANGE_USERNAME_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, localAccountValidator ], MESSAGES: { - 'required': $localize`The username is required.`, - 'localAccountOnly': $localize`You can only transfer ownership to a local account` + required: $localize`The username is required.`, + localAccountOnly: $localize`You can only transfer ownership to a local account` } } function localAccountValidator (control: AbstractControl): ValidationErrors { if (control.value.includes('@')) { - return { 'localAccountOnly': true } + return { localAccountOnly: true } } return null diff --git a/client/src/app/shared/form-validators/video-playlist-validators.ts b/client/src/app/shared/form-validators/video-playlist-validators.ts index 7e3d29458..63af637a3 100644 --- a/client/src/app/shared/form-validators/video-playlist-validators.ts +++ b/client/src/app/shared/form-validators/video-playlist-validators.ts @@ -9,9 +9,9 @@ export const VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR: BuildFormValidator = { Validators.maxLength(120) ], MESSAGES: { - 'required': $localize`Display name is required.`, - 'minlength': $localize`Display name must be at least 1 character long.`, - 'maxlength': $localize`Display name cannot be more than 120 characters long.` + required: $localize`Display name is required.`, + minlength: $localize`Display name must be at least 1 character long.`, + maxlength: $localize`Display name cannot be more than 120 characters long.` } } @@ -20,7 +20,7 @@ export const VIDEO_PLAYLIST_PRIVACY_VALIDATOR: BuildFormValidator = { Validators.required ], MESSAGES: { - 'required': $localize`Privacy is required.` + required: $localize`Privacy is required.` } } @@ -30,21 +30,21 @@ export const VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR: BuildFormValidator = { Validators.maxLength(1000) ], MESSAGES: { - 'minlength': $localize`Description must be at least 3 characters long.`, - 'maxlength': $localize`Description cannot be more than 1000 characters long.` + minlength: $localize`Description must be at least 3 characters long.`, + maxlength: $localize`Description cannot be more than 1000 characters long.` } } export const VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR: BuildFormValidator = { VALIDATORS: [], MESSAGES: { - 'required': $localize`The channel is required when the playlist is public.` + required: $localize`The channel is required when the playlist is public.` } } export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacy) { if (privacy.toString() === VideoPlaylistPrivacy.PUBLIC.toString()) { - channelControl.setValidators([Validators.required]) + channelControl.setValidators([ Validators.required ]) } else { channelControl.setValidators(null) } diff --git a/client/src/app/shared/form-validators/video-validators.ts b/client/src/app/shared/form-validators/video-validators.ts index 1382a7747..f96189aa2 100644 --- a/client/src/app/shared/form-validators/video-validators.ts +++ b/client/src/app/shared/form-validators/video-validators.ts @@ -12,17 +12,17 @@ export const trimValidator: ValidatorFn = (control: FormControl) => { export const VIDEO_NAME_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ], MESSAGES: { - 'required': $localize`Video name is required.`, - 'minlength': $localize`Video name must be at least 3 characters long.`, - 'maxlength': $localize`Video name cannot be more than 120 characters long.`, - 'spaces': $localize`Video name has leading or trailing whitespace.` + required: $localize`Video name is required.`, + minlength: $localize`Video name must be at least 3 characters long.`, + maxlength: $localize`Video name cannot be more than 120 characters long.`, + spaces: $localize`Video name has leading or trailing whitespace.` } } export const VIDEO_PRIVACY_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Video privacy is required.` + required: $localize`Video privacy is required.` } } @@ -49,46 +49,46 @@ export const VIDEO_IMAGE_VALIDATOR: BuildFormValidator = { export const VIDEO_CHANNEL_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.required ], MESSAGES: { - 'required': $localize`Video channel is required.` + required: $localize`Video channel is required.` } } export const VIDEO_DESCRIPTION_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ], MESSAGES: { - 'minlength': $localize`Video description must be at least 3 characters long.`, - 'maxlength': $localize`Video description cannot be more than 10000 characters long.` + minlength: $localize`Video description must be at least 3 characters long.`, + maxlength: $localize`Video description cannot be more than 10000 characters long.` } } export const VIDEO_TAG_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ], MESSAGES: { - 'minlength': $localize`A tag should be more than 2 characters long.`, - 'maxlength': $localize`A tag should be less than 30 characters long.` + minlength: $localize`A tag should be more than 2 characters long.`, + maxlength: $localize`A tag should be less than 30 characters long.` } } export const VIDEO_TAGS_ARRAY_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.maxLength(5), arrayTagLengthValidator() ], MESSAGES: { - 'maxlength': $localize`A maximum of 5 tags can be used on a video.`, - 'arrayTagLength': $localize`A tag should be more than 1 and less than 30 characters long.` + maxlength: $localize`A maximum of 5 tags can be used on a video.`, + arrayTagLength: $localize`A tag should be more than 1 and less than 30 characters long.` } } export const VIDEO_SUPPORT_VALIDATOR: BuildFormValidator = { VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ], MESSAGES: { - 'minlength': $localize`Video support must be at least 3 characters long.`, - 'maxlength': $localize`Video support cannot be more than 1000 characters long.` + minlength: $localize`Video support must be at least 3 characters long.`, + maxlength: $localize`Video support cannot be more than 1000 characters long.` } } export const VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR: BuildFormValidator = { VALIDATORS: [ ], MESSAGES: { - 'required': $localize`A date is required to schedule video update.` + required: $localize`A date is required to schedule video update.` } } @@ -105,6 +105,6 @@ function arrayTagLengthValidator (min = 2, max = 30): ValidatorFn { return null } - return { 'arrayTagLength': true } + return { arrayTagLength: true } } } -- cgit v1.2.3