Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

fix(frontend): disable rule/tool mismatches, fix remaining jsx-key + a refs regression

dextmorgn929785f00e96
diff --git a/flowsint-app/.eslintrc.cjs b/flowsint-app/.eslintrc.cjs
index 8150c48c..0dbb55ba 100644
--- a/flowsint-app/.eslintrc.cjs
+++ b/flowsint-app/.eslintrc.cjs
@@ -29,7 +29,26 @@ module.exports = {
// ~290 pre-existing `any` uses. Real debt, but not a hazard on the level of
// an unchecked hook — downgrade to visible-not-blocking rather than pretend
// it's fixed. Tighten to 'error' once the backlog is paid down.
- '@typescript-eslint/no-explicit-any': 'warn'
+ '@typescript-eslint/no-explicit-any': 'warn',
+ // This is a TypeScript codebase — every prop is already validated at
+ // compile time by its interface/type. react/prop-types exists for plain
+ // JS React with no type system; requiring PropTypes.* on top of that
+ // would just duplicate what TS already checks, for every component.
+ // Standard practice in TS+ESLint setups (CRA's TS template,
+ // eslint-config-airbnb-typescript, etc. all turn this off too).
+ 'react/prop-types': 'off',
+ // Audited every current finding (31, all in live code): every one is
+ // `const Name = memo((props) => {...})` or `forwardRef<T>((props, ref)
+ // => {...})` — a real, working component name via its binding. This is
+ // a documented eslint-plugin-react limitation: it can't statically
+ // infer a displayName through memo()/forwardRef() wrapping an anonymous
+ // arrow function, even when assigned to a named const. Not the same
+ // thing as a genuinely nameless component (e.g. one defined inline
+ // inside .map() with no binding at all) — those are real bugs and were
+ // fixed under react-hooks/static-components instead. Renaming ~30
+ // arrow functions to named function expressions purely to satisfy this
+ // rule's blind spot isn't worth the diff churn.
+ 'react/display-name': 'off'
},
settings: {
react: { version: 'detect' }
diff --git a/flowsint-app/src/components/analyses/editor/extensions/mention/mention-list.tsx b/flowsint-app/src/components/analyses/editor/extensions/mention/mention-list.tsx
index 569d89e8..ea6e752a 100644
--- a/flowsint-app/src/components/analyses/editor/extensions/mention/mention-list.tsx
+++ b/flowsint-app/src/components/analyses/editor/extensions/mention/mention-list.tsx
@@ -79,6 +79,7 @@ const MentionList = forwardRef<MentionListRef, MentionListProps>((props, ref) =>
<div className="overflow-y-auto max-h-[300px]">
{props.items.map((item, index) => (
<MentionListItem
+ key={item.nodeId}
item={item}
index={index}
selectedIndex={selectedIndex}
diff --git a/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
index d2657dd2..e93480e5 100644
--- a/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
@@ -131,6 +131,7 @@ export function InvestigationsList({
{filteredInvestigations.length === 0 && <div>No investigation found.</div>}
{filteredInvestigations.map((inv) => (
<Link
+ key={inv.id}
to="/dashboard/investigations/$investigationId"
params={{ investigationId: inv.id }}
className="block p-4 border border-border rounded-lg hover:border-muted-foreground/30 transition-colors group"
diff --git a/flowsint-app/src/components/investigations/investigation-list.tsx b/flowsint-app/src/components/investigations/investigation-list.tsx
index dc93ede1..5aa27cd0 100644
--- a/flowsint-app/src/components/investigations/investigation-list.tsx
+++ b/flowsint-app/src/components/investigations/investigation-list.tsx
@@ -40,6 +40,7 @@ const InvestigationList = () => {
<div className="space-y-0.5">
{data.map((caseItem: Investigation) => (
<Link
+ key={caseItem.id}
to="/dashboard/investigations/$investigationId"
params={{
investigationId: caseItem.id
diff --git a/flowsint-app/src/components/sketches/details-panel/details-panel.tsx b/flowsint-app/src/components/sketches/details-panel/details-panel.tsx
index 7c9826de..0bf42a78 100644
--- a/flowsint-app/src/components/sketches/details-panel/details-panel.tsx
+++ b/flowsint-app/src/components/sketches/details-panel/details-panel.tsx
@@ -8,7 +8,7 @@ import {
PopoverTitle,
PopoverTrigger
} from '@/components/ui/popover'
-import { memo, useState, useEffect, useCallback, useRef } from 'react'
+import { memo, useState, useEffect, useLayoutEffect, useCallback, useRef } from 'react'
import { cn } from '@/lib/utils'
import { FieldType, FormField, findActionItemByKey } from '@/lib/action-items'
import { CopyButton } from '@/components/copy'
@@ -288,9 +288,18 @@ const DetailsPanel = memo(() => {
})
const [nodeSize, setNodeSize] = useState<number>(0)
- // Refs to always read latest values without stale closures
+ // Refs to always read latest values without stale closures. Handlers below
+ // also write these synchronously so a value is available immediately
+ // within the same call (before the next render); this effect is the
+ // general-purpose fallback that keeps them in sync for every path that
+ // updates the state, including the node-sync block below, which cannot
+ // write refs directly since it runs during render.
const formDataRef = useRef(formData)
const nodeSizeRef = useRef(nodeSize)
+ useLayoutEffect(() => {
+ formDataRef.current = formData
+ nodeSizeRef.current = nodeSize
+ })
const IconComponent = useIcon(node?.nodeType as string, {
nodeColor: node?.nodeColor,
@@ -327,9 +336,7 @@ const DetailsPanel = memo(() => {
nodeSize: ns,
notes: (nodeMetadata?.notes as string) || ''
}
- formDataRef.current = fd
setFormData(fd)
- nodeSizeRef.current = ns ?? 0
setNodeSize(ns ?? 0)
}
}
diff --git a/flowsint-app/src/components/sketches/filters/type-filters.tsx b/flowsint-app/src/components/sketches/filters/type-filters.tsx
index 89fb3596..dea36f4a 100644
--- a/flowsint-app/src/components/sketches/filters/type-filters.tsx
+++ b/flowsint-app/src/components/sketches/filters/type-filters.tsx
@@ -14,7 +14,7 @@ const TypeFilters = ({ filters, toggleTypeFilter }: TypeFiltersProps) => {
) : (
<ul className="grid grid-cols-3 gap-2">
{filters.types.map((filter) => (
- <li>
+ <li key={filter.type}>
<div className="flex items-center gap-1">
<Checkbox
checked={filter.checked}
diff --git a/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx b/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
index c075faff..26a8d1ea 100644
--- a/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
+++ b/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
@@ -81,6 +81,7 @@ export function NodeFlag({ sketchId, node }: { sketchId: string; node: GraphNode
>
{(Object.keys(flagColors) as flagColor[]).map((key) => (
<DropdownMenuRadioItem
+ key={key}
onClick={(e) => e.stopPropagation()}
className="w-7 flex items-center justify-center gap-1"
value={key}
diff --git a/flowsint-app/src/components/sketches/import-preview.tsx b/flowsint-app/src/components/sketches/import-preview.tsx
index e83bcce3..b14accda 100644
--- a/flowsint-app/src/components/sketches/import-preview.tsx
+++ b/flowsint-app/src/components/sketches/import-preview.tsx
@@ -738,8 +738,8 @@ type EdgesPanelProps = {
const EdgesPanel = ({ edges }: EdgesPanelProps) => {
return (
<div>
- {edges.map((edge) => (
- <div>
+ {edges.map((edge, index) => (
+ <div key={`${edge.from_id}-${edge.label}-${edge.to_id}-${index}`}>
<Badge variant="outline">{edge.from_obj.label}</Badge> - {edge.label} -{' '}
<Badge variant="outline">{edge.to_obj.label}</Badge>
</div>
diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx
index 5d75e4a6..9d7271c7 100644
--- a/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx
@@ -328,7 +328,7 @@ function CustomTypeEditor() {
<SelectContent>
{!actionLoading &&
actionItems.map((item) => (
- <SelectItem value={item.type}>
+ <SelectItem key={item.type} value={item.type}>
<div className="flex items-center gap-2">{item.label}</div>
</SelectItem>
))}