Skip to content
TypeScript

chore(lint): enforce react/no-unstable-nested-components (#25111)

Julius Marminge7e20a5b8f626
diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx
index b6b747e9dab..83d075f3489 100644
--- a/apps/mobile/src/Stack.tsx
+++ b/apps/mobile/src/Stack.tsx
@@ -1077,6 +1077,7 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
const nativeMetrics = useNativeLayoutMetrics();
const usesSplitView = deriveLayout({ width, height, nativeMetrics }).usesSplitView;
+ /* oxlint-disable react/no-unstable-nested-components -- React Navigation invokes screenLayout as a render callback. */
return (
<Navigator
screenLayout={(props) => <GuardedScreenLayout {...props} />}
@@ -1087,6 +1088,8 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
}
/>
);
+
+ /* oxlint-enable react/no-unstable-nested-components */
});
type RootStackType = typeof RootStack;
diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
index 94d64799001..fc949f83f7d 100644
--- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx
@@ -558,14 +558,14 @@ function ThreadRouteContent(
};
const safeAreaInsets = useSafeAreaInsets();
const inspectorHeaderInset = Platform.OS === "ios" ? 0 : safeAreaInsets.top;
- const GitInspector = () => (
+ const renderGitInspector = () => (
<GitOverviewSheet
headerInset={inspectorHeaderInset}
presentation="inspector"
route={{ params: { environmentId: environmentId!, threadId: threadId! } }}
/>
);
- const FilesInspector = () =>
+ const renderFilesInspector = () =>
selectedThread !== null && selectedThreadCwd !== null ? (
<ThreadFileNavigatorPane
cwd={selectedThreadCwd}
@@ -576,7 +576,7 @@ function ThreadRouteContent(
onSelectFile={handleSelectInspectorFile}
/>
) : null;
- const RouteInspector = () => props.renderInspector?.(inspectorHeaderInset);
+ const renderRouteInspector = () => props.renderInspector?.(inspectorHeaderInset);
const renderPreviewInspector = () =>
previewTarget && panes.auxiliaryPaneVisible ? (
<ThreadInspectorPreview
@@ -600,11 +600,11 @@ function ThreadRouteContent(
inspectorMode === null ? null : (
<ThreadInspectorContentStack
renderPreview={renderPreviewInspector}
- renderFiles={FilesInspector}
- renderGit={GitInspector}
+ renderFiles={renderFilesInspector}
+ renderGit={renderGitInspector}
mode={inspectorMode}
resetKeys={[routeThreadIdentity, selectedThreadCwd]}
- renderRoute={props.renderInspector ? RouteInspector : undefined}
+ renderRoute={props.renderInspector ? renderRouteInspector : undefined}
/>
);
const activeInspectorRenderer =
diff --git a/vite.config.ts b/vite.config.ts
index d7d07166ef7..f865dc62d2f 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -216,6 +216,7 @@ export default defineConfig({
perf: "warn",
},
rules: {
+ "react/no-unstable-nested-components": "error",
"react/static-components": "error",
"react/capitalized-calls": "error",
"typescript/no-extraneous-class": "error",