From 0d7502e4713be94cd8299101adf7cdd297d0bc03 Mon Sep 17 00:00:00 2001 From: "Jae Lo Presti (DN0)" Date: Wed, 19 Apr 2023 20:25:44 +0300 Subject: [PATCH] src: fixing linting part 1 --- knexfile.ts | 2 +- migrations/20230419111959_setup_base_db.ts | 5 ++--- migrations/20230419134314_add_servers_table.ts | 8 ++++---- migrations/20230419152153_add_perms_table.ts | 8 ++++---- src/index.ts | 6 ++++-- src/routes/root.ts | 2 +- src/utils/configUtils.ts | 6 ++++-- src/utils/dbUtils.ts | 4 ++-- src/utils/dockerUtils.ts | 1 + src/utils/imageUtils.ts | 1 + 10 files changed, 24 insertions(+), 19 deletions(-) diff --git a/knexfile.ts b/knexfile.ts index 3609b00..288ae1f 100644 --- a/knexfile.ts +++ b/knexfile.ts @@ -20,4 +20,4 @@ const config: { [key: string]: Knex.Config } = { }; -module.exports = config; +module.exports = config; // eslint-disable-line diff --git a/migrations/20230419111959_setup_base_db.ts b/migrations/20230419111959_setup_base_db.ts index 74b9449..2b7fa4c 100644 --- a/migrations/20230419111959_setup_base_db.ts +++ b/migrations/20230419111959_setup_base_db.ts @@ -1,7 +1,8 @@ import {Knex} from "knex"; + import {SCHEMA_NAME} from "../src/environment"; -export async function up(knex: Knex): Promise { +export async function up(knex: Readonly): Promise { await knex.schema.createSchemaIfNotExists(SCHEMA_NAME); await knex.schema.withSchema(SCHEMA_NAME).createTable('images', (table) => { @@ -24,8 +25,6 @@ export async function up(knex: Knex): Promise { }); } - export function down(): void { return; } - diff --git a/migrations/20230419134314_add_servers_table.ts b/migrations/20230419134314_add_servers_table.ts index b1dac62..c52e4c9 100644 --- a/migrations/20230419134314_add_servers_table.ts +++ b/migrations/20230419134314_add_servers_table.ts @@ -1,8 +1,9 @@ import { Knex } from "knex"; + import {SCHEMA_NAME} from "../src/environment"; -export async function up(knex: Knex): Promise { +export async function up(knex: Readonly): Promise { await knex.schema.withSchema(SCHEMA_NAME).createTable('servers', (table) => { table .uuid('id') @@ -28,7 +29,6 @@ export async function up(knex: Knex): Promise { }); } - -export async function down(knex: Knex): Promise { +export function down(): void { + return; } - diff --git a/migrations/20230419152153_add_perms_table.ts b/migrations/20230419152153_add_perms_table.ts index e2dc9dc..92c6a48 100644 --- a/migrations/20230419152153_add_perms_table.ts +++ b/migrations/20230419152153_add_perms_table.ts @@ -1,8 +1,9 @@ import { Knex } from "knex"; + import { SCHEMA_NAME } from "../src/environment"; -export async function up(knex: Knex): Promise { +export async function up(knex: Readonly): Promise { await knex.schema.withSchema(SCHEMA_NAME).createTable('neos_permissions', (table) => { table .uuid('id') @@ -21,7 +22,6 @@ export async function up(knex: Knex): Promise { }); } - -export async function down(knex: Knex): Promise { +export function down(): void { + return; } - diff --git a/src/index.ts b/src/index.ts index eb444d9..6a25f2e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,9 @@ -import fastify from 'fastify'; +import { join } from 'path'; + import autoLoad from '@fastify/autoload'; +import fastify from 'fastify'; + import {HOST, PRODUCTION } from "./environment"; -import { join } from 'path'; import {generateLogger} from "./utils/loggerUtils"; const log = generateLogger('index.ts'); diff --git a/src/routes/root.ts b/src/routes/root.ts index 753576c..f1fd14e 100644 --- a/src/routes/root.ts +++ b/src/routes/root.ts @@ -2,7 +2,7 @@ import {FastifyPluginCallback} from "fastify"; const plugin: FastifyPluginCallback = (fastify, opts, next): void => { fastify.get("/", async(request, reply) => { - reply.type('application/json').send({"status": "ok"}); + await reply.type('application/json').send({"status": "ok"}); }); next(); diff --git a/src/utils/configUtils.ts b/src/utils/configUtils.ts index 0b25d82..ba06287 100644 --- a/src/utils/configUtils.ts +++ b/src/utils/configUtils.ts @@ -1,10 +1,12 @@ -import {TGenericBaseConfig} from "../types/genericConfig"; import * as fs from "fs"; + +import {TGenericBaseConfig} from "../types/genericConfig"; + import {generateLogger} from "./loggerUtils"; const log = generateLogger(('configUtils.ts')); -export const outputConfigFile = (config: TGenericBaseConfig, outputPath: string): void => { +export const outputConfigFile = (config: Readonly, outputPath: string): void => { fs.writeFile(outputPath, JSON.stringify(config), (e) => { log.error(e); }) diff --git a/src/utils/dbUtils.ts b/src/utils/dbUtils.ts index a960b08..6451d6e 100644 --- a/src/utils/dbUtils.ts +++ b/src/utils/dbUtils.ts @@ -1,9 +1,9 @@ -import knex, { Knex } from "knex"; import * as dotenv from 'dotenv'; +import knex, { Knex } from "knex"; dotenv.config(); -let db: Knex; +let db: Knex; // eslint-disable-line export const dbConn = (): Knex => { if (!db) { diff --git a/src/utils/dockerUtils.ts b/src/utils/dockerUtils.ts index 715ab7d..4c7bb9c 100644 --- a/src/utils/dockerUtils.ts +++ b/src/utils/dockerUtils.ts @@ -1,4 +1,5 @@ import * as Dockerode from "dockerode"; + import {generateLogger} from "./loggerUtils"; const dockerDaemon = new Dockerode(); diff --git a/src/utils/imageUtils.ts b/src/utils/imageUtils.ts index b1148c0..7eec080 100644 --- a/src/utils/imageUtils.ts +++ b/src/utils/imageUtils.ts @@ -1,4 +1,5 @@ import {ImageTable} from "../types/dbTypes"; + import {dbConn} from "./dbUtils"; export const fetchImages = async (): Promise => { -- 2.45.2