The best way to control Claude Code, Codex and more from any computer or phone
chore(lint): enforce react/no-array-index-key (#25112)
Julius Marminge committed
Oct 25, 2026 at 19:32 UTC
f44fea47a0b37f0b1839b1deb33cf50d45b67e27
10 files changed
+226
-188
apps/mobile/modules/t3-source-text/src/SourceText.tsx
+17
-12
@@ -28,18 +28,23 @@ export function SourceText({ style, children, nativeTextRef, ...props }: SourceT
28
</Text>
29
);
30
}
31
- const runs = React.Children.toArray(children).map((child, index) => {
32
- if (React.isValidElement(child)) return child;
33
- if (typeof child !== "string" && typeof child !== "number") return null;
34
- return (
35
- <T3SourceTextRunNativeComponent
36
- key={index}
37
- style={flattenedStyle}
38
- {...flattenedStyle}
39
- text={String(child)}
40
- />
41
- );
42
- });
31
+ const runs = React.Children.toArray(children).map(
32
+ (
33
+ child,
34
+ index,
35
+ ) => /* oxlint-disable react/no-array-index-key -- Native text runs are stateless positions within the supplied text. */ {
36
+ if (React.isValidElement(child)) return child;
37
+ if (typeof child !== "string" && typeof child !== "number") return null;
38
+ return (
39
+ <T3SourceTextRunNativeComponent
40
+ key={index}
41
+ style={flattenedStyle}
42
+ {...flattenedStyle}
43
+ text={String(child)}
44
+ />
45
+ );
46
+ } /* oxlint-enable react/no-array-index-key */,
47
+ );
48
if (isAncestor) {
49
return <TextAncestorContext.Provider value={contextValue}>{runs}</TextAncestorContext.Provider>;
50
}
apps/mobile/src/components/ComposerContextSheet.tsx
+17
-12
@@ -268,18 +268,23 @@ export function ComposerContextSheet(props: {
268
<ContextField label="Comment" value={record.comment} />
269
<ContextField label="Selection" value={record.targetSummary} />
270
<ContextField label="Requested changes" value={record.styleChanges.join("\n")} />
271
- {record.elements?.map((element, index) => (
272
- <View key={`${element.selector ?? element.tagName}:${index}`} className="gap-3">
273
- <ContextField
274
- label="Element"
275
- value={element.componentName ?? element.tagName}
276
- />
277
- <ContextField label="Selector" value={element.selector} code />
278
- <ContextSource source={element.source} />
279
- <ContextField label="HTML" value={element.htmlPreview} code />
280
- <ContextField label="Styles" value={element.styles} code />
281
- </View>
282
- ))}
271
+ {record.elements?.map(
272
+ (element, index) => (
273
+ /* oxlint-disable react/no-array-index-key -- Captured DOM elements are a fixed snapshot without persistent element IDs. */ <View
274
+ key={`${element.selector ?? element.tagName}:${index}`}
275
+ className="gap-3"
276
+ >
277
+ <ContextField
278
+ label="Element"
279
+ value={element.componentName ?? element.tagName}
280
+ />
281
+ <ContextField label="Selector" value={element.selector} code />
282
+ <ContextSource source={element.source} />
283
+ <ContextField label="HTML" value={element.htmlPreview} code />
284
+ <ContextField label="Styles" value={element.styles} code />
285
+ </View>
286
+ ) /* oxlint-enable react/no-array-index-key */,
287
+ )}
288
</>
289
) : null}
290
{record.kind === "element" ? (
apps/mobile/src/features/files/SourceFileSurface.tsx
+35
-28
@@ -280,34 +280,41 @@ function JavaScriptSourceFileSurface(props: SourceFileSurfaceProps) {
280
}}
281
>
282
{selectableTokens
283
- ? lines.map((line, index) => {
284
- const lineTokens = selectableTokens[index] ?? null;
285
- const body =
286
- lineTokens && lineTokens.length > 0
287
- ? lineTokens.map((token, tokenIndex) => (
288
- <SourceText
289
- key={`${index}:${tokenIndex}`}
290
- style={{
291
- color: token.color ?? foreground,
292
- fontWeight:
293
- token.fontStyle !== null && (token.fontStyle & 2) === 2 ? "700" : "400",
294
- fontStyle:
295
- token.fontStyle !== null && (token.fontStyle & 1) === 1
296
- ? "italic"
297
- : "normal",
298
- }}
299
- >
300
- {token.content}
301
- </SourceText>
302
- ))
303
- : line;
304
- return (
305
- <SourceText key={index}>
306
- {body}
307
- {index < lines.length - 1 ? "\n" : ""}
308
- </SourceText>
309
- );
310
- })
283
+ ? lines.map(
284
+ (
285
+ line,
286
+ index,
287
+ ) => /* oxlint-disable react/no-array-index-key -- Source lines and highlight tokens are stateless positions within the loaded file. */ {
288
+ const lineTokens = selectableTokens[index] ?? null;
289
+ const body =
290
+ lineTokens && lineTokens.length > 0
291
+ ? lineTokens.map((token, tokenIndex) => (
292
+ <SourceText
293
+ key={`${index}:${tokenIndex}`}
294
+ style={{
295
+ color: token.color ?? foreground,
296
+ fontWeight:
297
+ token.fontStyle !== null && (token.fontStyle & 2) === 2
298
+ ? "700"
299
+ : "400",
300
+ fontStyle:
301
+ token.fontStyle !== null && (token.fontStyle & 1) === 1
302
+ ? "italic"
303
+ : "normal",
304
+ }}
305
+ >
306
+ {token.content}
307
+ </SourceText>
308
+ ))
309
+ : line;
310
+ return (
311
+ <SourceText key={index}>
312
+ {body}
313
+ {index < lines.length - 1 ? "\n" : ""}
314
+ </SourceText>
315
+ );
316
+ } /* oxlint-enable react/no-array-index-key */,
317
+ )
318
: normalizedContents}
319
</SourceText>
320
) : null;
apps/mobile/src/features/review/ReviewCommentCard.tsx
+21
-17
@@ -219,23 +219,27 @@ export const ReviewCommentCard = memo(function ReviewCommentCard(props: {
219
}}
220
>
221
{snippetTokens
222
- ? snippetTokens.map((line, lineIndex) => (
223
- <NativeText key={lineIndex}>
224
- {lineIndex > 0 ? "\n" : ""}
225
- {line.map((token, tokenIndex) => (
226
- <NativeText
227
- key={tokenIndex}
228
- style={{
229
- color: token.color ?? props.colors.text,
230
- fontStyle: (token.fontStyle ?? 0) & 1 ? "italic" : "normal",
231
- fontWeight: (token.fontStyle ?? 0) & 2 ? "700" : "400",
232
- }}
233
- >
234
- {token.content}
235
- </NativeText>
236
- ))}
237
- </NativeText>
238
- ))
222
+ ? snippetTokens.map(
223
+ (line, lineIndex) => (
224
+ /* oxlint-disable react/no-array-index-key -- Highlight tokens are stateless positions within this immutable snippet. */ <NativeText
225
+ key={lineIndex}
226
+ >
227
+ {lineIndex > 0 ? "\n" : ""}
228
+ {line.map((token, tokenIndex) => (
229
+ <NativeText
230
+ key={tokenIndex}
231
+ style={{
232
+ color: token.color ?? props.colors.text,
233
+ fontStyle: (token.fontStyle ?? 0) & 1 ? "italic" : "normal",
234
+ fontWeight: (token.fontStyle ?? 0) & 2 ? "700" : "400",
235
+ }}
236
+ >
237
+ {token.content}
238
+ </NativeText>
239
+ ))}
240
+ </NativeText>
241
+ ) /* oxlint-enable react/no-array-index-key */,
242
+ )
243
: props.comment.diff.trim()}
244
</NativeText>
245
</ScrollView>
apps/mobile/src/features/terminal/TerminalContextSheet.tsx
+35
-33
@@ -67,41 +67,43 @@ export function TerminalContextSheet(props: {
67
Tap the first and last line to select a range.
68
</Text>
69
<View className="overflow-hidden rounded-xl bg-card-alt">
70
- {lines.map((line, index) => (
71
- <Pressable
72
- key={index}
73
- accessibilityRole="button"
74
- accessibilityLabel={`Line ${index + 1}: ${line}`}
75
- accessibilityState={{ selected: index >= range.start && index <= range.end }}
76
- onPress={() => {
77
- if (anchor === null) {
78
- setAnchor(index);
79
- setRange({ start: index, end: index });
80
- } else {
81
- setRange({ start: Math.min(anchor, index), end: Math.max(anchor, index) });
82
- setAnchor(null);
70
+ {lines.map(
71
+ (line, index) => (
72
+ /* oxlint-disable react/no-array-index-key -- Selection is addressed by line number in this captured terminal snapshot. */ <Pressable
73
+ key={index}
74
+ accessibilityRole="button"
75
+ accessibilityLabel={`Line ${index + 1}: ${line}`}
76
+ accessibilityState={{ selected: index >= range.start && index <= range.end }}
77
+ onPress={() => {
78
+ if (anchor === null) {
79
+ setAnchor(index);
80
+ setRange({ start: index, end: index });
81
+ } else {
82
+ setRange({ start: Math.min(anchor, index), end: Math.max(anchor, index) });
83
+ setAnchor(null);
84
+ }
85
+ }}
86
+ className={
87
+ index >= range.start && index <= range.end
88
+ ? "flex-row gap-3 bg-primary/10 px-3 py-2"
89
+ : "flex-row gap-3 px-3 py-2"
90
}
84
- }}
85
- className={
86
- index >= range.start && index <= range.end
87
- ? "flex-row gap-3 bg-primary/10 px-3 py-2"
88
- : "flex-row gap-3 px-3 py-2"
89
- }
90
- >
91
- <Text
92
- className="w-8 text-right text-sm text-foreground-muted"
93
- style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
91
>
95
- {index + 1}
96
- </Text>
97
- <Text
98
- className="flex-1 text-sm text-foreground"
99
- style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
100
- >
101
- {line || " "}
102
- </Text>
103
- </Pressable>
104
- ))}
92
+ <Text
93
+ className="w-8 text-right text-sm text-foreground-muted"
94
+ style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
95
+ >
96
+ {index + 1}
97
+ </Text>
98
+ <Text
99
+ className="flex-1 text-sm text-foreground"
100
+ style={{ fontFamily: REVIEW_MONO_FONT_FAMILY }}
101
+ >
102
+ {line || " "}
103
+ </Text>
104
+ </Pressable>
105
+ ) /* oxlint-enable react/no-array-index-key */,
106
+ )}
107
</View>
108
</ScrollView>
109
<View
apps/mobile/src/features/threads/thread-list-v2-items.tsx
+10
-5
@@ -1225,11 +1225,16 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
1225
) : null}
1226
{providerInstance ? (
1227
<View className="flex-row items-center">
1228
- {providerDrivers.slice(0, -1).map((driver, index) => (
1229
- <View key={`${driver}:${index}`} className="-mr-1 opacity-30">
1230
- <ProviderIcon provider={driver} size={12} />
1231
- </View>
1232
- ))}
1228
+ {providerDrivers.slice(0, -1).map(
1229
+ (driver, index) => (
1230
+ /* oxlint-disable react/no-array-index-key -- Provider history can repeat a driver; these decorative icons have no local state. */ <View
1231
+ key={`${driver}:${index}`}
1232
+ className="-mr-1 opacity-30"
1233
+ >
1234
+ <ProviderIcon provider={driver} size={12} />
1235
+ </View>
1236
+ ) /* oxlint-enable react/no-array-index-key */,
1237
+ )}
1238
<ProviderInstanceIcon
1239
iconUrl={providerIconUrl}
1240
provider={providerInstance.driverKind}
apps/mobile/src/features/threads/thread-work-log.tsx
+14
-12
@@ -1214,18 +1214,20 @@ const ThreadWorkLogRow = function ThreadWorkLogRow(
1214
call.argsText,
1215
]
1216
.filter((line) => Boolean(line))
1217
- .map((line, index) =>
1218
- typeof line === "string" ? (
1219
- <Text
1220
- key={`${index}:${line}`}
1221
- selectable
1222
- className="font-mono text-2xs leading-normal text-foreground"
1223
- >
1224
- {line}
1225
- </Text>
1226
- ) : (
1227
- line
1228
- ),
1217
+ .map(
1218
+ (line, index) =>
1219
+ /* oxlint-disable react/no-array-index-key -- Log lines are stateless positions within this output. */ typeof line ===
1220
+ "string" ? (
1221
+ <Text
1222
+ key={`${index}:${line}`}
1223
+ selectable
1224
+ className="font-mono text-2xs leading-normal text-foreground"
1225
+ >
1226
+ {line}
1227
+ </Text>
1228
+ ) : (
1229
+ line
1230
+ ) /* oxlint-enable react/no-array-index-key */,
1231
)
1232
) : fullDetail ? (
1233
<Text selectable className="font-mono text-2xs leading-normal text-foreground-muted">
apps/web/src/components/pullRequest/PullRequestChecksPopover.tsx
+32
-30
@@ -79,36 +79,38 @@ function ChecksBody({
79
: "grid-cols-[auto_minmax(0,1fr)_auto]",
80
)}
81
>
82
- {visibleChecks.map((check, index) => (
83
- <li
84
- key={`${index}:${check.name}`}
85
- className="col-span-full grid grid-cols-subgrid items-center text-xs"
86
- >
87
- <PullRequestCheckStatusIcon status={check.status} />
88
- <Tooltip>
89
- <TooltipTrigger render={<span className="min-w-0 truncate">{check.name}</span>} />
90
- <TooltipPopup side="top">{check.description ?? check.name}</TooltipPopup>
91
- </Tooltip>
92
- <span className="justify-self-end whitespace-nowrap text-muted-foreground">
93
- {pullRequestCheckStatusLabel(check)}
94
- </span>
95
- {check.url === null ? null : (
96
- <button
97
- type="button"
98
- className="text-primary hover:underline"
99
- onClick={() => {
100
- if (!check.url) return;
101
- void openLink(check.url).catch((error: unknown) => {
102
- console.error(error);
103
- toastManager.add({ type: "error", title: "Unable to open check details" });
104
- });
105
- }}
106
- >
107
- Details
108
- </button>
109
- )}
110
- </li>
111
- ))}
82
+ {visibleChecks.map(
83
+ (check, index) => (
84
+ /* oxlint-disable react/no-array-index-key -- Check names can repeat; these status rows have no local state. */ <li
85
+ key={`${index}:${check.name}`}
86
+ className="col-span-full grid grid-cols-subgrid items-center text-xs"
87
+ >
88
+ <PullRequestCheckStatusIcon status={check.status} />
89
+ <Tooltip>
90
+ <TooltipTrigger render={<span className="min-w-0 truncate">{check.name}</span>} />
91
+ <TooltipPopup side="top">{check.description ?? check.name}</TooltipPopup>
92
+ </Tooltip>
93
+ <span className="justify-self-end whitespace-nowrap text-muted-foreground">
94
+ {pullRequestCheckStatusLabel(check)}
95
+ </span>
96
+ {check.url === null ? null : (
97
+ <button
98
+ type="button"
99
+ className="text-primary hover:underline"
100
+ onClick={() => {
101
+ if (!check.url) return;
102
+ void openLink(check.url).catch((error: unknown) => {
103
+ console.error(error);
104
+ toastManager.add({ type: "error", title: "Unable to open check details" });
105
+ });
106
+ }}
107
+ >
108
+ Details
109
+ </button>
110
+ )}
111
+ </li>
112
+ ) /* oxlint-enable react/no-array-index-key */,
113
+ )}
114
</ul>
115
</ScrollArea>
116
{canCollapse ? (
apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
+44
-39
@@ -795,46 +795,51 @@ export function PullRequestSummaryTab({
795
) : detail.checks.length === 0 ? (
796
<p className="text-xs text-muted-foreground">No checks reported.</p>
797
) : (
798
- detail.checks.map((check, index) => {
799
- const finding = { kind: "check", check } as const;
800
- const failing = check.status === "failure" || check.status === "cancelled";
801
- return (
802
- <div
803
- key={`${index}:${check.name}:${check.url ?? ""}`}
804
- className="group flex items-center gap-2 rounded-md pr-1 hover:bg-accent/60"
805
- >
806
- <button
807
- type="button"
808
- disabled={!check.url}
809
- onClick={() => check.url && openCheck(check.url)}
810
- className={cn(
811
- "flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-2 text-left text-xs leading-5 [&>svg]:mt-0.5",
812
- check.url ? "cursor-pointer" : "cursor-default",
813
- )}
814
- >
815
- <PullRequestCheckStatusIcon status={check.status} />
816
- <span className="min-w-0 flex-1 wrap-anywhere">{check.name}</span>
817
- <span className="shrink-0 text-muted-foreground">
818
- {pullRequestCheckStatusLabel(check)}
819
- </span>
820
- </button>
821
- {onFixFinding && failing ? (
822
- <Button
823
- size="xs"
824
- variant="ghost"
825
- className="shrink-0"
826
- disabled={pendingFinding !== null && pendingFinding !== undefined}
827
- onClick={() => onFixFinding(finding)}
798
+ detail.checks.map(
799
+ (
800
+ check,
801
+ index,
802
+ ) => /* oxlint-disable react/no-array-index-key -- Check names and URLs can repeat; these status rows have no local state. */ {
803
+ const finding = { kind: "check", check } as const;
804
+ const failing = check.status === "failure" || check.status === "cancelled";
805
+ return (
806
+ <div
807
+ key={`${index}:${check.name}:${check.url ?? ""}`}
808
+ className="group flex items-center gap-2 rounded-md pr-1 hover:bg-accent/60"
809
>
829
- <HammerIcon className="size-3" />
830
- {pendingFinding === pullRequestFindingKey(finding)
831
- ? "Preparing..."
832
- : fixCheckLabel}
833
- </Button>
834
- ) : null}
835
- </div>
836
- );
837
- })
810
+ <button
811
+ type="button"
812
+ disabled={!check.url}
813
+ onClick={() => check.url && openCheck(check.url)}
814
+ className={cn(
815
+ "flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-2 text-left text-xs leading-5 [&>svg]:mt-0.5",
816
+ check.url ? "cursor-pointer" : "cursor-default",
817
+ )}
818
+ >
819
+ <PullRequestCheckStatusIcon status={check.status} />
820
+ <span className="min-w-0 flex-1 wrap-anywhere">{check.name}</span>
821
+ <span className="shrink-0 text-muted-foreground">
822
+ {pullRequestCheckStatusLabel(check)}
823
+ </span>
824
+ </button>
825
+ {onFixFinding && failing ? (
826
+ <Button
827
+ size="xs"
828
+ variant="ghost"
829
+ className="shrink-0"
830
+ disabled={pendingFinding !== null && pendingFinding !== undefined}
831
+ onClick={() => onFixFinding(finding)}
832
+ >
833
+ <HammerIcon className="size-3" />
834
+ {pendingFinding === pullRequestFindingKey(finding)
835
+ ? "Preparing..."
836
+ : fixCheckLabel}
837
+ </Button>
838
+ ) : null}
839
+ </div>
840
+ );
841
+ } /* oxlint-enable react/no-array-index-key */,
842
+ )
843
)}
844
</Section>
845
vite.config.ts
+1
@@ -216,6 +216,7 @@ export default defineConfig({
216
perf: "warn",
217
},
218
rules: {
219
+ "react/no-array-index-key": "error",
220
"react/no-unstable-nested-components": "error",
221
"react/static-components": "error",
222
"react/capitalized-calls": "error",