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:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -45,4 +45,5 @@ function Badge({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
|
||||
export { Badge, badgeVariants }
|
||||
|
||||
@@ -61,4 +61,5 @@ function Button({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
|
||||
export { Button, buttonVariants }
|
||||
|
||||
@@ -86,4 +86,5 @@ function TabsContent({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components -- shadcn/ui pattern
|
||||
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
|
||||
|
||||
Reference in New Issue
Block a user