fix: suppress react-refresh/only-export-components for valid patterns

Co-located utility exports (constants, helper functions, variant
definitions) alongside their component files. These don't affect
Fast Refresh behavior in practice — targeted eslint-disable comments
explain each case:

- DynamicPropertiesPanel: containsWikilinks, RELATIONSHIP_KEYS
- NoteList: re-exported sort/filter utilities
- NoteItem: getTypeIcon utility
- SidebarParts: isSelectionActive utility
- TypeCustomizePopover: ICON_OPTIONS, resolveIcon
- badge/button/tabs: shadcn/ui variant export pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-22 13:11:38 +01:00
parent 8e49af2c0e
commit e5d96f97ec
8 changed files with 9 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ export const RELATIONSHIP_KEYS = new Set([
// Keys to skip showing in Properties
const SKIP_KEYS = new Set(['aliases', 'notion_id', 'workspace'])
// eslint-disable-next-line react-refresh/only-export-components -- utility co-located with component
export function containsWikilinks(value: FrontmatterValue): boolean {
if (typeof value === 'string') return /^\[\[.*\]\]$/.test(value)
if (Array.isArray(value)) return value.some(v => typeof v === 'string' && /^\[\[.*\]\]$/.test(v))

View File

@@ -20,6 +20,7 @@ const TYPE_ICON_MAP: Record<string, ComponentType<SVGAttributes<SVGSVGElement>>>
Type: StackSimple,
}
// eslint-disable-next-line react-refresh/only-export-components -- utility co-located with component
export function getTypeIcon(isA: string | null, customIcon?: string | null): ComponentType<SVGAttributes<SVGSVGElement>> {
if (customIcon) return resolveIcon(customIcon)
return (isA && TYPE_ICON_MAP[isA]) || FileText

View File

@@ -15,7 +15,7 @@ import {
loadSortPreferences, saveSortPreferences,
} from '../utils/noteListHelpers'
// Re-export for consumers
// eslint-disable-next-line react-refresh/only-export-components -- re-exports for consumers
export { sortByModified, filterEntries, buildRelationshipGroups, getSortComparator }
export type { SortOption }

View File

@@ -12,6 +12,7 @@ export interface SectionGroup {
customColor?: string | null
}
// eslint-disable-next-line react-refresh/only-export-components -- utility co-located with component
export function isSelectionActive(current: SidebarSelection, check: SidebarSelection): boolean {
if (current.kind !== check.kind) return false
switch (check.kind) {

View File

@@ -11,6 +11,7 @@ import { ACCENT_COLORS } from '../utils/typeColors'
import { cn } from '@/lib/utils'
/** Curated Phosphor icons (normal weight) for type customization */
// eslint-disable-next-line react-refresh/only-export-components -- constant co-located with component
export const ICON_OPTIONS: { name: string; Icon: ComponentType<IconProps> }[] = [
{ name: 'file-text', Icon: FileText },
{ name: 'wrench', Icon: Wrench },
@@ -54,6 +55,7 @@ const ICON_MAP: Record<string, ComponentType<IconProps>> = Object.fromEntries(
)
/** Resolves a Phosphor icon name to its component, with fallback to FileText */
// eslint-disable-next-line react-refresh/only-export-components -- utility co-located with component
export function resolveIcon(name: string | null): ComponentType<IconProps> {
return (name && ICON_MAP[name]) || FileText
}

View File

@@ -45,4 +45,5 @@ function Badge({
)
}
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
export { Badge, badgeVariants }

View File

@@ -61,4 +61,5 @@ function Button({
)
}
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
export { Button, buttonVariants }

View File

@@ -86,4 +86,5 @@ function TabsContent({
)
}
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }