diff --git a/src/Components/AppShell/Content.tsx b/src/Components/AppShell/Content.tsx index 92fce768..de30e296 100644 --- a/src/Components/AppShell/Content.tsx +++ b/src/Components/AppShell/Content.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/consistent-type-definitions */ import * as React from 'react' type ContentProps = { diff --git a/src/Components/AppShell/ContextWrapper.tsx b/src/Components/AppShell/ContextWrapper.tsx index 9cae2738..85169c91 100644 --- a/src/Components/AppShell/ContextWrapper.tsx +++ b/src/Components/AppShell/ContextWrapper.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { ToastContainer } from 'react-toastify' import { QuestsProvider } from '../Gaming/hooks/useQuests' diff --git a/src/Components/AppShell/NavBar.tsx b/src/Components/AppShell/NavBar.tsx index 7524939b..56355b39 100644 --- a/src/Components/AppShell/NavBar.tsx +++ b/src/Components/AppShell/NavBar.tsx @@ -1,3 +1,14 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ import { useAuth } from '../Auth' import { Link, useLocation } from 'react-router-dom' import { toast } from 'react-toastify' diff --git a/src/Components/AppShell/SideBar.tsx b/src/Components/AppShell/SideBar.tsx index d2f475fd..1dd21541 100644 --- a/src/Components/AppShell/SideBar.tsx +++ b/src/Components/AppShell/SideBar.tsx @@ -1,3 +1,9 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { useRef, useState, useEffect } from 'react' import { NavLink, useLocation } from 'react-router-dom' import { Sidenav, initTE } from 'tw-elements' @@ -5,9 +11,9 @@ import SidebarSubmenu from './SidebarSubmenu' import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon' import * as React from 'react' -type route = { +interface route { path: string - // eslint-disable-next-line no-undef + icon: JSX.Element name: string submenu?: route diff --git a/src/Components/AppShell/SidebarSubmenu.tsx b/src/Components/AppShell/SidebarSubmenu.tsx index b3426732..d60db7e3 100644 --- a/src/Components/AppShell/SidebarSubmenu.tsx +++ b/src/Components/AppShell/SidebarSubmenu.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon' import { useEffect, useState } from 'react' import { Link, useLocation } from 'react-router-dom' @@ -8,7 +12,7 @@ function SidebarSubmenu({ icon, }: { path: string - // eslint-disable-next-line no-undef + icon: JSX.Element name: string submenu?: any | undefined diff --git a/src/Components/AppShell/Sitemap.tsx b/src/Components/AppShell/Sitemap.tsx index 61b3466d..1e8274bd 100644 --- a/src/Components/AppShell/Sitemap.tsx +++ b/src/Components/AppShell/Sitemap.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { useEffect, useState } from 'react' import { useItems } from '../Map/hooks/useItems' diff --git a/src/Components/AppShell/hooks/useAssets.tsx b/src/Components/AppShell/hooks/useAssets.tsx index c3e4465e..276773ab 100644 --- a/src/Components/AppShell/hooks/useAssets.tsx +++ b/src/Components/AppShell/hooks/useAssets.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ import { useCallback, useState, createContext, useContext } from 'react' import * as React from 'react' diff --git a/src/Components/Auth/LoginPage.tsx b/src/Components/Auth/LoginPage.tsx index 91ea9650..6c9f7fd5 100644 --- a/src/Components/Auth/LoginPage.tsx +++ b/src/Components/Auth/LoginPage.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-floating-promises */ import { useEffect, useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { toast } from 'react-toastify' diff --git a/src/Components/Auth/RequestPasswordPage.tsx b/src/Components/Auth/RequestPasswordPage.tsx index 016f1f0c..fd1f25b6 100644 --- a/src/Components/Auth/RequestPasswordPage.tsx +++ b/src/Components/Auth/RequestPasswordPage.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ import { useState } from 'react' import { useNavigate } from 'react-router-dom' import { toast } from 'react-toastify' diff --git a/src/Components/Auth/SetNewPasswordPage.tsx b/src/Components/Auth/SetNewPasswordPage.tsx index afe9f632..9e35560c 100644 --- a/src/Components/Auth/SetNewPasswordPage.tsx +++ b/src/Components/Auth/SetNewPasswordPage.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { useState } from 'react' import { useNavigate } from 'react-router-dom' diff --git a/src/Components/Auth/SignupPage.tsx b/src/Components/Auth/SignupPage.tsx index 19ca7f3e..484a8262 100644 --- a/src/Components/Auth/SignupPage.tsx +++ b/src/Components/Auth/SignupPage.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-misused-promises */ import { useEffect, useState } from 'react' import { useNavigate } from 'react-router-dom' diff --git a/src/Components/Auth/useAuth.tsx b/src/Components/Auth/useAuth.tsx index f5a1cfeb..b51f8449 100644 --- a/src/Components/Auth/useAuth.tsx +++ b/src/Components/Auth/useAuth.tsx @@ -1,19 +1,26 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { createContext, useState, useContext, useEffect } from 'react' import * as React from 'react' import { UserApi, UserItem } from '../../types' -type AuthProviderProps = { +interface AuthProviderProps { userApi: UserApi children?: React.ReactNode } -type AuthCredentials = { +interface AuthCredentials { email: string password: string otp?: string | undefined } -type AuthContextProps = { +interface AuthContextProps { isAuthenticated: boolean user: UserItem | null login: (credentials: AuthCredentials) => Promise @@ -58,9 +65,9 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => { setToken(token) if (token) { const me = await userApi.getUser() - setUser(me as UserItem) + setUser(me) setLoading(false) - return me as UserItem + return me } else return undefined } catch (error) { setLoading(false) diff --git a/src/Components/Gaming/Modal.tsx b/src/Components/Gaming/Modal.tsx index 8ac44981..f6372551 100644 --- a/src/Components/Gaming/Modal.tsx +++ b/src/Components/Gaming/Modal.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import * as React from 'react' import { useEffect } from 'react' diff --git a/src/Components/Gaming/Quests.tsx b/src/Components/Gaming/Quests.tsx index 9555a724..35cdcab3 100644 --- a/src/Components/Gaming/Quests.tsx +++ b/src/Components/Gaming/Quests.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests' import { useAuth } from '../Auth' import { useEffect, useState } from 'react' diff --git a/src/Components/Gaming/hooks/useQuests.tsx b/src/Components/Gaming/hooks/useQuests.tsx index 17e4323f..569d431c 100644 --- a/src/Components/Gaming/hooks/useQuests.tsx +++ b/src/Components/Gaming/hooks/useQuests.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ import { useCallback, useState, createContext, useContext } from 'react' import * as React from 'react' diff --git a/src/Components/Input/Autocomplete.tsx b/src/Components/Input/Autocomplete.tsx index ce25467a..39013c6b 100644 --- a/src/Components/Input/Autocomplete.tsx +++ b/src/Components/Input/Autocomplete.tsx @@ -1,3 +1,10 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import * as React from 'react' import { useEffect } from 'react' import { TagView } from '../Templates/TagView' @@ -10,12 +17,12 @@ export const Autocomplete = ({ setFocus, }: { inputProps: any - suggestions: Array + suggestions: any[] onSelected: (suggestion) => void - pushFilteredSuggestions?: Array + pushFilteredSuggestions?: any[] setFocus?: boolean }) => { - const [filteredSuggestions, setFilteredSuggestions] = React.useState>([]) + const [filteredSuggestions, setFilteredSuggestions] = React.useState([]) const [heighlightedSuggestion, setHeighlightedSuggestion] = React.useState(0) useEffect(() => { @@ -28,7 +35,6 @@ export const Autocomplete = ({ const inputRef = React.useRef() - // eslint-disable-next-line no-unused-vars const getSuggestionValue = (suggestion) => suggestion.name const getSuggestions = (value) => { diff --git a/src/Components/Input/ComboBoxInput.tsx b/src/Components/Input/ComboBoxInput.tsx index 91b49d88..8d656617 100644 --- a/src/Components/Input/ComboBoxInput.tsx +++ b/src/Components/Input/ComboBoxInput.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { useState } from 'react' import * as React from 'react' @@ -9,7 +10,6 @@ interface ComboBoxProps { } const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => { - // eslint-disable-next-line no-unused-vars const [selectedValue, setSelectedValue] = useState(value) const handleChange = (e: React.ChangeEvent) => { diff --git a/src/Components/Input/SelectBox.tsx b/src/Components/Input/SelectBox.tsx index 4bcf3a09..aed5e04b 100644 --- a/src/Components/Input/SelectBox.tsx +++ b/src/Components/Input/SelectBox.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/consistent-type-definitions */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { useState } from 'react' import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon' import * as React from 'react' diff --git a/src/Components/Input/TextAreaInput.tsx b/src/Components/Input/TextAreaInput.tsx index fc66f731..03593d2f 100644 --- a/src/Components/Input/TextAreaInput.tsx +++ b/src/Components/Input/TextAreaInput.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/consistent-type-definitions */ +/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ import * as React from 'react' import { useEffect, useRef, useState } from 'react' import Tribute from 'tributejs' diff --git a/src/Components/Input/TextInput.tsx b/src/Components/Input/TextInput.tsx index 2c1248d3..aa248c7c 100644 --- a/src/Components/Input/TextInput.tsx +++ b/src/Components/Input/TextInput.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/consistent-type-definitions */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ import { useEffect, useState } from 'react' import * as React from 'react' diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index bb308b65..0bd166e8 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as React from 'react' import { Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet' import { Item, LayerProps, Tag } from '../../types' @@ -171,7 +180,7 @@ export const Layer = ({ } let title = '' if (item.name) title = item.name - else if (item.layer?.itemNameField) title = getValue(item, item.layer.itemNameField) + else if (item.layer.itemNameField) title = getValue(item, item.layer.itemNameField) document.title = `${document.title.split('-')[0]} - ${title}` } }, @@ -187,7 +196,7 @@ export const Layer = ({ if (window.location.pathname.split('/')[1]) { const id = window.location.pathname.split('/')[1] const ref = leafletRefs[id] - if (ref?.marker && ref.item.layer?.name === name) { + if (ref.marker && ref.item.layer?.name === name) { ref.marker && clusterRef.hasLayer(ref.marker) && clusterRef?.zoomToShowLayer(ref.marker, () => { @@ -195,7 +204,7 @@ export const Layer = ({ }) let title = '' if (ref.item.name) title = ref.item.name - else if (ref.item.layer?.itemNameField) + else if (ref.item.layer.itemNameField) title = getValue(ref.item.name, ref.item.layer.itemNameField) document.title = `${document.title.split('-')[0]} - ${title}` document @@ -233,7 +242,7 @@ export const Layer = ({ {items && items .filter((item) => item.layer?.name === name) - ?.filter((item) => + .filter((item) => filterTags.length === 0 ? item : filterTags.some((tag) => @@ -243,7 +252,7 @@ export const Layer = ({ ), ), ) - ?.filter((item) => item.layer && isLayerVisible(item.layer)) + .filter((item) => item.layer && isLayerVisible(item.layer)) .filter( (item) => (item.group_type && isGroupTypeVisible(item.group_type)) || @@ -254,7 +263,7 @@ export const Layer = ({ if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField) else item[itemTextField] = '' - if (item?.tags) { + if (item.tags) { item[itemTextField] = item[itemTextField] + '\n\n' item.tags.map((tag) => { if (!item[itemTextField].includes(`#${encodeTag(tag)}`)) { @@ -372,7 +381,7 @@ export const Layer = ({ // {children}} } {itemFormPopup && - itemFormPopup.layer!.name === name && + itemFormPopup.layer.name === name && (children && React.Children.toArray(children).some( (child) => React.isValidElement(child) && child.props.__TYPE === 'ItemForm', @@ -381,10 +390,10 @@ export const Layer = ({ React.isValidElement(child) && child.props.__TYPE === 'ItemForm' ? ( {child} @@ -395,10 +404,10 @@ export const Layer = ({ ) : ( <> ))} diff --git a/src/Components/Map/Subcomponents/AddButton.tsx b/src/Components/Map/Subcomponents/AddButton.tsx index c58ecf2c..de6235c2 100644 --- a/src/Components/Map/Subcomponents/AddButton.tsx +++ b/src/Components/Map/Subcomponents/AddButton.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import * as React from 'react' import { useLayers } from '../hooks/useLayers' import { useHasUserPermission } from '../hooks/usePermissions' diff --git a/src/Components/Map/Subcomponents/Controls/Control.tsx b/src/Components/Map/Subcomponents/Controls/Control.tsx index 3ff3afa2..91c1125a 100644 --- a/src/Components/Map/Subcomponents/Controls/Control.tsx +++ b/src/Components/Map/Subcomponents/Controls/Control.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as L from 'leaflet' import * as React from 'react' diff --git a/src/Components/Map/Subcomponents/Controls/LocateControl.tsx b/src/Components/Map/Subcomponents/Controls/LocateControl.tsx index e598a276..e3920979 100644 --- a/src/Components/Map/Subcomponents/Controls/LocateControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/LocateControl.tsx @@ -1,3 +1,9 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/prefer-ts-expect-error */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import * as L from 'leaflet' import { useMap, useMapEvents } from 'react-leaflet' import 'leaflet.locatecontrol' diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx index 49a7e723..1ff35787 100644 --- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx @@ -1,3 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/require-await */ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import * as React from 'react' import { useAddFilterTag } from '../../hooks/useFilter' import useWindowDimensions from '../../hooks/useWindowDimension' @@ -23,9 +35,9 @@ export const SearchControl = () => { const [popupOpen, setPopupOpen] = useState(false) const [value, setValue] = useState('') - const [geoResults, setGeoResults] = useState>([]) - const [tagsResults, setTagsResults] = useState>([]) - const [itemsResults, setItemsResults] = useState>([]) + const [geoResults, setGeoResults] = useState([]) + const [tagsResults, setTagsResults] = useState([]) + const [itemsResults, setItemsResults] = useState([]) const [hideSuggestions, setHideSuggestions] = useState(true) const map = useMap() @@ -62,14 +74,14 @@ export const SearchControl = () => { if (item.layer?.itemTextField) item.text = getValue(item, item.layer.itemTextField) return ( value.length > 2 && - ((item.layer?.listed && item.name?.toLowerCase().includes(value.toLowerCase())) || - item.text?.toLowerCase().includes(value.toLowerCase())) + ((item.layer?.listed && item.name.toLowerCase().includes(value.toLowerCase())) || + item.text.toLowerCase().includes(value.toLowerCase())) ) }), ) let phrase = value if (value.startsWith('#')) phrase = value.substring(1) - setTagsResults(tags.filter((tag) => tag.name?.toLowerCase().includes(phrase.toLowerCase()))) + setTagsResults(tags.filter((tag) => tag.name.toLowerCase().includes(phrase.toLowerCase()))) }, 500, [value], diff --git a/src/Components/Map/Subcomponents/Controls/TagsControl.tsx b/src/Components/Map/Subcomponents/Controls/TagsControl.tsx index ca3230bc..0f823769 100644 --- a/src/Components/Map/Subcomponents/Controls/TagsControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/TagsControl.tsx @@ -17,7 +17,7 @@ export const TagsControl = () => {
diff --git a/src/Components/Map/Subcomponents/ItemFormPopup.tsx b/src/Components/Map/Subcomponents/ItemFormPopup.tsx index 45a95ebc..76960648 100644 --- a/src/Components/Map/Subcomponents/ItemFormPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemFormPopup.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as React from 'react' import { LatLng } from 'leaflet' import { Popup as LeafletPopup, useMap } from 'react-leaflet' @@ -24,7 +33,6 @@ export interface ItemFormPopupProps { export function ItemFormPopup(props: ItemFormPopupProps) { const [spinner, setSpinner] = useState(false) - // eslint-disable-next-line no-unused-vars const [popupTitle, setPopupTitle] = useState('') const formRef = useRef(null) @@ -34,7 +42,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) { const addItem = useAddItem() const updateItem = useUpdateItem() const items = useItems() - // eslint-disable-next-line no-unused-vars + const removeItem = useRemoveItem() const tags = useTags() @@ -93,7 +101,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) { try { props.layer.onlyOnePerOwner && item && - (await props.layer.api?.updateItem!({ ...formItem, id: item?.id })) + (await props.layer.api?.updateItem!({ ...formItem, id: item.id })) ;(!props.layer.onlyOnePerOwner || !item) && (await props.layer.api?.createItem!({ ...formItem, diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx index be0d5571..1a3729e7 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/HeaderView.tsx @@ -1,3 +1,14 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/require-await */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import * as React from 'react' import { Item, ItemsApi } from '../../../../types' import { useHasUserPermission } from '../../hooks/usePermissions' @@ -50,16 +61,16 @@ export function HeaderView({ `${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}` : item.layer?.itemAvatarField && item && - getValue(item, item.layer?.itemAvatarField) && + getValue(item, item.layer.itemAvatarField) && assetsApi.url + - getValue(item, item.layer?.itemAvatarField) + + getValue(item, item.layer.itemAvatarField) + `${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}` const title = itemNameField ? getValue(item, itemNameField) - : item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField) + : item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField) const subtitle = itemSubnameField ? getValue(item, itemSubnameField) - : item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField) + : item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField) const [address] = React.useState('') diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.tsx index 2dcf4107..965f0317 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupButton.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { Link } from 'react-router-dom' import { getValue } from '../../../../Utils/GetValue' import { Item } from '../../../../types' diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx index 4a728ee0..70d9f21c 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/PopupStartEndInput.tsx @@ -1,8 +1,9 @@ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ import * as React from 'react' import { TextInput } from '../../../Input' import { Item } from '../../../../types' -type StartEndInputProps = { +interface StartEndInputProps { item?: Item showLabels?: boolean updateStartValue?: (value: string) => void diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.tsx index 8b924442..f216d6e5 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/StartEndView.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ import * as React from 'react' import { Item } from '../../../../types' diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index fb749735..56994c4c 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { Item } from '../../../../types' import { useTags } from '../../hooks/useTags' import { useAddFilterTag } from '../../hooks/useFilter' @@ -31,7 +40,7 @@ export const TextView = ({ } else if (itemTextField && item) { text = getValue(item, itemTextField) } else { - text = item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : '' + text = item?.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : '' } if (item && text && truncate) text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100) @@ -106,10 +115,10 @@ export const TextView = ({ return ( { e.stopPropagation() - addFilterTag(tag!) + addFilterTag(tag) }} > {decodeTag(children)} diff --git a/src/Components/Map/Subcomponents/ItemViewPopup.tsx b/src/Components/Map/Subcomponents/ItemViewPopup.tsx index e563989b..f4336ce4 100644 --- a/src/Components/Map/Subcomponents/ItemViewPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemViewPopup.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as React from 'react' import { Popup as LeafletPopup, useMap } from 'react-leaflet' import { Item } from '../../../types' diff --git a/src/Components/Map/Subcomponents/SelectPosition.tsx b/src/Components/Map/Subcomponents/SelectPosition.tsx index 26c6d73c..962be771 100644 --- a/src/Components/Map/Subcomponents/SelectPosition.tsx +++ b/src/Components/Map/Subcomponents/SelectPosition.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ export const SelectPosition = ({ setSelectNewItemPosition }: { setSelectNewItemPosition }) => { return (
diff --git a/src/Components/Map/Tags.tsx b/src/Components/Map/Tags.tsx index a5118eb8..89352561 100644 --- a/src/Components/Map/Tags.tsx +++ b/src/Components/Map/Tags.tsx @@ -27,16 +27,16 @@ export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi }) { const decodedTags = urlTags ? decodeURIComponent(urlTags) : '' const decodedTagsArray = decodedTags.split(';') if ( - decodedTagsArray?.some( + decodedTagsArray.some( (ut) => !filterTags.find((ft) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()), ) || - filterTags?.some( + filterTags.some( (ft) => - !decodedTagsArray?.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()), + !decodedTagsArray.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()), ) ) { resetFilterTags() - decodedTagsArray?.map((urlTag) => { + decodedTagsArray.map((urlTag) => { const tag = tags.find((t) => t.name.toLocaleLowerCase() === urlTag.toLocaleLowerCase()) tag && addFilterTag(tag) return null diff --git a/src/Components/Map/UtopiaMapInner.tsx b/src/Components/Map/UtopiaMapInner.tsx index 80e7d4d8..e80887a0 100644 --- a/src/Components/Map/UtopiaMapInner.tsx +++ b/src/Components/Map/UtopiaMapInner.tsx @@ -1,3 +1,11 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ import { TileLayer, MapContainer, useMapEvents, GeoJSON } from 'react-leaflet' import 'leaflet/dist/leaflet.css' import * as React from 'react' @@ -99,7 +107,6 @@ export function UtopiaMapInner({ ) } - // eslint-disable-next-line no-undef const onEachFeature = (feature: Feature, layer: L.Layer) => { if (feature.properties) { layer.bindPopup(feature.properties.name) @@ -157,7 +164,7 @@ export function UtopiaMapInner({ eventHandlers={{ click: (e) => { if (selectNewItemPosition) { - e.layer!.closePopup() + e.layer.closePopup() setMapClicked({ position: e.latlng, setItemFormPopup }) } }, diff --git a/src/Components/Map/hooks/useClusterRef.tsx b/src/Components/Map/hooks/useClusterRef.tsx index b70d36de..2ee00904 100644 --- a/src/Components/Map/hooks/useClusterRef.tsx +++ b/src/Components/Map/hooks/useClusterRef.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import * as React from 'react' import { createContext, useContext, useState } from 'react' diff --git a/src/Components/Map/hooks/useDebounce.tsx b/src/Components/Map/hooks/useDebounce.tsx index 2794ff83..042890c6 100644 --- a/src/Components/Map/hooks/useDebounce.tsx +++ b/src/Components/Map/hooks/useDebounce.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { useEffect } from 'react' import { useTimeout } from './useTimeout' diff --git a/src/Components/Map/hooks/useFilter.tsx b/src/Components/Map/hooks/useFilter.tsx index 6d1eb765..72c717f2 100644 --- a/src/Components/Map/hooks/useFilter.tsx +++ b/src/Components/Map/hooks/useFilter.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable no-case-declarations */ import { useCallback, useReducer, createContext, useContext } from 'react' import * as React from 'react' @@ -121,7 +125,7 @@ function useFilterManager(initialTags: Tag[]): { const urlTags = params.get('tags') const decodedTags = urlTags ? decodeURIComponent(urlTags) : '' - if (!decodedTags?.includes(tag.name)) { + if (!decodedTags.includes(tag.name)) { params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`) } if (windowDimensions.width < 786 && location.pathname.split('/').length > 2) @@ -141,7 +145,7 @@ function useFilterManager(initialTags: Tag[]): { const urlTags = params.get('tags') let newUrlTags = '' const tags = urlTags?.split(';') - if (tags?.length === 0 && urlTags?.length && urlTags?.length > 0) tags[0] = urlTags + if (tags?.length === 0 && urlTags?.length && urlTags.length > 0) tags[0] = urlTags tags?.map((urlTag) => { if (!(urlTag.toLocaleLowerCase() === name.toLocaleLowerCase())) { newUrlTags = newUrlTags + `${newUrlTags === '' ? urlTag : `;${urlTag}`}` diff --git a/src/Components/Map/hooks/useItems.tsx b/src/Components/Map/hooks/useItems.tsx index 0b75cf86..7f0c7190 100644 --- a/src/Components/Map/hooks/useItems.tsx +++ b/src/Components/Map/hooks/useItems.tsx @@ -1,3 +1,11 @@ +/* eslint-disable @typescript-eslint/require-await */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-misused-promises */ import { useCallback, useReducer, createContext, useContext, useState } from 'react' import * as React from 'react' import { Item, LayerProps } from '../../../types' diff --git a/src/Components/Map/hooks/useLayers.tsx b/src/Components/Map/hooks/useLayers.tsx index d37197a7..b4a35468 100644 --- a/src/Components/Map/hooks/useLayers.tsx +++ b/src/Components/Map/hooks/useLayers.tsx @@ -1,8 +1,12 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ import { useCallback, useReducer, createContext, useContext } from 'react' import * as React from 'react' import { LayerProps } from '../../../types' -type ActionType = { type: 'ADD LAYER'; layer: LayerProps } +interface ActionType { + type: 'ADD LAYER' + layer: LayerProps +} type UseItemManagerResult = ReturnType diff --git a/src/Components/Map/hooks/useLeafletRefs.tsx b/src/Components/Map/hooks/useLeafletRefs.tsx index 73c7a4a8..de9cd82a 100644 --- a/src/Components/Map/hooks/useLeafletRefs.tsx +++ b/src/Components/Map/hooks/useLeafletRefs.tsx @@ -1,9 +1,11 @@ +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable @typescript-eslint/no-empty-function */ import { useCallback, useReducer, createContext, useContext } from 'react' import * as React from 'react' import { Item } from '../../../types' import { Marker, Popup } from 'leaflet' -type LeafletRef = { +interface LeafletRef { item: Item marker: Marker popup: Popup diff --git a/src/Components/Map/hooks/usePermissions.tsx b/src/Components/Map/hooks/usePermissions.tsx index e9cbbe7c..d56b6159 100644 --- a/src/Components/Map/hooks/usePermissions.tsx +++ b/src/Components/Map/hooks/usePermissions.tsx @@ -1,3 +1,11 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { useCallback, useReducer, createContext, useContext } from 'react' import * as React from 'react' import { Item, ItemsApi, LayerProps, Permission, PermissionAction } from '../../../types' diff --git a/src/Components/Map/hooks/useSelectPosition.tsx b/src/Components/Map/hooks/useSelectPosition.tsx index 8d3cc355..855fea30 100644 --- a/src/Components/Map/hooks/useSelectPosition.tsx +++ b/src/Components/Map/hooks/useSelectPosition.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +/* eslint-disable @typescript-eslint/await-thenable */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ import * as React from 'react' import { createContext, useContext, useEffect, useState } from 'react' import { Geometry, Item, LayerProps } from '../../../types' @@ -7,7 +16,7 @@ import { useHasUserPermission } from './usePermissions' import { LatLng } from 'leaflet' import { ItemFormPopupProps } from '../Subcomponents/ItemFormPopup' -type PolygonClickedProps = { +interface PolygonClickedProps { position: LatLng setItemFormPopup: React.Dispatch> } @@ -51,15 +60,14 @@ function useSelectPositionManager(): { mapClicked && mapClicked.setItemFormPopup({ layer: selectPosition as LayerProps, - position: mapClicked?.position, + position: mapClicked.position, }) setSelectPosition(null) } if ('text' in selectPosition) { const position = - mapClicked?.position.lng && - new Geometry(mapClicked?.position.lng, mapClicked?.position.lat) - position && itemUpdatePosition({ ...(selectPosition as Item), position }) + mapClicked?.position.lng && new Geometry(mapClicked.position.lng, mapClicked.position.lat) + position && itemUpdatePosition({ ...selectPosition, position }) setSelectPosition(null) } } @@ -70,11 +78,11 @@ function useSelectPositionManager(): { const itemUpdateParent = async (updatedItem: Item) => { if ( markerClicked?.layer?.api?.collectionName && - hasUserPermission(markerClicked?.layer?.api?.collectionName, 'update', markerClicked) + hasUserPermission(markerClicked.layer.api.collectionName, 'update', markerClicked) ) { let success = false try { - await updatedItem?.layer?.api?.updateItem!({ + await updatedItem.layer?.api?.updateItem!({ id: updatedItem.id, parent: updatedItem.parent, position: null, @@ -99,7 +107,7 @@ function useSelectPositionManager(): { const itemUpdatePosition = async (updatedItem: Item) => { let success = false try { - await updatedItem?.layer?.api?.updateItem!({ + await updatedItem.layer?.api?.updateItem!({ id: updatedItem.id, position: updatedItem.position, }) @@ -118,12 +126,12 @@ function useSelectPositionManager(): { const newRelations = markerClicked.relations || [] if (!newRelations.some((r) => r.related_items_id === id)) { - newRelations?.push({ items_id: markerClicked.id, related_items_id: id }) + newRelations.push({ items_id: markerClicked.id, related_items_id: id }) const updatedItem = { id: markerClicked.id, relations: newRelations } let success = false try { - await markerClicked?.layer?.api?.updateItem!(updatedItem) + await markerClicked.layer?.api?.updateItem!(updatedItem) success = true } catch (error) { toast.error(error.toString()) diff --git a/src/Components/Map/hooks/useTags.tsx b/src/Components/Map/hooks/useTags.tsx index 06002842..036fc232 100644 --- a/src/Components/Map/hooks/useTags.tsx +++ b/src/Components/Map/hooks/useTags.tsx @@ -1,3 +1,13 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { useCallback, useReducer, createContext, useContext, useState } from 'react' import * as React from 'react' import { Item, ItemsApi, Tag } from '../../../types' @@ -77,14 +87,14 @@ function useTagsManager(initialTags: Tag[]): { tag, }) if (!tags.some((t) => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) { - api?.createItem && api.createItem(tag) + api.createItem && api.createItem(tag) } } const getItemTags = useCallback( (item: Item) => { const text = - item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : undefined + item.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : undefined const itemTagStrings = text?.match(hashTagRegex) const itemTags: Tag[] = [] itemTagStrings?.map((tag) => { diff --git a/src/Components/Map/hooks/useTimeout.tsx b/src/Components/Map/hooks/useTimeout.tsx index db8aa43e..2a49cb23 100644 --- a/src/Components/Map/hooks/useTimeout.tsx +++ b/src/Components/Map/hooks/useTimeout.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { useCallback, useEffect, useRef } from 'react' export const useTimeout = (callback, delay) => { diff --git a/src/Components/Map/setItemLocation.tsx b/src/Components/Map/setItemLocation.tsx index 9bbe1f22..7fb310a9 100644 --- a/src/Components/Map/setItemLocation.tsx +++ b/src/Components/Map/setItemLocation.tsx @@ -1,7 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { useMap } from 'react-leaflet' export const setItemLocation = () => { - // eslint-disable-next-line no-unused-vars, react-hooks/rules-of-hooks + // eslint-disable-next-line react-hooks/rules-of-hooks const map = useMap() return
diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index 03ea4271..d93b2afd 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -1,3 +1,10 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable no-constant-condition */ import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems' import { useEffect, useState } from 'react' @@ -80,25 +87,25 @@ export function ProfileForm({ userType }: { userType: string }) { useEffect(() => { const newColor = - item.layer?.itemColorField && getValue(item, item.layer?.itemColorField) - ? getValue(item, item.layer?.itemColorField) + item.layer?.itemColorField && getValue(item, item.layer.itemColorField) + ? getValue(item, item.layer.itemColorField) : getItemTags(item) && getItemTags(item)[0]?.color ? getItemTags(item)[0].color - : item?.layer?.markerDefaultColor + : item.layer?.markerDefaultColor - const offers = (item?.offers ?? []).reduce((acc: Tag[], o) => { + const offers = (item.offers ?? []).reduce((acc: Tag[], o) => { const offer = tags.find((t) => t.id === o.tags_id) if (offer) acc.push(offer) return acc }, []) - const needs = (item?.needs ?? []).reduce((acc: Tag[], o) => { + const needs = (item.needs ?? []).reduce((acc: Tag[], o) => { const need = tags.find((t) => t.id === o.tags_id) if (need) acc.push(need) return acc }, []) - const relations = (item?.relations ?? []).reduce((acc: Item[], r) => { + const relations = (item.relations ?? []).reduce((acc: Item[], r) => { const relatedItem = items.find((i) => i.id === r.related_items_id) if (relatedItem) acc.push(relatedItem) return acc @@ -106,22 +113,22 @@ export function ProfileForm({ userType }: { userType: string }) { setState({ color: newColor, - id: item?.id ?? '', - groupType: item?.group_type ?? 'wuerdekompass', - status: item?.status ?? 'active', - name: item?.name ?? '', - subname: item?.subname ?? '', - text: item?.text ?? '', - contact: item?.contact ?? '', - telephone: item?.telephone ?? '', - nextAppointment: item?.next_appointment ?? '', - image: item?.image ?? '', - markerIcon: item?.marker_icon ?? '', + id: item.id ?? '', + groupType: item.group_type ?? 'wuerdekompass', + status: item.status ?? 'active', + name: item.name ?? '', + subname: item.subname ?? '', + text: item.text ?? '', + contact: item.contact ?? '', + telephone: item.telephone ?? '', + nextAppointment: item.next_appointment ?? '', + image: item.image ?? '', + markerIcon: item.marker_icon ?? '', offers, needs, relations, - start: item?.start ?? '', - end: item?.end ?? '', + start: item.start ?? '', + end: item.end ?? '', }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [item, tags, items]) @@ -180,7 +187,7 @@ export function ProfileForm({ userType }: { userType: string }) { style={ true ? { - backgroundColor: `${item.layer?.itemColorField && getValue(item, item.layer?.itemColorField) ? getValue(item, item.layer?.itemColorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`, + backgroundColor: `${item.layer?.itemColorField && getValue(item, item.layer.itemColorField) ? getValue(item, item.layer.itemColorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`, color: '#fff', } : { color: '#fff' } diff --git a/src/Components/Profile/ProfileView.tsx b/src/Components/Profile/ProfileView.tsx index a85a31fd..6656b52a 100644 --- a/src/Components/Profile/ProfileView.tsx +++ b/src/Components/Profile/ProfileView.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/await-thenable */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { MapOverlayPage } from '../Templates' import { useItems, useRemoveItem, useUpdateItem } from '../Map/hooks/useItems' import { useLocation, useNavigate } from 'react-router-dom' @@ -26,9 +35,9 @@ export function ProfileView({ }) { const [item, setItem] = useState() const [updatePermission, setUpdatePermission] = useState(false) - const [relations, setRelations] = useState>([]) - const [offers, setOffers] = useState>([]) - const [needs, setNeeds] = useState>([]) + const [relations, setRelations] = useState([]) + const [offers, setOffers] = useState([]) + const [needs, setNeeds] = useState([]) const [loading, setLoading] = useState(false) const [template, setTemplate] = useState('') @@ -45,7 +54,7 @@ export function ProfileView({ const clusterRef = useClusterRef() const leafletRefs = useLeafletRefs() - const [attestations, setAttestations] = useState>([]) + const [attestations, setAttestations] = useState([]) useEffect(() => { if (attestationApi) { diff --git a/src/Components/Profile/Subcomponents/ActionsButton.tsx b/src/Components/Profile/Subcomponents/ActionsButton.tsx index bcbc7382..a9636947 100644 --- a/src/Components/Profile/Subcomponents/ActionsButton.tsx +++ b/src/Components/Profile/Subcomponents/ActionsButton.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import { useState } from 'react' import { useHasUserPermission } from '../../Map/hooks/usePermissions' import DialogModal from '../../Templates/DialogModal' @@ -52,7 +56,7 @@ export function ActionButton({ setModalOpen(true) }} style={{ - backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`, + backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`, color: '#fff', }} > @@ -76,7 +80,7 @@ export function ActionButton({ triggerAddButton() }} style={{ - backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`, + backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`, color: '#fff', }} > diff --git a/src/Components/Profile/Subcomponents/AvatarWidget.tsx b/src/Components/Profile/Subcomponents/AvatarWidget.tsx index 380928ab..bd9b5cd7 100644 --- a/src/Components/Profile/Subcomponents/AvatarWidget.tsx +++ b/src/Components/Profile/Subcomponents/AvatarWidget.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ import * as React from 'react' import { useState, useCallback, useRef } from 'react' import ReactCrop, { Crop, centerCrop, makeAspectCrop } from 'react-image-crop' diff --git a/src/Components/Profile/Subcomponents/ColorPicker.tsx b/src/Components/Profile/Subcomponents/ColorPicker.tsx index d9e25faa..7f8a5659 100644 --- a/src/Components/Profile/Subcomponents/ColorPicker.tsx +++ b/src/Components/Profile/Subcomponents/ColorPicker.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { useCallback, useEffect, useRef, useState } from 'react' import * as React from 'react' import { HexColorPicker } from 'react-colorful' diff --git a/src/Components/Profile/Subcomponents/ContactInfo.tsx b/src/Components/Profile/Subcomponents/ContactInfo.tsx index 70555384..714fa3a6 100644 --- a/src/Components/Profile/Subcomponents/ContactInfo.tsx +++ b/src/Components/Profile/Subcomponents/ContactInfo.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ import { Link } from 'react-router-dom' import { useAssetApi } from '../../AppShell/hooks/useAssets' diff --git a/src/Components/Profile/Subcomponents/FormHeader.tsx b/src/Components/Profile/Subcomponents/FormHeader.tsx index 86ccf924..d58a70b3 100644 --- a/src/Components/Profile/Subcomponents/FormHeader.tsx +++ b/src/Components/Profile/Subcomponents/FormHeader.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable react/prop-types */ import { TextInput } from '../../Input' import { AvatarWidget } from './AvatarWidget' diff --git a/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.tsx b/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.tsx index 213fefad..c2277f1a 100644 --- a/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.tsx +++ b/src/Components/Profile/Subcomponents/LinkedItemsHeaderView.tsx @@ -1,3 +1,10 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { useEffect } from 'react' import { getValue } from '../../../Utils/GetValue' import { Item } from '../../../types' @@ -27,14 +34,14 @@ export function LinkedItemsHeaderView({ ? assetsApi.url + getValue(item, itemAvatarField) : item.layer?.itemAvatarField && item && - getValue(item, item.layer?.itemAvatarField) && - assetsApi.url + getValue(item, item.layer?.itemAvatarField) + getValue(item, item.layer.itemAvatarField) && + assetsApi.url + getValue(item, item.layer.itemAvatarField) const title = itemNameField ? getValue(item, itemNameField) - : item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField) + : item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField) const subtitle = itemSubnameField ? getValue(item, itemSubnameField) - : item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField) + : item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField) useEffect(() => {}, [item]) diff --git a/src/Components/Profile/Subcomponents/PlusButton.tsx b/src/Components/Profile/Subcomponents/PlusButton.tsx index 72755cb1..70cbcdd3 100644 --- a/src/Components/Profile/Subcomponents/PlusButton.tsx +++ b/src/Components/Profile/Subcomponents/PlusButton.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { LayerProps } from '../../../types' import { useHasUserPermission } from '../../Map/hooks/usePermissions' diff --git a/src/Components/Profile/Subcomponents/ProfileSubHeader.tsx b/src/Components/Profile/Subcomponents/ProfileSubHeader.tsx index 24ef03db..84e69758 100644 --- a/src/Components/Profile/Subcomponents/ProfileSubHeader.tsx +++ b/src/Components/Profile/Subcomponents/ProfileSubHeader.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import SocialShareBar from './SocialShareBar' /* const flags = { diff --git a/src/Components/Profile/Subcomponents/RelationCard.tsx b/src/Components/Profile/Subcomponents/RelationCard.tsx index 277e1ae4..30d84ea4 100644 --- a/src/Components/Profile/Subcomponents/RelationCard.tsx +++ b/src/Components/Profile/Subcomponents/RelationCard.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ // eslint-disable-next-line react/prop-types const RelationCard = ({ title, description, imageSrc }) => (
diff --git a/src/Components/Profile/Subcomponents/SocialShareBar.tsx b/src/Components/Profile/Subcomponents/SocialShareBar.tsx index f1f7656b..05b5af75 100644 --- a/src/Components/Profile/Subcomponents/SocialShareBar.tsx +++ b/src/Components/Profile/Subcomponents/SocialShareBar.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import SocialShareButton from './SocialShareButton' const SocialShareBar = ({ diff --git a/src/Components/Profile/Subcomponents/SocialShareButton.tsx b/src/Components/Profile/Subcomponents/SocialShareButton.tsx index 8ccdedb4..110b6c2c 100644 --- a/src/Components/Profile/Subcomponents/SocialShareButton.tsx +++ b/src/Components/Profile/Subcomponents/SocialShareButton.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import * as React from 'react' const platformConfigs = { diff --git a/src/Components/Profile/Subcomponents/TagsWidget.tsx b/src/Components/Profile/Subcomponents/TagsWidget.tsx index 753ac6e4..9f79dd89 100644 --- a/src/Components/Profile/Subcomponents/TagsWidget.tsx +++ b/src/Components/Profile/Subcomponents/TagsWidget.tsx @@ -1,3 +1,9 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import * as React from 'react' import { useEffect, useState } from 'react' import { useTags } from '../../Map/hooks/useTags' @@ -11,10 +17,10 @@ export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate const [input, setInput] = useState('') const [isKeyReleased, setIsKeyReleased] = useState(false) const tags = useTags() - const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState>([]) + const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState([]) const [focusInput, setFocusInput] = useState(false) - const [currentTags, setCurrentTags] = useState>(defaultTags) + const [currentTags, setCurrentTags] = useState(defaultTags) useEffect(() => { setCurrentTags(defaultTags) diff --git a/src/Components/Profile/Templates/OnepagerForm.tsx b/src/Components/Profile/Templates/OnepagerForm.tsx index cc8e756b..7f76ac2b 100644 --- a/src/Components/Profile/Templates/OnepagerForm.tsx +++ b/src/Components/Profile/Templates/OnepagerForm.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import * as React from 'react' import { useEffect } from 'react' import { Item, Tag } from '../../../types' @@ -34,7 +37,7 @@ export const OnepagerForm = ({ case 'wuerdekompass': setState((prevState) => ({ ...prevState, - color: item?.layer?.menuColor || '#1A5FB4', + color: item.layer?.menuColor || '#1A5FB4', markerIcon: 'group', image: '59e6a346-d1ee-4767-9e42-fc720fb535c9', })) diff --git a/src/Components/Profile/Templates/OnepagerView.tsx b/src/Components/Profile/Templates/OnepagerView.tsx index 4faf6ec4..7949f8ce 100644 --- a/src/Components/Profile/Templates/OnepagerView.tsx +++ b/src/Components/Profile/Templates/OnepagerView.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { Item } from '../../../types' import { TextView } from '../../Map' import ContactInfo from '../Subcomponents/ContactInfo' diff --git a/src/Components/Profile/Templates/SimpleForm.tsx b/src/Components/Profile/Templates/SimpleForm.tsx index c77c6df3..68fd1a06 100644 --- a/src/Components/Profile/Templates/SimpleForm.tsx +++ b/src/Components/Profile/Templates/SimpleForm.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { TextAreaInput } from '../../Input' // eslint-disable-next-line react/prop-types diff --git a/src/Components/Profile/Templates/TabsForm.tsx b/src/Components/Profile/Templates/TabsForm.tsx index 38f47a8e..fc5d2ecd 100644 --- a/src/Components/Profile/Templates/TabsForm.tsx +++ b/src/Components/Profile/Templates/TabsForm.tsx @@ -1,3 +1,10 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable react/prop-types */ import { useCallback, useEffect, useState } from 'react' import { TextAreaInput } from '../../Input' diff --git a/src/Components/Profile/Templates/TabsView.tsx b/src/Components/Profile/Templates/TabsView.tsx index 2f3276af..e038bf55 100644 --- a/src/Components/Profile/Templates/TabsView.tsx +++ b/src/Components/Profile/Templates/TabsView.tsx @@ -1,3 +1,11 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { StartEndView, TextView } from '../../Map' import { TagView } from '../../Templates/TagView' import { LinkedItemsHeaderView } from '../Subcomponents/LinkedItemsHeaderView' @@ -22,12 +30,12 @@ export const TabsView = ({ linkItem, unlinkItem, }: { - attestations: Array + attestations: any[] userType: string item: Item - offers: Array - needs: Array - relations: Array + offers: Tag[] + needs: Tag[] + relations: Item[] updatePermission: boolean loading: boolean linkItem: (id: string) => Promise @@ -110,7 +118,7 @@ export const TabsView = ({ className={ 'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]' } - aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`} + aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`} checked={activeTab === 2 && true} onChange={() => updateActiveTab(2)} /> @@ -175,8 +183,8 @@ export const TabsView = ({ type='radio' name='my_tabs_2' role='tab' - className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer?.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`} - aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`} + className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`} + aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`} checked={activeTab === 3 && true} onChange={() => updateActiveTab(3)} /> @@ -192,7 +200,7 @@ export const TabsView = ({
{offers.map((o) => ( { addFilterTag(o) @@ -209,7 +217,7 @@ export const TabsView = ({

Needs

{needs.map((n) => ( - addFilterTag(n)} /> + addFilterTag(n)} /> ))}
@@ -229,7 +237,7 @@ export const TabsView = ({ name='my_tabs_2' role='tab' className='tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]' - aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`} + aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`} checked={activeTab === 7 && true} onChange={() => updateActiveTab(7)} /> diff --git a/src/Components/Profile/UserSettings.tsx b/src/Components/Profile/UserSettings.tsx index 1784c3cf..20813730 100644 --- a/src/Components/Profile/UserSettings.tsx +++ b/src/Components/Profile/UserSettings.tsx @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as React from 'react' import { MapOverlayPage } from '../Templates' import { useNavigate } from 'react-router-dom' diff --git a/src/Components/Profile/hooks/useClickOutside.tsx b/src/Components/Profile/hooks/useClickOutside.tsx index 0f61ec9c..4217f0e6 100644 --- a/src/Components/Profile/hooks/useClickOutside.tsx +++ b/src/Components/Profile/hooks/useClickOutside.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { useEffect } from 'react' // Improved version of https://usehooks.com/useOnClickOutside/ diff --git a/src/Components/Profile/itemFunctions.ts b/src/Components/Profile/itemFunctions.ts index 4271a5d8..f60cb614 100644 --- a/src/Components/Profile/itemFunctions.ts +++ b/src/Components/Profile/itemFunctions.ts @@ -1,3 +1,14 @@ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as React from 'react' import { Item } from '../../types' import { encodeTag } from '../../Utils/FormatTags' @@ -140,7 +151,7 @@ export const onUpdateItem = async ( ) => { let changedItem = {} as Item - const offerUpdates: Array = [] + const offerUpdates: any[] = [] // check for new offers await state.offers?.map((o) => { const existingOffer = item?.offers?.find((t) => t.tags_id === o.id) @@ -150,7 +161,7 @@ export const onUpdateItem = async ( return null }) - const needsUpdates: Array = [] + const needsUpdates: any[] = [] await state.needs?.map((n) => { const existingNeed = item?.needs?.find((t) => t.tags_id === n.id) @@ -181,8 +192,8 @@ export const onUpdateItem = async ( ...(state.needs.length > 0 && { needs: needsUpdates }), } - const offersState: Array = [] - const needsState: Array = [] + const offersState: any[] = [] + const needsState: any[] = [] state.offers.map((o) => { offersState.push({ items_id: item?.id, tags_id: o.id }) diff --git a/src/Components/Templates/AttestationForm.tsx b/src/Components/Templates/AttestationForm.tsx index e99f6b89..48929453 100644 --- a/src/Components/Templates/AttestationForm.tsx +++ b/src/Components/Templates/AttestationForm.tsx @@ -1,3 +1,12 @@ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/require-await */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-floating-promises */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as React from 'react' import { MapOverlayPage } from './MapOverlayPage' import { useItems } from '../Map/hooks/useItems' @@ -11,7 +20,7 @@ import { toast } from 'react-toastify' export const AttestationForm = ({ api }: { api?: ItemsApi }) => { const items = useItems() const assetsApi = useAssetApi() - const [users, setUsers] = useState>() + const [users, setUsers] = useState() const navigate = useNavigate() useEffect(() => { @@ -36,7 +45,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi }) => { } const sendAttestation = async () => { - const to: Array = [] + const to: any[] = [] users?.map((u) => to.push({ directus_users_id: u.user_created.id })) api?.createItem && diff --git a/src/Components/Templates/CardPage.tsx b/src/Components/Templates/CardPage.tsx index 53481ee0..9722f6e3 100644 --- a/src/Components/Templates/CardPage.tsx +++ b/src/Components/Templates/CardPage.tsx @@ -11,7 +11,7 @@ export function CardPage({ title: string hideTitle?: boolean children?: React.ReactNode - parents?: Array<{ name: string; path: string }> + parents?: { name: string; path: string }[] }) { return (
diff --git a/src/Components/Templates/CircleLayout.tsx b/src/Components/Templates/CircleLayout.tsx index 1405eb01..f36b8681 100644 --- a/src/Components/Templates/CircleLayout.tsx +++ b/src/Components/Templates/CircleLayout.tsx @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { useEffect, useRef } from 'react' export const CircleLayout = ({ diff --git a/src/Components/Templates/DateUserInfo.tsx b/src/Components/Templates/DateUserInfo.tsx index b87cc88f..25662a84 100644 --- a/src/Components/Templates/DateUserInfo.tsx +++ b/src/Components/Templates/DateUserInfo.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unnecessary-condition */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ import { useState } from 'react' import { timeAgo } from '../../Utils/TimeAgo' import { Item } from '../../types' diff --git a/src/Components/Templates/DialogModal.tsx b/src/Components/Templates/DialogModal.tsx index d6351374..8951048e 100644 --- a/src/Components/Templates/DialogModal.tsx +++ b/src/Components/Templates/DialogModal.tsx @@ -7,7 +7,7 @@ const isClickInsideRectangle = (e: MouseEvent, element: HTMLElement) => { return e.clientX > r.left && e.clientX < r.right && e.clientY > r.top && e.clientY < r.bottom } -type Props = { +interface Props { title: string isOpened: boolean onClose: () => void @@ -43,7 +43,7 @@ const DialogModal = ({ if (isOpened) { return ( {i.layer?.itemType.show_start_end && } {i.layer?.itemType.show_text && ( - + )}
diff --git a/src/Components/Templates/MapOverlayPage.tsx b/src/Components/Templates/MapOverlayPage.tsx index 265ab7b4..1e5d86cd 100644 --- a/src/Components/Templates/MapOverlayPage.tsx +++ b/src/Components/Templates/MapOverlayPage.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as L from 'leaflet' import * as React from 'react' import { useNavigate } from 'react-router-dom' diff --git a/src/Components/Templates/MarketView.tsx b/src/Components/Templates/MarketView.tsx index e0af1459..8b5adc31 100644 --- a/src/Components/Templates/MarketView.tsx +++ b/src/Components/Templates/MarketView.tsx @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { useEffect, useState } from 'react' import { useItems } from '../Map/hooks/useItems' import { Tag } from '../../types' @@ -24,8 +29,8 @@ function groupAndCount(arr) { } export const MarketView = () => { - const [offers, setOffers] = useState>([]) - const [needs, setNeeds] = useState>([]) + const [offers, setOffers] = useState([]) + const [needs, setNeeds] = useState([]) const navigate = useNavigate() const items = useItems() @@ -35,13 +40,13 @@ export const MarketView = () => { setOffers([]) setNeeds([]) items.map((i) => { - i?.layer?.itemOffersField && + i.layer?.itemOffersField && getValue(i, i.layer.itemOffersField)?.map((o) => { const tag = tags.find((t) => t.id === o.tags_id) tag && setOffers((current) => [...current, tag]) return null }) - i?.layer?.itemNeedsField && + i.layer?.itemNeedsField && getValue(i, i.layer.itemNeedsField)?.map((n) => { const tag = tags.find((t) => t.id === n.tags_id) tag && setNeeds((current) => [...current, tag]) diff --git a/src/Components/Templates/OverlayItemsIndexPage.tsx b/src/Components/Templates/OverlayItemsIndexPage.tsx index 63a5cabf..61502f07 100644 --- a/src/Components/Templates/OverlayItemsIndexPage.tsx +++ b/src/Components/Templates/OverlayItemsIndexPage.tsx @@ -1,3 +1,10 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/prefer-optional-chain */ +/* eslint-disable @typescript-eslint/no-misused-promises */ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ import { useEffect, useRef, useState } from 'react' import { Item } from '../../types' import { PopupStartEndInput } from '../Map' @@ -122,7 +129,7 @@ export const OverlayItemsIndexPage = ({
{items - ?.filter((i) => i.layer?.name === layerName) + .filter((i) => i.layer?.name === layerName) .filter((item) => filterTags.length === 0 ? item @@ -133,7 +140,7 @@ export const OverlayItemsIndexPage = ({ ), ), ) - ?.sort((a, b) => { + .sort((a, b) => { // Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds) const dateA = a.date_updated ? new Date(a.date_updated).getTime() @@ -147,7 +154,7 @@ export const OverlayItemsIndexPage = ({ : 0 return dateB - dateA // Subtracts milliseconds which are numbers }) - ?.map((i, k) => ( + .map((i, k) => (
{ const users = items.filter((i) => i.layer?.itemType.name === userType) const assetsApi = useAssetApi() - const [selectedUsers, setSelectedUsers] = useState>([]) + const [selectedUsers, setSelectedUsers] = useState([]) return ( diff --git a/src/Components/Templates/TagView.tsx b/src/Components/Templates/TagView.tsx index 0ed5e18e..db080fb1 100644 --- a/src/Components/Templates/TagView.tsx +++ b/src/Components/Templates/TagView.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as React from 'react' import { decodeTag } from '../../Utils/FormatTags' import { Tag } from '../../types' diff --git a/src/Components/Templates/TitleCard.tsx b/src/Components/Templates/TitleCard.tsx index 2638f747..9c904cc0 100644 --- a/src/Components/Templates/TitleCard.tsx +++ b/src/Components/Templates/TitleCard.tsx @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +/* eslint-disable @typescript-eslint/no-explicit-any */ import Subtitle from '../Typography/Subtitle' import * as React from 'react' diff --git a/src/Components/Typography/ErrorText.tsx b/src/Components/Typography/ErrorText.tsx index c99f194a..d8f9e051 100644 --- a/src/Components/Typography/ErrorText.tsx +++ b/src/Components/Typography/ErrorText.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import * as React from 'react' // eslint-disable-next-line react/prop-types diff --git a/src/Utils/GetValue.ts b/src/Utils/GetValue.ts index 7732b461..c2d73ed3 100644 --- a/src/Utils/GetValue.ts +++ b/src/Utils/GetValue.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ export function getValue(obj, path) { if (!obj || typeof path !== 'string') return undefined diff --git a/src/Utils/MarkerIconFactory.ts b/src/Utils/MarkerIconFactory.ts index b26789f4..fe134824 100644 --- a/src/Utils/MarkerIconFactory.ts +++ b/src/Utils/MarkerIconFactory.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import * as L from 'leaflet' const createSvg = (shape: string, markerColor: string, borderColor: string) => { diff --git a/src/Utils/RandomColor.ts b/src/Utils/RandomColor.ts index 1b7b6469..daa5e1c7 100644 --- a/src/Utils/RandomColor.ts +++ b/src/Utils/RandomColor.ts @@ -1,10 +1,15 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ const goldenRatioConjugate = 0.618033988749895 export const randomColor = () => { return hsvToHex((Math.random() + goldenRatioConjugate) % 1, 0.8, 0.7) } -function hsvToHex(h, s, v) { +function hsvToHex(h: number, s: number, v: number) { let r, g, b const i = Math.floor(h * 6) const f = h * 6 - i @@ -53,6 +58,6 @@ const rgbToHex = (r, g, b) => [r, g, b] .map((x) => { const hex = x.toString(16) - return hex.length === 1 ? '0' + hex : hex + return hex.length === 1 ? `0${hex}` : hex }) .join('') diff --git a/src/Utils/ReverseGeocoder.ts b/src/Utils/ReverseGeocoder.ts index cfe99fc6..3879b291 100644 --- a/src/Utils/ReverseGeocoder.ts +++ b/src/Utils/ReverseGeocoder.ts @@ -27,9 +27,9 @@ export async function reverseGeocode(lat: number, lon: number): Promise const address = response.data.address // Extrahiere Straße, Hausnummer und Ort - const street = address.road || '' - const houseNumber = address.house_number || '' - const city = address.city || address.town || address.village || '' + const street = address.road ?? '' + const houseNumber = address.house_number ?? '' + const city = address.city ?? address.town ?? address.village ?? '' // Formatiere die Adresse const formattedAddress = `${street} ${houseNumber}, ${city}`.trim() diff --git a/src/index.tsx b/src/index.tsx index 238e8272..91ca338b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -39,8 +39,8 @@ export { export { TextInput, TextAreaInput, SelectBox } from './Components/Input' declare global { - // eslint-disable-next-line no-unused-vars interface Window { + // eslint-disable-next-line @typescript-eslint/no-explicit-any my_modal_3: any } } diff --git a/src/types.ts b/src/types.ts index 26038fe5..6eb2783f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import * as React from 'react' import { ItemFormPopupProps } from './Components/Map/Subcomponents/ItemFormPopup' @@ -82,7 +83,7 @@ export class Geometry { } } -export type Relation = { +export interface Relation { related_items_id: string [key: string]: any } @@ -103,7 +104,7 @@ export class Item { parent?: string subname?: string public_edit?: boolean; - // eslint-disable-next-line no-undef + [key: string]: any constructor( id: string, @@ -127,7 +128,7 @@ export interface AssetsApi { url: string } -export type Profile = { +export interface Profile { id?: string avatar?: string color?: string @@ -136,7 +137,7 @@ export type Profile = { geoposition?: Geometry } -export type UserItem = { +export interface UserItem { id?: string role?: any email?: string @@ -156,7 +157,7 @@ export interface UserApi { passwordReset(token: string, new_password: string) } -export type PermissionCondition = { +export interface PermissionCondition { user_created?: { _eq: string // Erwartet den speziellen Wert "$CURRENT_USER" oder eine spezifische UUID } @@ -167,7 +168,7 @@ export type PermissionCondition = { export type PermissionAction = 'create' | 'read' | 'update' | 'delete' -export type Permission = { +export interface Permission { id?: string policy: any collection: string