Skip to content

Commit b9fe089

Browse files
committed
chore(lint): enable additional cleanup rules
1 parent 444562b commit b9fe089

108 files changed

Lines changed: 134 additions & 267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.oxlintrc.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"eslint/no-useless-concat": "error",
3434
"eslint/no-useless-constructor": "error",
3535
"eslint/no-useless-rename": "error",
36+
"eslint/no-useless-return": "error",
3637
"eslint/no-unused-vars": "off",
3738
"eslint/no-warning-comments": "error",
3839
"eslint/no-unmodified-loop-condition": "error",
@@ -72,6 +73,7 @@
7273
"typescript/no-extraneous-class": "error",
7374
"typescript/no-import-type-side-effects": "error",
7475
"typescript/no-meaningless-void-operator": "error",
76+
"typescript/no-inferrable-types": "error",
7577
"typescript/no-non-null-asserted-nullish-coalescing": "error",
7678
"typescript/no-unnecessary-qualifier": "error",
7779
"typescript/no-unnecessary-type-assertion": "error",
@@ -112,6 +114,7 @@
112114
"unicorn/no-new-buffer": "error",
113115
"unicorn/no-thenable": "error",
114116
"unicorn/no-typeof-undefined": "error",
117+
"unicorn/no-unreadable-array-destructuring": "error",
115118
"unicorn/no-unnecessary-array-flat-depth": "error",
116119
"unicorn/no-unnecessary-array-splice-count": "error",
117120
"unicorn/no-unnecessary-slice-end": "error",

‎extensions/browser/src/browser/cdp.internal.test.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ describe("cdp internal", () => {
223223
);
224224
return;
225225
}
226-
if (replyToViewportCommandOrScreenshot(msg, socket, "FULL")) {
227-
return;
228-
}
226+
replyToViewportCommandOrScreenshot(msg, socket, "FULL");
229227
});
230228
wss = server.wss;
231229
const buf = await captureScreenshot({ wsUrl: server.wsUrl, fullPage: true });
@@ -1060,9 +1058,7 @@ describe("cdp internal", () => {
10601058
socket.send(JSON.stringify({ id: msg.id, result: { result: { value: {} } } }));
10611059
return;
10621060
}
1063-
if (replyToViewportCommandOrScreenshot(msg, socket, "C")) {
1064-
return;
1065-
}
1061+
replyToViewportCommandOrScreenshot(msg, socket, "C");
10661062
});
10671063
wss = server.wss;
10681064
const buf = await captureScreenshot({ wsUrl: server.wsUrl, fullPage: true });

‎extensions/browser/src/browser/pw-role-snapshot.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ function matchInteractiveSnapshotLine(
5353
if (!match) {
5454
return null;
5555
}
56-
const [, , roleRaw, name, suffix] = match;
56+
const roleRaw = match[2];
57+
const name = match[3];
58+
const suffix = match[4];
5759
if (roleRaw.startsWith("/")) {
5860
return null;
5961
}
@@ -384,7 +386,9 @@ export function buildRoleSnapshotFromAiSnapshot(
384386
out.push(line);
385387
continue;
386388
}
387-
const [, , roleRaw, name, suffix] = match;
389+
const roleRaw = match[2];
390+
const name = match[3];
391+
const suffix = match[4];
388392
if (roleRaw.startsWith("/")) {
389393
out.push(line);
390394
continue;

‎extensions/browser/src/browser/pw-session.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,6 @@ export async function focusPageByTargetIdViaPlaywright(opts: {
18061806
await send("Page.bringToFront");
18071807
},
18081808
});
1809-
return;
18101809
} catch {
18111810
throw err;
18121811
}

‎extensions/deepgram/realtime-transcription-provider.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ function createDeepgramRealtimeTranscriptionSession(
186186
case "Error":
187187
case "error":
188188
config.onError?.(new Error(readErrorDetail(event.error ?? event.message)));
189-
return;
189+
190190
default:
191-
return;
192191
}
193192
};
194193

‎extensions/diagnostics-otel/src/service.ts‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,7 @@ function assignOtelModelContentAttributes(
898898
);
899899
}
900900
if (policy.systemPrompt) {
901-
assignOtelContentAttribute(
902-
attributes,
903-
"openclaw.content.system_prompt",
904-
content?.systemPrompt,
905-
);
901+
assignOtelContentAttribute(attributes, "openclaw.content.system_prompt", content?.systemPrompt);
906902
}
907903
}
908904

