mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-05-01 06:36:23 +08:00
lint: enforce exhaustive switches
This commit is contained in:
@@ -65,6 +65,10 @@
|
||||
"typescript/no-unnecessary-type-parameters": "error",
|
||||
"typescript/no-unsafe-type-assertion": "off",
|
||||
"typescript/no-useless-default-assignment": "error",
|
||||
"typescript/switch-exhaustiveness-check": [
|
||||
"error",
|
||||
{ "considerDefaultExhaustiveForUnions": true }
|
||||
],
|
||||
"typescript/prefer-return-this-type": "error",
|
||||
"typescript/prefer-find": "error",
|
||||
"typescript/prefer-function-type": "error",
|
||||
|
||||
@@ -648,6 +648,11 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
||||
case "diagnostic.heartbeat":
|
||||
recordHeartbeat(evt);
|
||||
return;
|
||||
case "tool.loop":
|
||||
case "diagnostic.memory.sample":
|
||||
case "diagnostic.memory.pressure":
|
||||
case "payload.large":
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.logger.error(
|
||||
|
||||
@@ -267,6 +267,8 @@ function scoreClaimMatch(params: {
|
||||
case "unknown":
|
||||
score -= 4;
|
||||
break;
|
||||
case undefined:
|
||||
break;
|
||||
}
|
||||
score += isClaimContestedStatus(params.status) ? -6 : 4;
|
||||
return score;
|
||||
|
||||
@@ -229,6 +229,10 @@ export function processEvent(ctx: EventContext, event: NormalizedEvent): void {
|
||||
transitionState(call, "listening");
|
||||
break;
|
||||
|
||||
case "call.silence":
|
||||
case "call.dtmf":
|
||||
break;
|
||||
|
||||
case "call.ended":
|
||||
finalizeCall({
|
||||
ctx,
|
||||
|
||||
@@ -233,6 +233,10 @@ export class MediaStreamHandler {
|
||||
session = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case "clear":
|
||||
case "mark":
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[MediaStream] Error processing message:", error);
|
||||
|
||||
@@ -192,6 +192,8 @@ export function resolveGoogleGemini3ThinkingLevel(params: {
|
||||
case "max":
|
||||
case "xhigh":
|
||||
return "HIGH";
|
||||
case undefined:
|
||||
break;
|
||||
}
|
||||
if (typeof params.thinkingBudget === "number") {
|
||||
return params.thinkingBudget <= 2048 ? "LOW" : "HIGH";
|
||||
@@ -214,6 +216,8 @@ export function resolveGoogleGemini3ThinkingLevel(params: {
|
||||
case "max":
|
||||
case "xhigh":
|
||||
return "HIGH";
|
||||
case undefined:
|
||||
break;
|
||||
}
|
||||
if (typeof params.thinkingBudget !== "number") {
|
||||
return undefined;
|
||||
|
||||
@@ -132,6 +132,15 @@ describe("oxlint config", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("enables exhaustive switch linting", () => {
|
||||
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
||||
|
||||
expect(config.rules?.["typescript/switch-exhaustiveness-check"]).toEqual([
|
||||
"error",
|
||||
{ considerDefaultExhaustiveForUnions: true },
|
||||
]);
|
||||
});
|
||||
|
||||
it("enables clean zero-baseline lint rules", () => {
|
||||
const config = readJson(".oxlintrc.json") as OxlintConfig;
|
||||
|
||||
|
||||
@@ -1158,6 +1158,10 @@ export function renderApp(state: AppViewState) {
|
||||
void loadToolsCatalog(state, agentId);
|
||||
void refreshVisibleToolsEffectiveForCurrentSession(state);
|
||||
return;
|
||||
case "overview":
|
||||
case "channels":
|
||||
case "cron":
|
||||
return;
|
||||
}
|
||||
};
|
||||
const refreshAgentsPanelSupplementalData = (panel: AppViewState["agentsPanel"]) => {
|
||||
|
||||
@@ -323,6 +323,10 @@ async function refreshAgentsTab(host: SettingsHost, app: SettingsAppHost) {
|
||||
case "cron":
|
||||
void loadCron(host);
|
||||
return;
|
||||
case "overview":
|
||||
case "tools":
|
||||
case undefined:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user