Skip to content

Commit c323f39

Browse files
author
Kevin Arthur
committed
fix(quality): resolve all biome lint warnings and infos
- a11y: label->span for custom Select (noLabelWithoutControl), fieldset+visually-hidden legend for role=group groups, svg <title> for table edit overlay, drop redundant aria-label on visible conflict count (useSemanticElements, noSvgWithoutTitle, useAriaPropsSupportedByRole) - keys: data-derived keys for column resize handles; narrow justified suppressions for stateless preview/diagnostics lists (noArrayIndexKey) - lint: useOptionalChain, useTemplate, useLiteralKeys, useNodejsImportProtocol, noUselessSwitchCase; remove stale useExhaustiveDependencies suppression - TokenSyncPanel preview fieldset gets margin/min-inline-size reset
1 parent cdaa09c commit c323f39

14 files changed

Lines changed: 36 additions & 30 deletions

File tree

‎packages/editor/src/actions/createActionHandlers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function createActionHandlers(
112112
const selectedId = e.state.selection.length === 1 ? e.state.selection[0] : undefined;
113113
if (!selectedId) return;
114114
const node = e.state.document.nodes[selectedId];
115-
if (!node || node.kind !== 'table') return;
115+
if (node?.kind !== 'table') return;
116116
const table = node.table;
117117
const rows: string[][] = [];
118118
for (const rowId of table.rowOrder) {

‎packages/editor/src/components/CanvasOverlays.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ export function CanvasOverlays({
436436
containerHeight={canvasSize.height}
437437
/>
438438
{editor.state.createTableFromDataOpen && <CreateTableFromDataDialog />}
439-
{editor.state.tableEdit && editor.state.tableEdit.editingCellId && (
439+
{editor.state.tableEdit?.editingCellId && (
440440
<TableCellEditor
441441
cellId={editor.state.tableEdit.editingCellId}
442442
zoom={zoom}

‎packages/editor/src/components/CreateTableFromDataDialog.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function CreateTableFromDataDialog() {
156156
/>
157157

158158
<div className="insp-field-row__split" style={{ gap: 12, flexWrap: 'wrap' }}>
159-
<label style={{ fontSize: 12 }}>
159+
<span style={{ fontSize: 12 }}>
160160
Format
161161
<Select
162162
label="Input format"
@@ -170,7 +170,7 @@ export function CreateTableFromDataDialog() {
170170
]}
171171
onChange={(v) => setDelimiter(v as typeof delimiter)}
172172
/>
173-
</label>
173+
</span>
174174
<label style={{ fontSize: 12 }}>
175175
<input
176176
type="checkbox"
@@ -206,6 +206,7 @@ export function CreateTableFromDataDialog() {
206206
<thead>
207207
<tr>
208208
{Array.from({ length: cols }, (_, c) => (
209+
// biome-ignore lint/suspicious/noArrayIndexKey: preview columns are stateless; header labels can repeat
209210
<th key={c} style={{ fontSize: 11, padding: '2px 6px', textAlign: 'left' }}>
210211
{headerRow && rows[0]?.[c] ? rows[0][c] : `C${c + 1}`}
211212
</th>
@@ -214,8 +215,10 @@ export function CreateTableFromDataDialog() {
214215
</thead>
215216
<tbody>
216217
{previewRows.slice(headerRow ? 1 : 0).map((r, ri) => (
218+
// biome-ignore lint/suspicious/noArrayIndexKey: preview rows are stateless; cell content repeats across the table
217219
<tr key={ri}>
218220
{Array.from({ length: cols }, (_, c) => (
221+
// biome-ignore lint/suspicious/noArrayIndexKey: preview cells are stateless; content repeats across the table
219222
<td key={c} style={{ fontSize: 11, padding: '2px 6px' }}>
220223
{r[c] ?? ''}
221224
</td>

‎packages/editor/src/components/Inspector/controls/VariableModifierPopover.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ export function VariableModifierPopover({
119119
</button>
120120
</div>
121121

122-
<div role="group" aria-label="Operation" style={{ display: 'flex', gap: 4 }}>
122+
<fieldset
123+
style={{ display: 'flex', gap: 4, margin: 0, padding: 0, border: 'none', minInlineSize: 0 }}
124+
>
125+
<legend className="varve-visually-hidden">Operation</legend>
123126
{OPERATIONS.map((op) => (
124127
<button
125128
key={op.value}
@@ -138,7 +141,7 @@ export function VariableModifierPopover({
138141
{op.label}
139142
</button>
140143
))}
141-
</div>
144+
</fieldset>
142145

143146
<label style={{ fontSize: 12 }}>
144147
{operation === 'multiply'

‎packages/editor/src/components/Inspector/sections/FillSection.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ function FillRow({
457457
bindingValid
458458
? 'Linked to ' +
459459
(bindingVariableName ?? '') +
460-
(bindingModifierLabel ? ', alpha ' + bindingModifierLabel : '')
461-
: 'Variable ' + (bindingVariableName ?? '') + ' is missing or invalid'
460+
(bindingModifierLabel ? `, alpha ${bindingModifierLabel}` : '')
461+
: `Variable ${bindingVariableName ?? ''} is missing or invalid`
462462
}
463463
title={
464464
bindingValid
465465
? 'Linked to $' +
466466
bindingVariableName +
467-
(bindingModifierLabel ? ' · ' + bindingModifierLabel : '')
467+
(bindingModifierLabel ? ` · ${bindingModifierLabel}` : '')
468468
: 'Linked variable is missing or invalid — binding preserved'
469469
}
470470
style={{

‎packages/editor/src/components/Inspector/sections/TableSection.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export function TableSection({ node }: Props) {
7474
),
7575
},
7676
],
77-
// biome-ignore lint/correctness/useExhaustiveDependencies: structural counts change with the node
7877
[node.id, rowCount, columnCount],
7978
);
8079

‎packages/editor/src/components/TableEditOverlay/TableEditOverlay.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function TableEditOverlay({ zoom, pan, cameraRotation, worldToScreen }: P
5656

5757
const moveSelection = useCallback(
5858
(dir: 'up' | 'down' | 'left' | 'right' | 'tab', reverse: boolean, extend: boolean) => {
59-
if (!tableNode || !tableEdit || !tableEdit.activeCellId) return;
59+
if (!tableNode || !tableEdit?.activeCellId) return;
6060
const cursor = cellCoordinateOf(tableNode.table, tableEdit.activeCellId);
6161
if (!cursor) return;
6262
const next =
@@ -267,6 +267,7 @@ export function TableEditOverlay({ zoom, pan, cameraRotation, worldToScreen }: P
267267
height="100%"
268268
style={{ position: 'absolute', inset: 0, overflow: 'visible' }}
269269
>
270+
<title>Table editing overlay</title>
270271
{cellLayouts.map((cell) => {
271272
if (!selectedSet.has(cell.id)) return null;
272273
const [sx, sy] = screenOf(cell.x, cell.y);
@@ -332,7 +333,7 @@ export function TableEditOverlay({ zoom, pan, cameraRotation, worldToScreen }: P
332333
)}
333334
{boundaries.map((x, i) => (
334335
<line
335-
key={`col-${i}`}
336+
key={`col-${x}`}
336337
x1={screenOf(x, 0)[0]}
337338
y1={topLeft[1]}
338339
x2={screenOf(x, 0)[0]}

‎packages/editor/src/components/TokenSync/TokenSyncPanel.css‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@
114114
.token-sync-panel__preview {
115115
border: 1px solid var(--color-border-subtle);
116116
border-radius: var(--radius-sm);
117+
margin: 0;
118+
min-inline-size: 0;
117119
padding: 0.5rem;
118120
display: flex;
119121
flex-direction: column;

‎packages/editor/src/components/TokenSync/TokenSyncPanel.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ export function TokenSyncPanel() {
130130
{row.tokenCount} tokens, {row.locallyModifiedCount} modified
131131
</span>
132132
{row.conflictCount > 0 && (
133-
<span
134-
className="token-sync-panel__conflict-count"
135-
aria-label={`${row.conflictCount} conflicts`}
136-
>
133+
<span className="token-sync-panel__conflict-count">
137134
{row.conflictCount} conflicts
138135
</span>
139136
)}
@@ -168,10 +165,12 @@ export function TokenSyncPanel() {
168165
</div>
169166

170167
{preview && (
171-
<div className="token-sync-panel__preview" role="group" aria-label="Import preview">
168+
<fieldset className="token-sync-panel__preview">
169+
<legend className="varve-visually-hidden">Import preview</legend>
172170
{preview.diagnostics.length > 0 && (
173171
<ul className="token-sync-panel__diagnostics">
174172
{preview.diagnostics.slice(0, 5).map((message, index) => (
173+
// biome-ignore lint/suspicious/noArrayIndexKey: diagnostics are stateless strings; duplicate messages would collide as content keys
175174
<li key={`${index}-${message}`}>{message}</li>
176175
))}
177176
</ul>
@@ -201,7 +200,7 @@ export function TokenSyncPanel() {
201200
Cancel
202201
</button>
203202
</div>
204-
</div>
203+
</fieldset>
205204
)}
206205
</div>
207206
)}

‎packages/editor/src/table/tableDocOps.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function applyTableModelOp(
3232
op: (model: TableModel) => TableModel,
3333
): Document {
3434
const node = doc.nodes[tableId];
35-
if (!node || node.kind !== 'table') return doc;
35+
if (node?.kind !== 'table') return doc;
3636
const table = op(node.table);
3737
if (table === node.table) return doc;
3838
return {

0 commit comments

Comments
 (0)