@@ -1475,13 +1471,10 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
14751471
description: "Tool execution duration",
14761472
},
14771473
);
1478-
const toolExecutionBlockedCounter = meter.createCounter(
1479-
"openclaw.tool.execution.blocked",
1480-
{
1481-
unit: "1",
1482-
description: "Tool executions blocked by policy or sandbox diagnostics",
1483-
},
1484-
);
1474+
const toolExecutionBlockedCounter = meter.createCounter("openclaw.tool.execution.blocked", {
1475+
unit: "1",
1476+
description: "Tool executions blocked by policy or sandbox diagnostics",
1477+
});
14851478
const execProcessDurationHistogram = meter.createHistogram("openclaw.exec.duration_ms", {
14861479
unit: "ms",
14871480
description: "Exec process duration",
@@ -3208,7 +3201,6 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
32083201
return;
32093202
case "model.failover":
32103203
recordModelFailover(evt, metadata);
3211-
return;
32123204
}
32133205
} catch (err) {
32143206
ctx.logger.error(

‎extensions/diagnostics-prometheus/src/service.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ function modelCallLabels(evt: {
334334
};
335335
}
336336

337-
function modelFailoverLabels(evt: Extract<DiagnosticEventPayload, { type: "model.failover" }>): LabelSet {
337+
function modelFailoverLabels(
338+
evt: Extract<DiagnosticEventPayload, { type: "model.failover" }>,
339+
): LabelSet {
338340
return {
339341
from_model: lowCardinalityLabel(evt.fromModel),
340342
from_provider: lowCardinalityLabel(evt.fromProvider),
@@ -429,7 +431,9 @@ function webhookLabels(
429431
};
430432
}
431433

432-
function sessionStuckLabels(evt: Extract<DiagnosticEventPayload, { type: "session.stuck" }>): LabelSet {
434+
function sessionStuckLabels(
435+
evt: Extract<DiagnosticEventPayload, { type: "session.stuck" }>,
436+
): LabelSet {
433437
return {
434438
reason: lowCardinalityLabel(evt.reason, "none"),
435439
state: evt.state,
@@ -463,7 +467,9 @@ function livenessLabels(
463467
};
464468
}
465469

466-
function payloadLargeLabels(evt: Extract<DiagnosticEventPayload, { type: "payload.large" }>): LabelSet {
470+
function payloadLargeLabels(
471+
evt: Extract<DiagnosticEventPayload, { type: "payload.large" }>,
472+
): LabelSet {
467473
return {
468474
action: evt.action,
469475
channel: lowCardinalityLabel(evt.channel, "none"),
@@ -981,9 +987,7 @@ function recordDiagnosticEvent(
981987
numericValue(evt.bytes),
982988
BYTE_BUCKETS,
983989
);
984-
return;
985990
default:
986-
return;
987991
}
988992
}
989993

‎extensions/discord/src/monitor/gateway-plugin.test.ts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const { GatewayIntents, GatewayPlugin } = vi.hoisted(() => {
3535
options: unknown;
3636
gatewayInfo: unknown;
3737
emitter = new TestEmitter();
38-
isConnecting: boolean = false;
38+
isConnecting = false;
3939
heartbeatInterval?: NodeJS.Timeout;
4040
firstHeartbeatTimeout?: NodeJS.Timeout;
4141
ws?: unknown;
@@ -46,11 +46,7 @@ const { GatewayIntents, GatewayPlugin } = vi.hoisted(() => {
4646

4747
async registerClient(clientForTest: unknown): Promise<void> {}
4848

49-
connect(_resume = false): void {
50-
if (this.isConnecting) {
51-
return;
52-
}
53-
}
49+
connect(_resume = false): void {}
5450
}
5551

5652
return { GatewayIntents, GatewayPlugin };

‎extensions/discord/src/monitor/gateway-supervisor.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ export function createDiscordGatewaySupervisor(params: {
166166
return;
167167
case "buffering":
168168
pending.push(event);
169-
return;
170169
}
171170
};
172171
emitter.on("error", onGatewayError);

‎extensions/discord/src/monitor/model-picker-preferences.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,5 @@ export async function recordDiscordModelPickerRecentModel(params: {
347347
)
348348
.toSorted(comparePreferenceEntries);
349349
await Promise.all(scopedEntries.slice(limit).map((entry) => store.delete(entry.key)));
350-
} catch {
351-
return;
352-
}
350+
} catch {}
353351
}

0 commit comments

Comments
 (0)