From 8fcbc8ee1d37fbbc27651d4f290a5a2e8895989a Mon Sep 17 00:00:00 2001 From: Sam Therapy Date: Sat, 11 Jun 2022 14:15:15 +0200 Subject: [PATCH] Lint more Signed-off-by: Sam Therapy --- src/getLocalImage.ts | 4 ++-- src/getRemoteImage.ts | 4 ++-- src/helpers/{cli.ts => args.ts} | 0 src/helpers/{error.ts => crashHandler.ts} | 2 +- src/helpers/{config.ts => getConfig.ts} | 7 +++---- src/index.ts | 2 +- src/postImage.ts | 4 ++-- 7 files changed, 11 insertions(+), 12 deletions(-) rename src/helpers/{cli.ts => args.ts} (100%) rename src/helpers/{error.ts => crashHandler.ts} (94%) rename src/helpers/{config.ts => getConfig.ts} (88%) diff --git a/src/getLocalImage.ts b/src/getLocalImage.ts index 24d950b..9d9f040 100644 --- a/src/getLocalImage.ts +++ b/src/getLocalImage.ts @@ -1,8 +1,8 @@ import { createReadStream, ReadStream } from "fs"; import { readdir } from "fs/promises"; import { exit } from "process"; -import args from "./helpers/cli.js"; -import crashHandler from "./helpers/error.js"; +import args from "./helpers/args.js"; +import crashHandler from "./helpers/crashHandler.js"; import { config } from "./helpers/types.js"; import postImage from "./postImage.js"; diff --git a/src/getRemoteImage.ts b/src/getRemoteImage.ts index 69de25d..194771b 100644 --- a/src/getRemoteImage.ts +++ b/src/getRemoteImage.ts @@ -6,8 +6,8 @@ import got from "got-cjs"; import stream from "node:stream"; import { promisify } from "node:util"; import { exit } from "process"; -import args from "./helpers/cli.js"; -import crashHandler from "./helpers/error.js"; +import args from "./helpers/args.js"; +import crashHandler from "./helpers/crashHandler.js"; import { config } from "./helpers/types.js"; import postImage from "./postImage.js"; diff --git a/src/helpers/cli.ts b/src/helpers/args.ts similarity index 100% rename from src/helpers/cli.ts rename to src/helpers/args.ts diff --git a/src/helpers/error.ts b/src/helpers/crashHandler.ts similarity index 94% rename from src/helpers/error.ts rename to src/helpers/crashHandler.ts index c08a318..81235f7 100644 --- a/src/helpers/error.ts +++ b/src/helpers/crashHandler.ts @@ -1,5 +1,5 @@ import { exit } from "process"; -import args from "./cli.js"; +import args from "./args.js"; /** * The function that gets called when the program runs into an error. diff --git a/src/helpers/config.ts b/src/helpers/getConfig.ts similarity index 88% rename from src/helpers/config.ts rename to src/helpers/getConfig.ts index 3a15f82..e27139c 100644 --- a/src/helpers/config.ts +++ b/src/helpers/getConfig.ts @@ -1,7 +1,7 @@ import { readFile } from "fs/promises"; import stripJsonComments from "strip-json-comments"; -import args from "./cli.js"; -import crashHandler from "./error.js"; +import args from "./args.js"; +import crashHandler from "./crashHandler.js"; import { config } from "./types.js"; /** @@ -9,11 +9,10 @@ import { config } from "./types.js"; * @returns The config object */ async function readConfig(): Promise { - const conf = await readFile(args.config, "utf8").catch((err) => { + return readFile(args.config, "utf8").catch((err) => { crashHandler("Error reading config file.", err); return "CRASH"; }); - return conf; } /** * Parses the config file and returns it as a JSON object diff --git a/src/index.ts b/src/index.ts index d98a928..d19c9f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import getConfig from "./helpers/config.js"; +import getConfig from "./helpers/getConfig.js"; import { config } from "./helpers/types.js"; import getLocalImage from "./getLocalImage.js"; import getRemoteImage from "./getRemoteImage.js"; diff --git a/src/postImage.ts b/src/postImage.ts index 47a0ed8..118956f 100644 --- a/src/postImage.ts +++ b/src/postImage.ts @@ -1,8 +1,8 @@ import { ReadStream } from "fs"; import generator, { Entity, Response } from "megalodon"; import { Readable } from "stream"; -import args from "./helpers/cli.js"; -import crashHandler from "./helpers/error.js"; +import args from "./helpers/args.js"; +import crashHandler from "./helpers/crashHandler.js"; import { config } from "./helpers/types.js"; /**