From 2e06842be88189ed09022d491796961355334d58 Mon Sep 17 00:00:00 2001 From: Amir Moualem Date: Sun, 28 Jun 2020 17:10:50 +0300 Subject: [PATCH 1/2] chore: remove async/await from a synchronous function validateMonitorPath used to use an async flow and await on it. that's no longer the case and the function no longer needs to be async. --- src/cli/commands/monitor/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/commands/monitor/index.ts b/src/cli/commands/monitor/index.ts index ea96fe137b4..446497a526a 100644 --- a/src/cli/commands/monitor/index.ts +++ b/src/cli/commands/monitor/index.ts @@ -117,7 +117,7 @@ async function monitor(...args0: MethodArgs): Promise { for (const path of args as string[]) { debug(`Processing ${path}...`); try { - await validateMonitorPath(path, options.docker); + validateMonitorPath(path, options.docker); let analysisType = 'all'; let packageManager; if (options.allProjects) { @@ -302,7 +302,7 @@ function generateMonitorMeta(options, packageManager?): MonitorMeta { }; } -async function validateMonitorPath(path, isDocker) { +function validateMonitorPath(path, isDocker) { const exists = fs.existsSync(path); if (!exists && !isDocker) { throw new Error('"' + path + '" is not a valid path for "snyk monitor"'); From c6007a20254bd92c84dfdd82fece6207c0f106be Mon Sep 17 00:00:00 2001 From: Amir Moualem Date: Sun, 28 Jun 2020 17:12:21 +0300 Subject: [PATCH 2/2] chore: adding types --- src/cli/commands/monitor/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/commands/monitor/index.ts b/src/cli/commands/monitor/index.ts index 446497a526a..723195b89eb 100644 --- a/src/cli/commands/monitor/index.ts +++ b/src/cli/commands/monitor/index.ts @@ -302,7 +302,7 @@ function generateMonitorMeta(options, packageManager?): MonitorMeta { }; } -function validateMonitorPath(path, isDocker) { +function validateMonitorPath(path: string, isDocker?: boolean): void { const exists = fs.existsSync(path); if (!exists && !isDocker) { throw new Error('"' + path + '" is not a valid path for "snyk monitor"');