From 967844d276cb6dacf0913deca9d833dba6f4c187 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Fri, 23 Feb 2024 14:55:45 +0700
Subject: [PATCH] fix: lint errors

---
 e2e/utils.ts                                            | 2 +-
 helpers/index.ts                                        | 8 ++++----
 helpers/python.ts                                       | 2 +-
 helpers/run-app.ts                                      | 2 +-
 helpers/tools.ts                                        | 2 +-
 questions.ts                                            | 8 ++++----
 templates/components/vectordbs/typescript/none/index.ts | 2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/e2e/utils.ts b/e2e/utils.ts
index 2ec35e40..87a6df8e 100644
--- a/e2e/utils.ts
+++ b/e2e/utils.ts
@@ -121,7 +121,7 @@ export async function runCreateLlama(
     "none",
   ].join(" ");
   console.log(`running command '${command}' in ${cwd}`);
-  let appProcess = exec(command, {
+  const appProcess = exec(command, {
     cwd,
     env: {
       ...process.env,
diff --git a/helpers/index.ts b/helpers/index.ts
index 70a11244..21d9f86a 100644
--- a/helpers/index.ts
+++ b/helpers/index.ts
@@ -70,7 +70,7 @@ const createEnvLocalFile = async (
 
   switch (opts?.dataSource?.type) {
     case "web": {
-      let webConfig = opts?.dataSource.config as WebSourceConfig;
+      const webConfig = opts?.dataSource.config as WebSourceConfig;
       content += `# web loader config\n`;
       content += `BASE_URL=${webConfig.baseUrl}\n`;
       content += `URL_PREFIX=${webConfig.baseUrl}\n`;
@@ -102,7 +102,7 @@ const generateContextData = async (
     if (framework === "fastapi") {
       if (hasOpenAiKey && !hasVectorDb && isHavingPoetryLockFile()) {
         console.log(`Running ${runGenerate} to generate the context data.`);
-        let result = tryPoetryRun("python app/engine/generate.py");
+        const result = tryPoetryRun("python app/engine/generate.py");
         if (!result) {
           console.log(`Failed to run ${runGenerate}.`);
           process.exit(1);
@@ -134,7 +134,7 @@ const copyContextData = async (
 ) => {
   const destPath = path.join(root, "data");
 
-  let dataSourceConfig = dataSource?.config as FileSourceConfig;
+  const dataSourceConfig = dataSource?.config as FileSourceConfig;
 
   // Copy file
   if (dataSource?.type === "file") {
@@ -154,7 +154,7 @@ const copyContextData = async (
 
   // Copy folder
   if (dataSource?.type === "folder") {
-    let srcPath =
+    const srcPath =
       dataSourceConfig.path ?? path.join(templatesDir, "components", "data");
     console.log(`\nCopying data to ${cyan(destPath)}\n`);
     await copy("**", destPath, {
diff --git a/helpers/python.ts b/helpers/python.ts
index 39be2f32..8047d523 100644
--- a/helpers/python.ts
+++ b/helpers/python.ts
@@ -244,7 +244,7 @@ export const installPythonTemplate = async ({
 
     const dataSourceType = dataSource?.type;
     if (dataSourceType !== undefined && dataSourceType !== "none") {
-      let loaderPath =
+      const loaderPath =
         dataSourceType === "folder"
           ? path.join(compPath, "loaders", "python", "file")
           : path.join(compPath, "loaders", "python", dataSourceType);
diff --git a/helpers/run-app.ts b/helpers/run-app.ts
index dbadda0b..616787a7 100644
--- a/helpers/run-app.ts
+++ b/helpers/run-app.ts
@@ -33,7 +33,7 @@ export async function runApp(
 ): Promise<any> {
   let backendAppProcess: ChildProcess;
   let frontendAppProcess: ChildProcess | undefined;
-  let frontendPort = port || 3000;
+  const frontendPort = port || 3000;
   let backendPort = externalPort || 8000;
 
   // Callback to kill app processes
diff --git a/helpers/tools.ts b/helpers/tools.ts
index f7b844cb..49559253 100644
--- a/helpers/tools.ts
+++ b/helpers/tools.ts
@@ -45,7 +45,7 @@ export const getTool = (toolName: string): Tool | undefined => {
 };
 
 export const getTools = (toolsName: string[]): Tool[] => {
-  let tools: Tool[] = [];
+  const tools: Tool[] = [];
   for (const toolName of toolsName) {
     const tool = getTool(toolName);
     if (!tool) {
diff --git a/questions.ts b/questions.ts
index c6bf438b..395773cd 100644
--- a/questions.ts
+++ b/questions.ts
@@ -108,7 +108,7 @@ const getVectorDbChoices = (framework: TemplateFramework) => {
 };
 
 const getDataSourceChoices = (framework: TemplateFramework) => {
-  let choices = [
+  const choices = [
     {
       title: "No data, just a simple chat",
       value: "simple",
@@ -159,7 +159,7 @@ const selectLocalContextData = async (type: TemplateDataSourceType) => {
     }
     selectedPath = execSync(execScript, execOpts).toString().trim();
     if (type === "file") {
-      let fileType = path.extname(selectedPath);
+      const fileType = path.extname(selectedPath);
       if (!supportedContextFileTypes.includes(fileType)) {
         console.log(
           red(
@@ -204,7 +204,7 @@ export const askQuestions = async (
       if (ciInfo.isCI) {
         program.postInstallAction = getPrefOrDefault("postInstallAction");
       } else {
-        let actionChoices = [
+        const actionChoices = [
           {
             title: "Just generate code (~1 sec)",
             value: "none",
@@ -535,7 +535,7 @@ export const askQuestions = async (
       if (!baseUrl.includes("://")) {
         baseUrl = `https://${baseUrl}`;
       }
-      let checkUrl = new URL(baseUrl);
+      const checkUrl = new URL(baseUrl);
       if (checkUrl.protocol !== "https:" && checkUrl.protocol !== "http:") {
         throw new Error("Invalid protocol");
       }
diff --git a/templates/components/vectordbs/typescript/none/index.ts b/templates/components/vectordbs/typescript/none/index.ts
index c3b65ce2..e335446c 100644
--- a/templates/components/vectordbs/typescript/none/index.ts
+++ b/templates/components/vectordbs/typescript/none/index.ts
@@ -14,7 +14,7 @@ async function getDataSource(llm: LLM) {
     chunkSize: CHUNK_SIZE,
     chunkOverlap: CHUNK_OVERLAP,
   });
-  let storageContext = await storageContextFromDefaults({
+  const storageContext = await storageContextFromDefaults({
     persistDir: `${STORAGE_CACHE_DIR}`,
   });
 
-- 
GitLab