Skip to content

Commit e27af8d

Browse files
committed
fix: remove noInlineConfig to allow eslint-disable for legitimate casts
The noInlineConfig setting blocked all eslint-disable comments, making it impossible to suppress the consistent-type-assertions rule for runtime-validated discriminated union casts where proper type guards are impractical (MeshStatePatch union with 8 variants, Object.values on narrowed object types). Remove it and use targeted disable comments instead. Also fix prettier formatting on delivery-receipt.helper.ts.
1 parent 036b603 commit e27af8d

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

eslint.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ export default defineConfig(
6161
...tseslint.configs.strictTypeChecked,
6262
...tseslint.configs.stylisticTypeChecked,
6363
],
64-
linterOptions: {
65-
noInlineConfig: true,
66-
},
6764
languageOptions: {
6865
parserOptions: {
6966
projectService: {

src/bridges/user/web/frontend/mesh-client.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@ export class MeshClient {
7373
break;
7474
if (!("agents" in raw.state) || !("rooms" in raw.state)) break;
7575
const state = raw.state;
76-
const agents =
76+
// State from mesh SharedWorker is SerialisedState where agents/rooms
77+
// are Record<string, T>. Object.values on object returns any[], which
78+
// is the actual runtime shape.
79+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
80+
const agents: AgentIdentity[] =
7781
typeof state.agents === "object" && state.agents !== null
7882
? Object.values(state.agents)
7983
: [];
80-
const rooms =
84+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
85+
const rooms: RoomLike[] =
8186
typeof state.rooms === "object" && state.rooms !== null
8287
? Object.values(state.rooms)
8388
: [];

src/bridges/user/web/frontend/relay-worker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ function translateWireMessage(label: "a" | "b", msg: WireMessage): WireMessage {
313313
"type" in msg.patch &&
314314
typeof msg.patch.type === "string"
315315
) {
316+
// Patch validated as object with string `type` — cast to MeshStatePatch discriminated union
316317
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
317318
const patch = msg.patch as MeshStatePatch;
318319
return { ...msg, patch: translatePatch(label, patch) };

src/test/delivery-receipt.helper.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ async function testReadReceiptPush(): Promise<void> {
324324
await sleep(500);
325325

326326
const readReceipt = deliveriesA.find(
327-
(
328-
ev,
329-
): ev is Extract<DeliveryEvent, { type: "delivery_status" }> =>
327+
(ev): ev is Extract<DeliveryEvent, { type: "delivery_status" }> =>
330328
ev.type === "delivery_status" && ev.status === "read",
331329
);
332330
assert.ok(readReceipt !== undefined, "A should receive a read receipt");

0 commit comments

Comments
 (0)