diff --git a/src/cli/dev.ts b/src/cli/dev.ts index fa90aaf43..5643f9322 100644 --- a/src/cli/dev.ts +++ b/src/cli/dev.ts @@ -10,7 +10,7 @@ import { buildModule, loadModule } from "./build"; import { RootCmd } from "./root"; import { K8s, kind } from "kubernetes-fluent-client"; import { Store } from "../lib/k8s"; -export default function (program: RootCmd) { +export default function (program: RootCmd): void { program .command("dev") .description("Setup a local webhook development environment") @@ -55,7 +55,7 @@ export default function (program: RootCmd) { const store = `pepr-${cfg.pepr.uuid}-store`; // Run the processed javascript file - const runFork = async () => { + const runFork = async (): Promise => { console.info(`Running module ${path}`); // Deploy the webhook with a 30 second timeout for debugging, don't force diff --git a/src/cli/format.ts b/src/cli/format.ts index 268921159..204942593 100644 --- a/src/cli/format.ts +++ b/src/cli/format.ts @@ -7,7 +7,7 @@ import { format, resolveConfig } from "prettier"; import { RootCmd } from "./root"; -export default function (program: RootCmd) { +export default function (program: RootCmd): void { program .command("format") .description("Lint and format this Pepr module") @@ -28,7 +28,7 @@ export default function (program: RootCmd) { * @param validateOnly * @returns success */ -export async function peprFormat(validateOnly: boolean) { +export async function peprFormat(validateOnly: boolean): Promise { { try { const eslint = new ESLint(); diff --git a/src/cli/init/index.ts b/src/cli/init/index.ts index eadad7bd1..ed834f94b 100644 --- a/src/cli/init/index.ts +++ b/src/cli/init/index.ts @@ -23,7 +23,7 @@ import { createDir, sanitizeName, write } from "./utils"; import { confirm, PromptOptions, walkthrough } from "./walkthrough"; import { ErrorList, Errors } from "../../lib/errors"; -export default function (program: RootCmd) { +export default function (program: RootCmd): void { let response = {} as PromptOptions; let pkgOverride = ""; program diff --git a/src/cli/init/utils.ts b/src/cli/init/utils.ts index 9fdae1401..b9e0e9d1e 100644 --- a/src/cli/init/utils.ts +++ b/src/cli/init/utils.ts @@ -9,7 +9,7 @@ import { promises as fs } from "fs"; * @param name the user input name * @returns the sanitized name */ -export function sanitizeName(name: string) { +export function sanitizeName(name: string): string { if (typeof name !== "string") { throw TypeError( `sanitizeName() was called with a non-string value. The value is: ${name} of type ${typeof name}`, @@ -32,7 +32,7 @@ export function sanitizeName(name: string) { * * @param dir - The directory to create */ -export async function createDir(dir: string) { +export async function createDir(dir: string): Promise { try { await fs.mkdir(dir); } catch (err) { @@ -51,7 +51,7 @@ export async function createDir(dir: string) { * @param data - The data to write * @returns A promise that resolves when the file has been written */ -export function write(path: string, data: unknown) { +export function write(path: string, data: unknown): Promise { // If the data is not a string, stringify it if (typeof data !== "string") { data = JSON.stringify(data, null, 2); diff --git a/src/lib/assets/deploy.ts b/src/lib/assets/deploy.ts index 884d07988..5316d5652 100644 --- a/src/lib/assets/deploy.ts +++ b/src/lib/assets/deploy.ts @@ -15,7 +15,7 @@ import { peprStoreCRD } from "./store"; import { webhookConfig } from "./webhooks"; import { CapabilityExport, ImagePullSecret } from "../types"; -export async function deployImagePullSecret(imagePullSecret: ImagePullSecret, name: string) { +export async function deployImagePullSecret(imagePullSecret: ImagePullSecret, name: string): Promise { try { await K8s(kind.Namespace).Get("pepr-system"); } catch { @@ -42,7 +42,7 @@ export async function deployImagePullSecret(imagePullSecret: ImagePullSecret, na Log.error(e); } } -export async function deploy(assets: Assets, force: boolean, webhookTimeout?: number) { +export async function deploy(assets: Assets, force: boolean, webhookTimeout?: number): Promise { Log.info("Establishing connection to Kubernetes"); const { name, host, path } = assets; @@ -95,7 +95,7 @@ async function setupRBAC( capabilities: CapabilityExport[], force: boolean, config: { rbacMode?: string; rbac?: PolicyRule[] }, -) { +): Promise { const { rbacMode, rbac } = config; Log.info("Applying cluster role binding"); @@ -119,7 +119,7 @@ async function setupRBAC( await K8s(kind.RoleBinding).Apply(roleBinding, { force }); } -async function setupController(assets: Assets, code: Buffer, hash: string, force: boolean) { +async function setupController(assets: Assets, code: Buffer, hash: string, force: boolean): Promise { const { name } = assets; Log.info("Applying module secret"); @@ -144,7 +144,7 @@ async function setupController(assets: Assets, code: Buffer, hash: string, force } // Setup the watcher deployment and service -async function setupWatcher(assets: Assets, hash: string, force: boolean) { +async function setupWatcher(assets: Assets, hash: string, force: boolean): Promise { // If the module has a watcher, deploy it const watchDeployment = getWatcher(assets, hash, assets.buildTimestamp); if (watchDeployment) {