Skip to content

Commit d62f43b

Browse files
committed
lint: react/jsx-key
1 parent 81d0867 commit d62f43b

10 files changed

+43
-17
lines changed

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default [
3232
"no-empty": "off",
3333
"no-unsafe-optional-chaining": "off",
3434
"no-useless-escape": "off",
35-
"react/jsx-key": "off",
3635
"react/no-unescaped-entities": "off",
3736
}
3837
}

src/views/ConceptCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
622622
console.log(conceptShelfItems.find(f => f.id == conceptID)?.source)
623623
const chipColor = conceptShelfItems.find(f => f.id == conceptID)?.source == "original" ? theme.palette.primary.light : theme.palette.custom.main;
624624
return <Chip
625+
key={conceptID}
625626
variant="outlined" size="small"
626627
// color={}
627628
sx={{

src/views/ConceptShelf.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export const ConceptShelf: FC<ConceptShelfProps> = function ConceptShelf() {
142142
<OperatorCard operator="bin" />
143143
</Box>
144144
{groupNames.map(gp => [
145-
<Box sx={{display: "block", width: "100%"}}>
145+
<Box
146+
key={`concept-group-${gp}`}
147+
sx={{display: "block", width: "100%"}}>
146148
<Divider orientation="horizontal" textAlign="left"><Typography component="h2" sx={{fontSize: "10px"}} color="text.secondary">
147149
{gp}
148150
</Typography></Divider>

src/views/DataThread.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ const SingleThreadView: FC<{
217217

218218
return [
219219
regularTableBox,
220-
<Box sx={{display: 'flex', flexDirection: 'row'}}>
220+
<Box
221+
key={`table-${tableId}`}
222+
sx={{display: 'flex', flexDirection: 'row'}}>
221223
<div style={{minWidth: '1px', padding: '0px', width: '17px', flex: 'none', display: 'flex'
222224
//borderLeft: '1px dashed darkgray',
223225
}}>
@@ -457,7 +459,9 @@ export const DataThread: FC<{}> = function ({ }) {
457459
{leafTables.map((lt, i) => {
458460
const usedTableIds = leafTables.slice(0, i)
459461
.map(x => [x.id, ...getTriggers(x, tables).map(y => y.tableId) || []]).flat();
460-
return <SingleThreadView scrollRef={scrollRef} threadIdx={i} leafTable={lt} chartElements={chartElements} usedTableIds={usedTableIds} />
462+
return <SingleThreadView
463+
key={`thread-${lt.id}`}
464+
scrollRef={scrollRef} threadIdx={i} leafTable={lt} chartElements={chartElements} usedTableIds={usedTableIds} />
461465
})}
462466
</Box>
463467

src/views/EncodingShelfCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export const TriggerCard: FC<{className?: string, trigger: Trigger, hideFields?:
9999
.map(([channel, encoding], index) => {
100100
const field = fieldItems.find(f => f.id == encoding.fieldID) as FieldItem;
101101
return [index > 0 ? '⨉' : '',
102-
<Chip sx={{color:'inherit', maxWidth: '110px', marginLeft: "2px", height: 18, fontSize: 12, borderRadius: '4px',
102+
<Chip
103+
key={`trigger-${channel}-${field.id}`}
104+
sx={{color:'inherit', maxWidth: '110px', marginLeft: "2px", height: 18, fontSize: 12, borderRadius: '4px',
103105
border: '1px solid rgb(250 235 215)', background: 'rgb(250 235 215 / 70%)',
104106
'& .MuiChip-label': { paddingLeft: '6px', paddingRight: '6px' }}}
105107
label={`${field.name}`} />]
@@ -157,7 +159,9 @@ export const MiniTriggerCard: FC<{className?: string, trigger: Trigger, hideFiel
157159
.map(([channel, encoding], index) => {
158160
const field = fieldItems.find(f => f.id == encoding.fieldID) as FieldItem;
159161
return [index > 0 ? '⨉' : '',
160-
<Chip sx={{color:'inherit', maxWidth: '110px', marginLeft: "2px", height: 16, fontSize: 'inherit', borderRadius: '4px',
162+
<Chip
163+
key={`trigger-${channel}-${field.id}`}
164+
sx={{color:'inherit', maxWidth: '110px', marginLeft: "2px", height: 16, fontSize: 'inherit', borderRadius: '4px',
161165
border: '1px solid rgb(250 235 215)', background: 'rgb(250 235 215 / 70%)',
162166
'& .MuiChip-label': { paddingLeft: '6px', paddingRight: '6px' }}}
163167
label={`${field.name}`} />]

src/views/EncodingShelfThread.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ export const EncodingShelfThread: FC<EncodingShelfThreadProps> = function ({ cha
405405
}
406406

407407
//let triggers = currentTable.derive.triggers;
408-
const tableList = activeTableThread.map((tableId) => <div className="table-list-item">
408+
const tableList = activeTableThread.map((tableId) => <div
409+
key={tableId}
410+
className="table-list-item">
409411
<Button variant="text" sx={{textTransform: 'none', padding: 0, minWidth: 0}} onClick={() => { dispatch(dfActions.setFocusedTable(tableId)) }}>
410412
<Stack direction="row" sx={{fontSize: '12px'}} alignItems="center" gap={"2px"}>
411413
<TableRowsIcon fontSize="inherit" />
@@ -417,7 +419,9 @@ export const EncodingShelfThread: FC<EncodingShelfThreadProps> = function ({ cha
417419
</div>);
418420

419421
const tableCards = activeTableThread.map((tableId) =>
420-
<Card variant='outlined' sx={{padding: '2px 0 2px 0'}}>
422+
<Card
423+
key={tableId}
424+
variant='outlined' sx={{padding: '2px 0 2px 0'}}>
421425
<Button variant="text" sx={{textTransform: 'none', padding: 0, marginLeft: 1, minWidth: 0}} onClick={() => { dispatch(dfActions.setFocusedTable(tableId)) }}>
422426
<Stack direction="row" sx={{fontSize: '12px'}} alignItems="center" gap={"2px"}>
423427
<TableRowsIcon fontSize="inherit" />
@@ -440,7 +444,9 @@ export const EncodingShelfThread: FC<EncodingShelfThreadProps> = function ({ cha
440444
const currentActiveFields = new Set(extractActiveFields(trigger))
441445
const fieldsIdentical = _.isEqual(previousActiveFields, currentActiveFields)
442446

443-
return <Box sx={{padding: 0, display: 'flex'}}>
447+
return <Box
448+
key={trigger.tableId}
449+
sx={{padding: 0, display: 'flex'}}>
444450
{/* <SouthIcon sx={{fontSize: "inherit", margin: 'auto 4px'}} /> */}
445451
<Box sx={{minWidth: '1px', padding: '0px', width: '17px', flex: 'none', display: 'flex', flexDirection: 'column'
446452
//borderLeft: '1px dashed darkgray',
@@ -502,7 +508,9 @@ export const EncodingShelfThread: FC<EncodingShelfThreadProps> = function ({ cha
502508
const postInstructEndPoint = activeTableThread.findIndex(s => s == activeThreadChart.tableRef);
503509
postInstruction = <Collapse orientation="vertical" in={true} sx={{width: "100%"}}>
504510
<Box sx={{padding: '4px 0px', display: 'flex', flexDirection: "column" }}>
505-
{interleaveArrays([<Box sx={{width: '17px', height: '12px'}}>
511+
{interleaveArrays([<Box
512+
key="post-instruction"
513+
sx={{width: '17px', height: '12px'}}>
506514
<Box sx={{padding:0, width: '1px', margin:'auto', height: '100%',
507515
backgroundImage: 'linear-gradient(180deg, darkgray, darkgray 75%, transparent 75%, transparent 100%)',
508516
backgroundSize: '1px 6px, 3px 100%'}}></Box>
@@ -532,7 +540,9 @@ export const EncodingShelfThread: FC<EncodingShelfThreadProps> = function ({ cha
532540
</Typography>
533541
</Box> */}
534542
{[
535-
<Box sx={{display: 'flex'}}>
543+
<Box
544+
key="encoding-shelf"
545+
sx={{display: 'flex'}}>
536546
{previousInstructions}
537547
</Box>,
538548
// <Box sx={{padding: '4px 0px', background: 'aliceblue', margin: 'auto', width: '200px', height: '6px', paddingBottom: 0.5}}></Box>

src/views/InfoPanel.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const InfoPanelFC: FC<{ $tableRef: React.RefObject<AgGridReact | Selectab
7373
return {
7474
id: `simple-tab-${index}`,
7575
'aria-controls': `simple-tabpanel-${index}`,
76-
key: `simple-tab-${index}`
7776
};
7877
}
7978

@@ -89,7 +88,9 @@ export const InfoPanelFC: FC<{ $tableRef: React.RefObject<AgGridReact | Selectab
8988
<IconButton color="primary" sx={{ borderRadius: 0 }} onClick={() => { setHidePanel(!hidePanel) }}>{hidePanel ? <UnfoldMoreIcon /> : <UnfoldLessIcon />}</IconButton>
9089
<Tabs value={Math.abs(tabValue)} >
9190
{tabEntries.map((entry, index) => (
92-
<Tab className={entry.highlight && index != tabValue ? "background-highlight" : ''}
91+
<Tab
92+
key={`simple-tab-${index}`}
93+
className={entry.highlight && index != tabValue ? "background-highlight" : ''}
9394
onClick={(event) => { handleTabSwitch(event, index) }} label={entry.label} {...a11yProps(index)}
9495
sx={{ "&.MuiTab-root": { "textTransform": "none" } }} />))}
9596
</Tabs>

src/views/SelectableDataGrid.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ const SelectableCell = createSelectable<SelectableCellProps>((props: TSelectable
8787
match.length > 0 && matchIndex > -1 ? (
8888
[
8989
`${value}`.substring(0, matchIndex),
90-
<span className="bold">{match}</span>,
90+
<span
91+
key={`match-${indices[0]}-${indices[1]}`}
92+
className="bold">{match}</span>,
9193
`${value}`.substring(matchIndex + match.length)
9294
]
9395
) : (value)

src/views/TableSelectionView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ export const TableSelectionView: React.FC<TableSelectionViewProps> = function Ta
136136
{challengeView}
137137
</Paper>
138138

139-
return <TabPanel value={value} index={i} >
139+
return <TabPanel
140+
key={i}
141+
value={value} index={i} >
140142
{content}
141143
<Box width="100%" sx={{display: "flex"}}>
142144
<Typography sx={{fontSize: 10, color: "text.secondary"}}>{Object.keys(t.rows[0]).length} columns{hideRowNum ? "" : ` ⨉ ${t.rows.length} rows`}</Typography>

src/views/VisualizationView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,9 @@ export const ChartEditorFC: FC<{ cachedCandidates: DictTable[],
663663
</Box>,
664664
// <EncodingShelf key='encoding-shelf' synthesisRunning={synthesisRunning} chartId={chart.id}
665665
// handleUpdateCandidates={handleUpdateCandidates} handleSetSynthesisStatus={handleSetSynthesisStatus} />
666-
<Collapse collapsedSize={48} in={!collapseEditor} orientation='horizontal'
666+
<Collapse
667+
key='encoding-shelf'
668+
collapsedSize={48} in={!collapseEditor} orientation='horizontal'
667669
sx={{position: 'relative'}}>
668670
<Box sx={{display: 'flex', flexDirection: 'row', height: '100%'}}>
669671
<Tooltip placement="left" title={collapseEditor ? "open editor" : "hide editor"}>
@@ -675,7 +677,6 @@ export const ChartEditorFC: FC<{ cachedCandidates: DictTable[],
675677
<EncodingShelfThread key='encoding-shelf' chartId={focusedChart.id} />
676678
</Box>
677679
</Collapse>,
678-
679680
]
680681

681682
const [scaleMin, scaleMax] = [0.2, 2.4]

0 commit comments

Comments
 (0)