Skip to content

Commit df525b9

Browse files
committed
chore(lint): enable unnecessary type parameter rule
1 parent 630f2bc commit df525b9

94 files changed

Lines changed: 186 additions & 152 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"typescript/no-meaningless-void-operator": "error",
2424
"typescript/no-unnecessary-type-assertion": "error",
2525
"typescript/no-unnecessary-type-conversion": "error",
26-
"typescript/no-unnecessary-type-parameters": "off",
26+
"typescript/no-unnecessary-type-parameters": "error",
2727
"typescript/no-unsafe-type-assertion": "off",
2828
"typescript/no-useless-default-assignment": "error",
2929
"unicorn/consistent-function-scoping": "off",

extensions/browser/src/cli/browser-cli-actions-input/register.files-downloads.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async function normalizeUploadPaths(paths: string[]): Promise<string[]> {
2222
return result.paths;
2323
}
2424

25+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Browser request result type is shared between request and success formatter.
2526
async function runBrowserPostAction<T>(params: {
2627
parent: BrowserParentOpts;
2728
profile: string | undefined;

extensions/browser/src/node-host/invoke-browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ async function readBrowserProxyFile(filePath: string): Promise<BrowserProxyFile
126126
return { path: filePath, base64: buffer.toString("base64"), mimeType };
127127
}
128128

129+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- CLI JSON params are typed by the invoked method.
129130
function decodeParams<T>(raw?: string | null): T {
130131
if (!raw) {
131132
throw new Error("INVALID_REQUEST: paramsJSON required");

extensions/discord/src/actions/runtime.messaging.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function handleDiscordMessagingAction(
118118
: accountId
119119
? { accountId }
120120
: undefined;
121-
const withReactionRuntimeOptions = <T extends Record<string, unknown>>(extra?: T) => ({
121+
const withReactionRuntimeOptions = (extra?: Record<string, unknown>) => ({
122122
...(reactionRuntimeOptions ?? cfgOptions),
123123
...extra,
124124
});

extensions/discord/src/monitor.tool-result.test-helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ export function createMentionRequiredGuildConfig(overrides?: Partial<Config>): C
311311
}
312312

313313
export function captureNextDispatchCtx<
314+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Test helper lets assertions ascribe captured dispatch context shape.
314315
T extends {
315316
SessionKey?: string;
316317
ParentSessionKey?: string;

extensions/discord/src/monitor/message-handler.batch-gate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ type ReplyThreadingContext = {
66
ReplyThreading?: ReplyThreadingPolicy;
77
};
88

9-
export function applyImplicitReplyBatchGate<T extends object>(
10-
ctx: T,
9+
export function applyImplicitReplyBatchGate(
10+
ctx: object,
1111
replyToMode: ReplyToMode,
1212
isBatched: boolean,
1313
) {
1414
const replyThreading = resolveBatchedReplyThreadingPolicy(replyToMode, isBatched);
1515
if (!replyThreading) {
1616
return;
1717
}
18-
(ctx as T & ReplyThreadingContext).ReplyThreading = replyThreading;
18+
(ctx as ReplyThreadingContext).ReplyThreading = replyThreading;
1919
}

extensions/discord/src/outbound-adapter.test-harness.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type DiscordSendModule = typeof import("./send.js");
1515
type DiscordSendComponentsModule = typeof import("./send.components.js");
1616
type DiscordThreadBindingsModule = typeof import("./monitor/thread-bindings.js");
1717

18+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Test helper preserves mock call and result types.
1819
function invokeMock<TArgs extends unknown[], TResult>(
1920
mock: (...args: unknown[]) => unknown,
2021
...args: TArgs

extensions/discord/src/test-support/provider.test-support.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export function mockResolvedDiscordAccountConfig(overrides: Record<string, unkno
205205
}));
206206
}
207207

208+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Test helper lets assertions ascribe handler params shape.
208209
export function getFirstDiscordMessageHandlerParams<T extends object>() {
209210
expect(createDiscordMessageHandlerMock).toHaveBeenCalledTimes(1);
210211
const firstCall = createDiscordMessageHandlerMock.mock.calls.at(0) as [T] | undefined;

extensions/feishu/src/bitable.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,10 @@ export function registerFeishuBitableTools(api: OpenClawPluginApi) {
558558
const getClient = (params: AccountAwareParams | undefined, defaultAccountId?: string) =>
559559
createFeishuToolClient({ api, executeParams: params, defaultAccountId });
560560

561-
const registerBitableTool = <TParams extends AccountAwareParams>(params: {
561+
const registerBitableTool = <
562+
// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- Tool params bind each schema-specific executor to its registered tool.
563+
TParams extends AccountAwareParams,
564+
>(params: {
562565
name: string;
563566
label: string;
564567
description: string;

extensions/feishu/src/test-support/lifecycle-test-support.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ async function loadMonitorSingleAccount() {
413413
return module.monitorSingleAccount;
414414
}
415415

416-
export async function setupFeishuLifecycleHandler<T extends RuntimeEnv>(params: {
416+
export async function setupFeishuLifecycleHandler(params: {
417417
createEventDispatcherMock: {
418418
mockReturnValue: (value: unknown) => unknown;
419419
mockReturnValueOnce: (value: unknown) => unknown;
420420
};
421421
onRegister: (registered: Record<string, (data: unknown) => Promise<void>>) => void;
422-
runtime: T;
422+
runtime: RuntimeEnv;
423423
cfg: ClawdbotConfig;
424424
account: ResolvedFeishuAccount;
425425
handlerKey: string;

0 commit comments

Comments
 (0)