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.
This commit is contained in:
bobo.yang 2023-05-31 16:10:53 +08:00
parent ba097eab26
commit 3136748f72
3 changed files with 2 additions and 7 deletions

View File

@ -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",

View File

@ -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,
};
}

View File

@ -12,9 +12,7 @@
"rootDir": "src",
"strict": true,
"jsx": "react",
"esModuleInterop": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true
},
"exclude": ["test"]
}