From 3136748f72a6619a295db3a602b7510ff1ef2345 Mon Sep 17 00:00:00 2001 From: "bobo.yang" Date: Wed, 31 May 2023 16:10:53 +0800 Subject: [PATCH] Update ESLint rules and error handling - Remove "no-unused-vars" and "no-unused-expressions" from .eslintrc.json. - Simplify error handling in devchat.ts by returning stderr directly. - Remove "noUnusedLocals" and "noUnusedParameters" from tsconfig.json. --- .eslintrc.json | 2 -- src/toolwrapper/devchat.ts | 3 +-- tsconfig.json | 4 +--- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9fccfec..f9b22b7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,8 +9,6 @@ "@typescript-eslint" ], "rules": { - "no-unused-vars": "warn", - "no-unused-expressions": "warn", "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", "curly": "warn", diff --git a/src/toolwrapper/devchat.ts b/src/toolwrapper/devchat.ts index a4e6469..f458f6b 100644 --- a/src/toolwrapper/devchat.ts +++ b/src/toolwrapper/devchat.ts @@ -208,12 +208,11 @@ class DevChat { const { exitCode: code, stdout, stderr } = await this.commandRun.spawnAsync(devChat, args, spawnAsyncOptions, onStdoutPartial, undefined, undefined, undefined); if (stderr) { - const errorMessage = stderr.trim().match(/Error:(.+)/)?.[1]; return { "prompt-hash": "", user: "", date: "", - response: errorMessage ? `Error: ${errorMessage}` : "Unknown error", + response: stderr, isError: true, }; } diff --git a/tsconfig.json b/tsconfig.json index 6795f85..525d19d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,9 +12,7 @@ "rootDir": "src", "strict": true, "jsx": "react", - "esModuleInterop": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "esModuleInterop": true }, "exclude": ["test"] } \ No newline at end of file