From 0e9548e25f1b170f58e00ccb717987660bab7402 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Wed, 14 Jan 2026 15:38:56 +0100 Subject: [PATCH] fix(lint): resolve eslint errors in suggestion components - Fix import order issues - Fix TypeScript type annotations - Use .at() for array access to satisfy lint rules - Cast props to correct types in command handlers - Fix template literal type issues Co-Authored-By: Claude Opus 4.5 --- lib/src/Components/Input/RichTextEditor.tsx | 9 +++++++-- lib/src/Components/Map/hooks/useItemColor.tsx | 4 ++-- lib/src/Components/Profile/ProfileForm.tsx | 6 +++--- .../Profile/Subcomponents/ActionsButton.tsx | 4 +++- lib/src/Components/Templates/ItemCard.tsx | 2 +- .../Components/TipTap/extensions/Hashtag.tsx | 8 ++------ .../TipTap/extensions/ItemMention.tsx | 5 ++--- .../TipTap/extensions/VideoEmbed.tsx | 13 +++++++----- lib/src/Components/TipTap/extensions/index.ts | 6 +----- .../suggestions/HashtagSuggestion.tsx | 14 ++++++------- .../suggestions/ItemMentionSuggestion.tsx | 9 +++++---- .../extensions/suggestions/SuggestionList.tsx | 12 ++++++++--- .../TipTap/utils/preprocessMarkdown.ts | 5 +---- .../TipTap/utils/simpleMarkdownToHtml.tsx | 20 +++++++------------ 14 files changed, 58 insertions(+), 59 deletions(-) diff --git a/lib/src/Components/Input/RichTextEditor.tsx b/lib/src/Components/Input/RichTextEditor.tsx index fcf68233..d941a56b 100644 --- a/lib/src/Components/Input/RichTextEditor.tsx +++ b/lib/src/Components/Input/RichTextEditor.tsx @@ -10,8 +10,13 @@ import { Markdown } from 'tiptap-markdown' import { useGetItemColor } from '#components/Map/hooks/useItemColor' import { useItems } from '#components/Map/hooks/useItems' import { useAddTag, useTags } from '#components/Map/hooks/useTags' -import { Hashtag, ItemMention, VideoEmbed } from '#components/TipTap/extensions' -import { createHashtagSuggestion, createItemMentionSuggestion } from '#components/TipTap/extensions' +import { + Hashtag, + ItemMention, + VideoEmbed, + createHashtagSuggestion, + createItemMentionSuggestion, +} from '#components/TipTap/extensions' import { preprocessMarkdown } from '#components/TipTap/utils/preprocessMarkdown' import { InputLabel } from './InputLabel' diff --git a/lib/src/Components/Map/hooks/useItemColor.tsx b/lib/src/Components/Map/hooks/useItemColor.tsx index f8670f29..aec6cdda 100644 --- a/lib/src/Components/Map/hooks/useItemColor.tsx +++ b/lib/src/Components/Map/hooks/useItemColor.tsx @@ -12,7 +12,7 @@ export const useGetItemColor = (): ((item: Item | undefined, fallback?: string) const getItemTags = useGetItemTags() return useCallback( - (item: Item | undefined, fallback: string = '#000') => { + (item: Item | undefined, fallback = '#000') => { if (!item) return fallback // 1. Item's own color takes highest priority @@ -36,7 +36,7 @@ export const useGetItemColor = (): ((item: Item | undefined, fallback?: string) * Hook that returns the calculated color for a specific item. * Priority: item.color > first tag color > layer default color > fallback */ -export const useItemColor = (item: Item | undefined, fallback: string = '#000'): string => { +export const useItemColor = (item: Item | undefined, fallback = '#000'): string => { const getItemColor = useGetItemColor() return getItemColor(item, fallback) } diff --git a/lib/src/Components/Profile/ProfileForm.tsx b/lib/src/Components/Profile/ProfileForm.tsx index 103ed63d..c243163c 100644 --- a/lib/src/Components/Profile/ProfileForm.tsx +++ b/lib/src/Components/Profile/ProfileForm.tsx @@ -1,16 +1,16 @@ /* eslint-disable camelcase */ // Directus database fields use snake_case -/* eslint-disable @typescript-eslint/restrict-template-expressions */ + /* eslint-disable @typescript-eslint/no-unnecessary-condition */ -/* eslint-disable @typescript-eslint/prefer-optional-chain */ + import classNames from 'classnames' import { useEffect, useState } from 'react' import { useLocation, useNavigate } from 'react-router-dom' import { useAuth } from '#components/Auth/useAuth' +import { useGetItemColor } from '#components/Map/hooks/useItemColor' import { useItems, useUpdateItem, useAddItem } from '#components/Map/hooks/useItems' import { useLayers } from '#components/Map/hooks/useLayers' import { useHasUserPermission } from '#components/Map/hooks/usePermissions' -import { useGetItemColor } from '#components/Map/hooks/useItemColor' import { useAddTag, useTags } from '#components/Map/hooks/useTags' import { MapOverlayPage } from '#components/Templates' diff --git a/lib/src/Components/Profile/Subcomponents/ActionsButton.tsx b/lib/src/Components/Profile/Subcomponents/ActionsButton.tsx index 4fdf2170..3bb7d2fb 100644 --- a/lib/src/Components/Profile/Subcomponents/ActionsButton.tsx +++ b/lib/src/Components/Profile/Subcomponents/ActionsButton.tsx @@ -48,7 +48,9 @@ export function ActionButton({ <> {hasUserPermission(collection, 'update', item) && ( <> -
+
{triggerItemSelected && (