From a7843b0dd95965304df1ed4956caa3e4e6cf8ef2 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Tue, 15 Sep 2026 18:27:13 -0400 Subject: [PATCH] fix(lint): drop Reflect.get from the native traps main adopted anti-slop's `no-reflect-get` in #20874 and fixed the copy that lived in `native-mounting-substitutes.ts`. This branch moved both traps into `native-module-traps.ts`, so the rule lands here instead and the static-analysis gate is red without the same narrowing. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- .../rpc-recording/native-module-traps.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mobile/src/test-support/rpc-recording/native-module-traps.ts b/mobile/src/test-support/rpc-recording/native-module-traps.ts index da9ae89977d..3dd3c0390c3 100644 --- a/mobile/src/test-support/rpc-recording/native-module-traps.ts +++ b/mobile/src/test-support/rpc-recording/native-module-traps.ts @@ -24,10 +24,14 @@ export function partialNativeModule(module: string, members: Record): unknown { return new Proxy(members, { get: (target, key) => { - if (typeof key === 'string' && key !== '__esModule' && !(key in target)) { - throw new Error(`Unsubstituted native member: ${module}.${key}`) + if (typeof key === 'string') { + if (key !== '__esModule' && !(key in target)) { + throw new Error(`Unsubstituted native member: ${module}.${key}`) + } + return target[key] } - return Reflect.get(target, key) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: a symbol key cannot index the declared string record; the trap reads whatever the member object holds there. + return (target as Record)[key] } }) } @@ -45,7 +49,7 @@ export function nativeStoreModule(module: string, declared: Record { void args