Skip to content

Commit 69c70b7

Browse files
committed
chore: lintfix
1 parent 3e9ea22 commit 69c70b7

14 files changed

+49
-33
lines changed

src/api/embeddingsApiHooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {SanityClient, useClient} from 'sanity'
21
import {useMemo} from 'react'
2+
import {SanityClient, useClient} from 'sanity'
33

44
export function useApiClient(): SanityClient {
55
const client = useClient({apiVersion: 'vX'})

src/api/isEnabled.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {useProjectId} from 'sanity'
2-
import {createContext, PropsWithChildren, useContext, useEffect, useState} from 'react'
31
import {Card, Text} from '@sanity/ui'
2+
import {createContext, PropsWithChildren, useContext, useEffect, useState} from 'react'
3+
import {useProjectId} from 'sanity'
4+
45
import {useApiClient} from './embeddingsApiHooks'
56

67
export type FeatureStatus = 'enabled' | 'disabled' | 'loading' | 'error'
@@ -28,7 +29,7 @@ export function useIsFeatureEnabled() {
2829
return status
2930
}
3031

31-
export function FeatureEnabledProvider(props: PropsWithChildren<{}>) {
32+
export function FeatureEnabledProvider(props: PropsWithChildren) {
3233
const status = useIsFeatureEnabled()
3334
return (
3435
<FeatureEnabledContext.Provider value={status}>{props.children}</FeatureEnabledContext.Provider>

src/embeddingsIndexDashboard/EmbeddingsIndexTool.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import {AddIcon, UndoIcon} from '@sanity/icons'
12
import {Box, Button, Card, Flex, Heading, Spinner, Stack} from '@sanity/ui'
23
import {useCallback, useEffect, useState} from 'react'
3-
import {AddIcon, UndoIcon} from '@sanity/icons'
4+
45
import {deleteIndex, getIndexes, IndexState, NamedIndex} from '../api/embeddingsApi'
5-
import {EditIndexDialog} from './IndexEditor'
6-
import {IndexList} from './IndexList'
7-
import {IndexInfo} from './IndexInfo'
86
import {useApiClient} from '../api/embeddingsApiHooks'
97
import {FeatureDisabledNotice, FeatureError, useIsFeatureEnabled} from '../api/isEnabled'
8+
import {EditIndexDialog} from './IndexEditor'
9+
import {IndexInfo} from './IndexInfo'
10+
import {IndexList} from './IndexList'
1011

1112
export function EmbeddingsIndexTool() {
1213
const featureState = useIsFeatureEnabled()

src/embeddingsIndexDashboard/IndexEditor.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {IndexState, NamedIndex} from '../api/embeddingsApi'
2-
import {useSchema} from 'sanity'
3-
import {FormEvent, useCallback, useEffect, useId, useRef, useState} from 'react'
4-
import {Box, Button, Card, Dialog, Spinner, Stack, Text} from '@sanity/ui'
51
import {AddIcon} from '@sanity/icons'
2+
import {Box, Button, Card, Dialog, Spinner, Stack, Text} from '@sanity/ui'
3+
import {FormEvent, useCallback, useEffect, useId, useRef, useState} from 'react'
4+
import {useSchema} from 'sanity'
5+
6+
import {IndexState, NamedIndex} from '../api/embeddingsApi'
67
import {useApiClient} from '../api/embeddingsApiHooks'
78
import {useDefaultIndex} from './hooks'
89
import {IndexFormInput} from './IndexFormInput'
@@ -107,6 +108,7 @@ export function IndexEditor(props: {
107108
onSubmit(response.index)
108109
}
109110
})
111+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
110112
.catch((err: any) => {
111113
console.error(err)
112114
setErrors([err.message])

src/embeddingsIndexDashboard/IndexFormInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {NamedIndex} from '../api/embeddingsApi'
1+
import {Box, Label, Stack, Text, TextArea, TextInput} from '@sanity/ui'
22
import {Dispatch, FormEvent, SetStateAction, useCallback, useId} from 'react'
3-
import {Box, Label, Stack, TextArea, TextInput, Text} from '@sanity/ui'
3+
4+
import {NamedIndex} from '../api/embeddingsApi'
45

56
export interface IndexFormInputProps {
67
index: Partial<NamedIndex>

src/embeddingsIndexDashboard/IndexInfo.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {EllipsisVerticalIcon, TrashIcon} from '@sanity/icons'
12
import {
23
Box,
34
Button,
@@ -10,11 +11,11 @@ import {
1011
Stack,
1112
Text,
1213
} from '@sanity/ui'
13-
import {EllipsisVerticalIcon, TrashIcon} from '@sanity/icons'
14+
import {useCallback} from 'react'
15+
16+
import {IndexState} from '../api/embeddingsApi'
1417
import {IndexEditor} from './IndexEditor'
1518
import {QueryIndex} from './QueryIndex'
16-
import {IndexState} from '../api/embeddingsApi'
17-
import {useCallback} from 'react'
1819

1920
export interface IndexInfoProps {
2021
selectedIndex: IndexState

src/embeddingsIndexDashboard/IndexList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {Box, Button, Card, Flex, Label, Stack, Text} from '@sanity/ui'
2-
import {IndexState} from '../api/embeddingsApi'
32
import {useCallback} from 'react'
43

4+
import {IndexState} from '../api/embeddingsApi'
5+
56
export interface IndexListProps {
67
loading: boolean
78
selectedIndex?: IndexState

src/embeddingsIndexDashboard/QueryIndex.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {useCallback, useMemo} from 'react'
2-
import {SemanticSearchAutocomplete} from '../referenceInput/SemanticSearchAutocomplete'
3-
import {EmbeddingsIndexConfig} from '../schemas/typeDefExtensions'
42
import {useRouter} from 'sanity/router'
3+
54
import {QueryResult} from '../api/embeddingsApi'
5+
import {SemanticSearchAutocomplete} from '../referenceInput/SemanticSearchAutocomplete'
6+
import {EmbeddingsIndexConfig} from '../schemas/typeDefExtensions'
67

78
export function QueryIndex(props: {indexName: string}) {
89
const {indexName} = props

src/embeddingsIndexDashboard/dashboardPlugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {definePlugin, Tool} from 'sanity'
21
import {EarthGlobeIcon} from '@sanity/icons'
2+
import {definePlugin, Tool} from 'sanity'
3+
34
import {EmbeddingsIndexTool} from './EmbeddingsIndexTool'
45

56
export const embeddingsIndexTool: Tool = {

src/embeddingsIndexDashboard/hooks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {ObjectSchemaType, Schema} from 'sanity'
21
import {useMemo} from 'react'
2+
import {ObjectSchemaType, Schema} from 'sanity'
3+
34
import {isType} from '../utils/types'
45

56
const defaultProjection = '{...}'

0 commit comments

Comments
 (0)