From 0174ac8109065f4637e51b13cdd5e90cd01e981b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 20 May 2020 08:54:54 +0200 Subject: [PATCH] Ran prettier again --- .../catalog-backend/src/catalog/StaticItemsCatalog.ts | 2 +- plugins/catalog-backend/src/database/Database.ts | 10 +++++----- .../src/database/migrations/20200511113813_init.ts | 4 ++-- plugins/catalog-backend/src/run.ts | 2 +- plugins/catalog-backend/src/util/runPeriodically.ts | 4 ++-- .../src/validation/KubernetesValidatorFunctions.ts | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/catalog-backend/src/catalog/StaticItemsCatalog.ts b/plugins/catalog-backend/src/catalog/StaticItemsCatalog.ts index 0544ea9ba8..30b5f554c0 100644 --- a/plugins/catalog-backend/src/catalog/StaticItemsCatalog.ts +++ b/plugins/catalog-backend/src/catalog/StaticItemsCatalog.ts @@ -29,7 +29,7 @@ export class StaticItemsCatalog implements ItemsCatalog { } async component(name: string): Promise { - const item = this._components.find((i) => i.name === name); + const item = this._components.find(i => i.name === name); if (!item) { throw new NotFoundError(`Found no component with name ${name}`); } diff --git a/plugins/catalog-backend/src/database/Database.ts b/plugins/catalog-backend/src/database/Database.ts index 19fdd38ff0..424345a5c9 100644 --- a/plugins/catalog-backend/src/database/Database.ts +++ b/plugins/catalog-backend/src/database/Database.ts @@ -28,7 +28,7 @@ export class Database { constructor(private readonly database: Knex) {} async addOrUpdateComponent(component: AddDatabaseComponent): Promise { - await this.database.transaction(async (tx) => { + await this.database.transaction(async tx => { // TODO(freben): Currently, several locations can compete for the same component // TODO(freben): If locationId is unset in the input, it won't be overwritten - should we instead replace with null? const count = await tx('components') @@ -60,7 +60,7 @@ export class Database { } async addLocation(location: AddDatabaseLocation): Promise { - return await this.database.transaction(async (tx) => { + return await this.database.transaction(async tx => { const existingLocation = await tx('locations') .where({ target: location.target, @@ -79,9 +79,9 @@ export class Database { target, }); - return ( - await tx('locations').where({ id }).select() - )![0]; + return (await tx('locations') + .where({ id }) + .select())![0]; }); } diff --git a/plugins/catalog-backend/src/database/migrations/20200511113813_init.ts b/plugins/catalog-backend/src/database/migrations/20200511113813_init.ts index 4c71fefddd..ae45ad3ddb 100644 --- a/plugins/catalog-backend/src/database/migrations/20200511113813_init.ts +++ b/plugins/catalog-backend/src/database/migrations/20200511113813_init.ts @@ -18,7 +18,7 @@ import * as Knex from 'knex'; export async function up(knex: Knex): Promise { return knex.schema - .createTable('locations', (table) => { + .createTable('locations', table => { table.comment( 'Registered locations that shall be contiuously scanned for catalog item updates', ); @@ -29,7 +29,7 @@ export async function up(knex: Knex): Promise { .notNullable() .comment('The actual target of the location'); }) - .createTable('components', (table) => { + .createTable('components', table => { table.comment('All components currently stored in the catalog'); table.uuid('id').primary().comment('Auto-generated ID of the component'); table diff --git a/plugins/catalog-backend/src/run.ts b/plugins/catalog-backend/src/run.ts index 9c086081a7..f4845168aa 100644 --- a/plugins/catalog-backend/src/run.ts +++ b/plugins/catalog-backend/src/run.ts @@ -22,7 +22,7 @@ const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 3003; const enableCors = yn(process.env.PLUGIN_CORS, { default: false }); const logger = getRootLogger(); -startStandaloneServer({ port, enableCors, logger }).catch((err) => { +startStandaloneServer({ port, enableCors, logger }).catch(err => { logger.error(err); process.exit(1); }); diff --git a/plugins/catalog-backend/src/util/runPeriodically.ts b/plugins/catalog-backend/src/util/runPeriodically.ts index 2d02287540..2f65d0e6f3 100644 --- a/plugins/catalog-backend/src/util/runPeriodically.ts +++ b/plugins/catalog-backend/src/util/runPeriodically.ts @@ -27,7 +27,7 @@ export function runPeriodically(fn: () => any, delayMs: number): () => void { let cancel: () => void; let cancelled = false; - const cancellationPromise = new Promise((resolve) => { + const cancellationPromise = new Promise(resolve => { cancel = () => { resolve(); cancelled = true; @@ -43,7 +43,7 @@ export function runPeriodically(fn: () => any, delayMs: number): () => void { } await Promise.race([ - new Promise((resolve) => setTimeout(resolve, delayMs)), + new Promise(resolve => setTimeout(resolve, delayMs)), cancellationPromise, ]); } diff --git a/plugins/catalog-backend/src/validation/KubernetesValidatorFunctions.ts b/plugins/catalog-backend/src/validation/KubernetesValidatorFunctions.ts index af3158fbad..dff3216969 100644 --- a/plugins/catalog-backend/src/validation/KubernetesValidatorFunctions.ts +++ b/plugins/catalog-backend/src/validation/KubernetesValidatorFunctions.ts @@ -30,7 +30,7 @@ export class KubernetesValidatorFunctions { value, '/', CommonValidatorFunctions.isValidDnsSubdomain, - (n) => n.length >= 1 && n.length <= 63 && /^[a-z0-9A-Z]+$/.test(n), + n => n.length >= 1 && n.length <= 63 && /^[a-z0-9A-Z]+$/.test(n), ); }