style: fix lint across client packages

eslint --fix autofixes plus manual repairs: max-len line splits
(fake-api handlers, notifier/slots JSDoc, spec signatures), charAt over
non-null-asserted indexing in slash detect/menu cores, Array.from for
code-point capping, typeof assertions for unbound-method in specs,
generic getByRole for the send-button cast, effect disposer void-wrap in
command register, and dropped unused type imports.
This commit is contained in:
imccyu
2026-07-27 04:08:02 +08:00
parent a27be43ac1
commit f6396f2573
35 changed files with 122 additions and 89 deletions

View File

@@ -26,14 +26,14 @@ export function apply(ctx: ClientContext): void {
const childLabels = (session: ClientSessionContext, query: string): string[] => {
const { byId } = sessions.list.getSnapshot()
return Object.values(byId)
.filter((child) => child.parentId === session.sessionId && child.running && child.displayTitle.includes(query))
.map((child) => child.displayTitle)
.filter(child => child.parentId === session.sessionId && child.running && child.displayTitle.includes(query))
.map(child => child.displayTitle)
}
const source: SlashSource = {
trigger: '@',
name: 'subagent',
candidates(session, { query }) {
return Promise.resolve(childLabels(session, query).map((name) => ({ name })))
return Promise.resolve(childLabels(session, query).map(name => ({ name })))
},
lexicon(session) {
// The list snapshot is always warm — the full running-children roster.
@@ -47,10 +47,10 @@ export function apply(ctx: ClientContext): void {
return { text: `@${candidate.name} ` }
},
codec: {
clipboardText: (ref) => `@${ref}`,
clipboardText: ref => `@${ref}`,
// TODO: serialize returns the raw label until the '@' consumption
// feature defines a model representation (design ledger).
serialize: (ref) => Promise.resolve(`@${ref}`),
serialize: ref => Promise.resolve(`@${ref}`),
},
}
const slash = ctx.get('slash') as SlashServiceContract

View File

@@ -31,7 +31,7 @@ const sid = (id: string) => id as SessionId
function sessionsWith(sessions: SessionSummary[]) {
const byId: Record<string, SessionSummary> = {}
for (const s of sessions) byId[s.id] = s
const snapshot = { ids: sessions.map((s) => s.id), byId, current: undefined } as unknown as SessionListState
const snapshot = { ids: sessions.map(s => s.id), byId, current: undefined } as unknown as SessionListState
return { list: { getSnapshot: () => snapshot } }
}
@@ -139,7 +139,7 @@ describe('pick and codec', () => {
describe('adjudication', () => {
it('never participates: no matchSpace/matchEnter hooks on the subagent source', async () => {
const source = await bench(FAMILY)
expect(source.matchSpace).toBeUndefined()
expect(source.matchEnter).toBeUndefined()
expect('matchSpace' in source && source.matchSpace !== undefined).toBe(false)
expect('matchEnter' in source && source.matchEnter !== undefined).toBe(false)
})
})