Enforce no-explicit-any; allow in tests

Enable @typescript-eslint/no-explicit-any as an error in the ESLint config to tighten typing across the codebase, and add an override to disable this rule for test files. Also apply non-functional cleanup in packages/proton/src/runtime.ts: reorder/imports and adjust formatting/indentation and string alignment for readability — no behavioral changes.
This commit is contained in:
手瓜一十雪 committed 2026-05-24 13:38:13 +08:00
1 parent acc5084647
commit 80ee12ecc2
36 files changed
+229 -147

No files matched your search

@@ -23,7 +23,7 @@ export namespace FetchFriendListPage {
export type Deps = OidbSender;
export const serialize = (_ctx: Deps, p: Params): OidbFriendListRequest => {
const body: any = {
const body: OidbFriendListRequest = {
friendCount: 300,
field4: 0,
field6: 1,
@@ -25,7 +25,7 @@ export namespace FetchGroupMemberListPage {
export type Deps = OidbSender;
export const serialize = (_ctx: Deps, p: Params): OidbGroupMemberListRequest => {
const body: any = {
const body: OidbGroupMemberListRequest = {
groupUin: p.groupId,
field2: 5,
field3: 2,
@@ -41,7 +41,7 @@ export namespace GetStrangerStatus {
export const deserialize = (_ctx: Deps, body: OidbStrangerStatusResp): StrangerStatus | null => {
const raw = body.data?.status?.value;
if (raw === undefined || raw === null) return null;
const extBig = typeof raw === 'bigint' ? raw : BigInt(raw as any);
const extBig = typeof raw === 'bigint' ? raw : BigInt(raw);
if (extBig <= 10n) {
return { status: Number(extBig) * 10, ext_status: 0 };
}
@@ -31,7 +31,7 @@ export namespace GetGroupPttUrl {
client: { agentType: 2 },
},
download: {
node: normalizeMediaNode(p.node) as any,
node: normalizeMediaNode(p.node),
download: { video: { busiType: 0, sceneType: 0 } },
},
});
@@ -30,7 +30,7 @@ export namespace GetGroupVideoUrl {
client: { agentType: 2 },
},
download: {
node: normalizeMediaNode(p.node) as any,
node: normalizeMediaNode(p.node),
download: { video: { busiType: 0, sceneType: 0 } },
},
});
@@ -30,7 +30,7 @@ export namespace GetPrivatePttUrl {
client: { agentType: 2 },
},
download: {
node: normalizeMediaNode(p.node) as any,
node: normalizeMediaNode(p.node),
download: { video: { busiType: 0, sceneType: 0 } },
},
});
@@ -30,7 +30,7 @@ export namespace GetPrivateVideoUrl {
client: { agentType: 2 },
},
download: {
node: normalizeMediaNode(p.node) as any,
node: normalizeMediaNode(p.node),
download: { video: { busiType: 0, sceneType: 0 } },
},
});
@@ -9,7 +9,7 @@
// differ. The response is parsed into a `domain + urlPath +
// rKeyParam` triple → composed into `https://<domain><path><rKey>`.
import type { NTV2RichMediaResp } from '@snowluma/proto-defs/oidb-actions/media';
import type { NTV2IndexNode, NTV2RichMediaResp } from '@snowluma/proto-defs/oidb-actions/media';
import { ensureRetCodeZero } from '../shared';
export function parseNtv2DownloadUrl(body: NTV2RichMediaResp): string {
@@ -24,7 +24,7 @@ export function parseNtv2DownloadUrl(body: NTV2RichMediaResp): string {
/** Normalize a MediaIndexNode-shaped object into the wire-fields the
* NTV2RichMedia `download.node` slot expects: `info{...}` /
* `fileUuid` / `storeId` / `uploadTime` / `ttl` / `subType`. */
export function normalizeMediaNode(node: NtMediaIndex): Record<string, unknown> {
export function normalizeMediaNode(node: NtMediaIndex): NTV2IndexNode {
const fileUuid = typeof node.fileUuid === 'string' ? node.fileUuid : '';
if (!fileUuid) throw new Error('media node fileUuid is required');
@@ -8,6 +8,7 @@ import type { Oidb0x112eReq, Oidb0x112eResp } from '@snowluma/proto-defs/oidb-ac
import { invokeOidb, type OidbSender } from '../../oidb-service';
export interface InlineButtonClickResult {
[key: string]: import('@snowluma/common/json').JsonValue;
result: number;
errMsg: string;
status: 0;
@@ -10,15 +10,18 @@ import { invokeOidb, type OidbSender } from '../../oidb-service';
import type { BridgeContext } from '../../bridge-context';
export interface LikeInfo {
[key: string]: import('@snowluma/common/json').JsonValue;
uid: string;
time: number;
favoriteInfo: {
[key: string]: import('@snowluma/common/json').JsonValue;
total_count: number;
last_time: number;
today_count: number;
userInfos: never[];
};
voteInfo: {
[key: string]: import('@snowluma/common/json').JsonValue;
total_count: number;
new_count: number;
new_nearby_count: number;
@@ -13,6 +13,10 @@ import type { Oidb0xe17Req, Oidb0xe17Resp } from '@snowluma/proto-defs/oidb-acti
import { invokeOidb, type OidbSender } from '../../oidb-service';
import type { BridgeContext } from '../../bridge-context';
export interface UnidirectionalFriendEntry {
[key: string]: import('@snowluma/common/json').JsonValue;
}
export namespace GetUnidirectionalFriendList {
export const command = 0xE17;
export const subCommand = 0;
@@ -35,9 +39,9 @@ export namespace GetUnidirectionalFriendList {
return { jsonBody: JSON.stringify(reqObj) };
};
export const deserialize = (_ctx: Deps, body: Oidb0xe17Resp): unknown[] => {
export const deserialize = (_ctx: Deps, body: Oidb0xe17Resp): UnidirectionalFriendEntry[] => {
if (!body || !body.jsonBody) throw new Error('get unidirectional friend list empty');
const parsed = JSON.parse(body.jsonBody);
const parsed = JSON.parse(body.jsonBody) as { rpt_block_list?: UnidirectionalFriendEntry[] };
return parsed.rpt_block_list || [];
};
@@ -47,6 +51,6 @@ export namespace GetUnidirectionalFriendList {
export const decode = (bytes: Uint8Array): OidbBase<Oidb0xe17Resp> =>
protobuf_decode<OidbBase<Oidb0xe17Resp>>(bytes);
export const invoke = (deps: Deps): Promise<unknown[]> =>
export const invoke = (deps: Deps): Promise<UnidirectionalFriendEntry[]> =>
invokeOidb(deps, GetUnidirectionalFriendList, {});
}