diff --git a/packages/@sanity/cli/src/cli.ts b/packages/@sanity/cli/src/cli.ts index 07ff10b853e3..1ef18f1ebc00 100755 --- a/packages/@sanity/cli/src/cli.ts +++ b/packages/@sanity/cli/src/cli.ts @@ -14,7 +14,7 @@ import {getInstallCommand} from './packageManager' import {type CommandRunnerOptions, type TelemetryUserProperties} from './types' import {createTelemetryStore} from './util/createTelemetryStore' import {detectRuntime} from './util/detectRuntime' -import {type CliConfigResult, getCliConfig} from './util/getCliConfig' +import {getCliConfig, type CliConfigResult} from './util/getCliConfig' import {loadEnv} from './util/loadEnv' import {mergeCommands} from './util/mergeCommands' import {neatStack} from './util/neatStack' diff --git a/packages/@sanity/import/src/importFromFolder.js b/packages/@sanity/import/src/importFromFolder.js index 5c09063cf415..220131446d69 100644 --- a/packages/@sanity/import/src/importFromFolder.js +++ b/packages/@sanity/import/src/importFromFolder.js @@ -1,8 +1,8 @@ const fs = require('fs') const path = require('path') +const debug = require('debug')('sanity:import:folder') const getFileUrl = require('file-url') const globby = require('globby') -const debug = require('debug')('sanity:import:folder') const readJson = require('./util/readJson') const rimraf = require('./util/rimraf') diff --git a/packages/@sanity/import/src/references.js b/packages/@sanity/import/src/references.js index 3cc40f4e84e0..08edcb7be350 100644 --- a/packages/@sanity/import/src/references.js +++ b/packages/@sanity/import/src/references.js @@ -1,7 +1,7 @@ +const {extractWithPath} = require('@sanity/mutator') const debug = require('debug')('sanity:import') const {get} = require('lodash') const pMap = require('p-map') -const {extractWithPath} = require('@sanity/mutator') const serializePath = require('./serializePath') const progressStepper = require('./util/progressStepper') const retryOnFailure = require('./util/retryOnFailure') diff --git a/packages/@sanity/import/src/uploadAssets.js b/packages/@sanity/import/src/uploadAssets.js index 737b832e8d2c..c1f62d51cda6 100644 --- a/packages/@sanity/import/src/uploadAssets.js +++ b/packages/@sanity/import/src/uploadAssets.js @@ -1,8 +1,8 @@ const basename = require('path').basename const parseUrl = require('url').parse +const {isSanityImageUrl} = require('@sanity/asset-utils') const debug = require('debug')('sanity:import') const pMap = require('p-map') -const {isSanityImageUrl} = require('@sanity/asset-utils') const getHashedBufferForUri = require('./util/getHashedBufferForUri') const progressStepper = require('./util/progressStepper') const retryOnFailure = require('./util/retryOnFailure') diff --git a/packages/@sanity/import/src/validateAssetDocuments.js b/packages/@sanity/import/src/validateAssetDocuments.js index 35e6ac9f9deb..97d74f26f6a0 100644 --- a/packages/@sanity/import/src/validateAssetDocuments.js +++ b/packages/@sanity/import/src/validateAssetDocuments.js @@ -1,5 +1,5 @@ -const debug = require('debug')('sanity:import:asset-validation') const {generateHelpUrl} = require('@sanity/generate-help-url') +const debug = require('debug')('sanity:import:asset-validation') const pMap = require('p-map') const urlExists = require('./util/urlExists') diff --git a/packages/@sanity/types/src/schema/definition/type/block.ts b/packages/@sanity/types/src/schema/definition/type/block.ts index 43261974fb50..d897b590dd3c 100644 --- a/packages/@sanity/types/src/schema/definition/type/block.ts +++ b/packages/@sanity/types/src/schema/definition/type/block.ts @@ -1,7 +1,7 @@ import {type ComponentType, type ReactNode} from 'react' import {type RuleDef, type ValidationBuilder} from '../../ruleBuilder' import {type InitialValueProperty} from '../../types' -import {type ArrayOfType} from './array' +import {type ArrayOfType} from './array' import {type BaseSchemaDefinition} from './common' import {type ObjectDefinition} from './object' diff --git a/packages/@sanity/types/src/schema/types.ts b/packages/@sanity/types/src/schema/types.ts index b81404746bb5..eb40ed667df8 100644 --- a/packages/@sanity/types/src/schema/types.ts +++ b/packages/@sanity/types/src/schema/types.ts @@ -1,6 +1,8 @@ import {type SanityClient} from '@sanity/client' import {type ComponentType} from 'react' +import {type SanityDocument} from '../documents' import {type CurrentUser} from '../user' +import {type Rule} from '../validation' import {type SchemaTypeDefinition} from './definition/schemaDefinition' import { type BlockDecoratorDefinition, @@ -18,8 +20,6 @@ import { } from './definition/type' import {type ArrayOptions} from './definition/type/array' import {type PreviewConfig} from './preview' -import type {SanityDocument} from '../documents' -import type {Rule} from '../validation' export {defineType, defineField, defineArrayMember, typed} from './define' diff --git a/packages/@sanity/vision/src/components/VisionGui.tsx b/packages/@sanity/vision/src/components/VisionGui.tsx index 7169d8849555..9188ac3191e2 100644 --- a/packages/@sanity/vision/src/components/VisionGui.tsx +++ b/packages/@sanity/vision/src/components/VisionGui.tsx @@ -19,19 +19,19 @@ import { Tooltip, Grid, Button, + ToastContextValue, Inline, - type ToastContextValue, } from '@sanity/ui' import isHotkey from 'is-hotkey' -import React, {type RefObject, createRef, PureComponent, type ChangeEvent} from 'react' -import {type TFunction} from 'sanity' +import React, {ChangeEvent, type RefObject} from 'react' +import {TFunction} from 'sanity' import {API_VERSIONS, DEFAULT_API_VERSION} from '../apiVersions' import {VisionCodeMirror} from '../codemirror/VisionCodeMirror' import {PERSPECTIVES, DEFAULT_PERSPECTIVE, isPerspective} from '../perspectives' import {type VisionProps} from '../types' import {encodeQueryString} from '../util/encodeQueryString' -import {getLocalStorage, type LocalStorageish} from '../util/localStorage' -import {parseApiQueryString, type ParsedApiQueryString} from '../util/parseApiQueryString' +import {getLocalStorage, LocalStorageish} from '../util/localStorage' +import {parseApiQueryString, ParsedApiQueryString} from '../util/parseApiQueryString' import {prefixApiVersion} from '../util/prefixApiVersion' import {ResizeObserver} from '../util/resizeObserver' import {tryParseParams} from '../util/tryParseParams' @@ -145,7 +145,7 @@ interface VisionGuiState { paneSizeOptions: PaneSizeOptions } -export class VisionGui extends PureComponent { +export class VisionGui extends React.PureComponent { _visionRoot: RefObject _queryEditorContainer: RefObject _paramsEditorContainer: RefObject @@ -187,11 +187,11 @@ export class VisionGui extends PureComponent { perspective = DEFAULT_PERSPECTIVE } - this._visionRoot = createRef() - this._operationUrlElement = createRef() - this._queryEditorContainer = createRef() - this._paramsEditorContainer = createRef() - this._customApiVersionElement = createRef() + this._visionRoot = React.createRef() + this._operationUrlElement = React.createRef() + this._queryEditorContainer = React.createRef() + this._paramsEditorContainer = React.createRef() + this._customApiVersionElement = React.createRef() this._client = props.client.withConfig({ apiVersion: customApiVersion || apiVersion, diff --git a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx index 5ba9a197b802..adda7e57642e 100644 --- a/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx +++ b/packages/sanity/playwright-ct/tests/utils/testHelpers.tsx @@ -1,16 +1,7 @@ -import {type ComponentFixtures} from '@playwright/experimental-ct-react' -import type {PlaywrightTestArgs, Locator} from '@playwright/test' +import {type PlaywrightTestArgs, type Locator} from '@playwright/test' export const DEFAULT_TYPE_DELAY = 20 -/** - * The delay between key presses in milliseconds for fast typing. This is usually used for typing in the PTE. - * The PTE normally need some time to process the input and sync its internal state with the document - */ -export const TYPE_DELAY_HIGH = 150 - -export type MountResult = Awaited> - export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) { const activatePTInputOverlay = async ($pteField: Locator) => { const $overlay = $pteField.getByTestId('activate-overlay') diff --git a/packages/sanity/src/_internal/cli/commands/index.ts b/packages/sanity/src/_internal/cli/commands/index.ts index f63bc7476887..e8d65ee86f3e 100644 --- a/packages/sanity/src/_internal/cli/commands/index.ts +++ b/packages/sanity/src/_internal/cli/commands/index.ts @@ -10,13 +10,13 @@ import aliasDatasetCommand from './dataset/alias/aliasCommands' import copyDatasetCommand from './dataset/copyDatasetCommand' import createDatasetCommand from './dataset/createDatasetCommand' import datasetGroup from './dataset/datasetGroup' -import listDatasetsCommand from './dataset/listDatasetsCommand' -import deployCommand from './deploy/deployCommand' -import undeployCommand from './deploy/undeployCommand' import datasetVisibilityCommand from './dataset/datasetVisibilityCommand' import deleteDatasetCommand from './dataset/deleteDatasetCommand' import exportDatasetCommand from './dataset/exportDatasetCommand' import importDatasetCommand from './dataset/importDatasetCommand' +import listDatasetsCommand from './dataset/listDatasetsCommand' +import deployCommand from './deploy/deployCommand' +import undeployCommand from './deploy/undeployCommand' import devCommand from './dev/devCommand' import createDocumentsCommand from './documents/createDocumentsCommand' import deleteDocumentsCommand from './documents/deleteDocumentsCommand' @@ -24,20 +24,20 @@ import documentsGroup from './documents/documentsGroup' import getDocumentsCommand from './documents/getDocumentsCommand' import queryDocumentsCommand from './documents/queryDocumentsCommand' import validateDocumentsCommand from './documents/validateDocumentsCommand' +import execCommand from './exec/execCommand' +import deleteGraphQLAPICommand from './graphql/deleteGraphQLAPICommand' +import deployGraphQLAPICommand from './graphql/deployGraphQLAPICommand' +import graphqlGroup from './graphql/graphqlGroup' +import listGraphQLAPIsCommand from './graphql/listGraphQLAPIsCommand' import createHookCommand from './hook/createHookCommand' import deleteHookCommand from './hook/deleteHookCommand' import hookGroup from './hook/hookGroup' +import listHookLogsCommand from './hook/listHookLogsCommand' +import listHooksCommand from './hook/listHooksCommand' +import printHookAttemptCommand from './hook/printHookAttemptCommand' import previewCommand from './preview/previewCommand' import startCommand from './start/startCommand' import uninstallCommand from './uninstall/uninstallCommand' -import listHooksCommand from './hook/listHooksCommand' -import printHookAttemptCommand from './hook/printHookAttemptCommand' -import listHookLogsCommand from './hook/listHookLogsCommand' -import execCommand from './exec/execCommand' -import graphqlGroup from './graphql/graphqlGroup' -import listGraphQLAPIsCommand from './graphql/listGraphQLAPIsCommand' -import deployGraphQLAPICommand from './graphql/deployGraphQLAPICommand' -import deleteGraphQLAPICommand from './graphql/deleteGraphQLAPICommand' import inviteUserCommand from './users/inviteUserCommand' import listUsersCommand from './users/listUsersCommand' import usersGroup from './users/usersGroup' diff --git a/packages/sanity/src/core/config/types.ts b/packages/sanity/src/core/config/types.ts index 215c3993bd96..d33bc447e927 100644 --- a/packages/sanity/src/core/config/types.ts +++ b/packages/sanity/src/core/config/types.ts @@ -10,7 +10,7 @@ import { type SchemaTypeDefinition, } from '@sanity/types' import {type i18n} from 'i18next' -import {type ComponentType, type ReactElement, type ReactNode} from 'react' +import {type ComponentType, type ReactNode} from 'react' import {type Observable} from 'rxjs' import {type FormBuilderCustomMarkersComponent, type FormBuilderMarkersComponent} from '../form' import {type LocalePluginOptions, type LocaleSource} from '../i18n/types' @@ -520,7 +520,7 @@ export interface DocumentLayoutProps { * The type of the document. This is a read-only property and changing it will have no effect. */ documentType: string - renderDefault: (props: DocumentLayoutProps) => ReactElement + renderDefault: (props: DocumentLayoutProps) => React.ReactElement } interface DocumentComponents { diff --git a/packages/sanity/src/core/form/inputs/ReferenceInput/ReferenceField.tsx b/packages/sanity/src/core/form/inputs/ReferenceInput/ReferenceField.tsx index b722791533c9..2627e3922f6c 100644 --- a/packages/sanity/src/core/form/inputs/ReferenceInput/ReferenceField.tsx +++ b/packages/sanity/src/core/form/inputs/ReferenceInput/ReferenceField.tsx @@ -1,7 +1,7 @@ import {LaunchIcon as OpenInNewTabIcon, SyncIcon as ReplaceIcon, TrashIcon} from '@sanity/icons' import {type Reference, type ReferenceSchemaType} from '@sanity/types' import {Box, Card, Flex, Menu, MenuDivider, Stack, type CardTone} from '@sanity/ui' -import { +import React, { type ComponentProps, type ForwardedRef, forwardRef, diff --git a/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/Grid/GridItem.tsx b/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/Grid/GridItem.tsx index e0792732c773..1fb1d06d5166 100644 --- a/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/Grid/GridItem.tsx +++ b/packages/sanity/src/core/form/inputs/arrays/ArrayOfObjectsInput/Grid/GridItem.tsx @@ -1,7 +1,7 @@ import {CopyIcon as DuplicateIcon, TrashIcon} from '@sanity/icons' import {type SchemaType} from '@sanity/types' import {Box, Card, Menu, type CardTone} from '@sanity/ui' -import {useCallback, useMemo, useRef} from 'react' +import React, {useCallback, useMemo, useRef} from 'react' import styled from 'styled-components' import {MenuButton, MenuItem} from '../../../../../../ui-components' import {type FIXME} from '../../../../../FIXME' diff --git a/packages/sanity/src/core/form/inputs/files/FileInput/FileInput.tsx b/packages/sanity/src/core/form/inputs/files/FileInput/FileInput.tsx index 1e2ec0c82b16..61a9edf5c8a7 100644 --- a/packages/sanity/src/core/form/inputs/files/FileInput/FileInput.tsx +++ b/packages/sanity/src/core/form/inputs/files/FileInput/FileInput.tsx @@ -14,7 +14,7 @@ import { } from '@sanity/types' import {Box, Card, Menu, type ThemeColorToneKey, type ToastParams} from '@sanity/ui' import {get, startCase} from 'lodash' -import React, {PureComponent, type ReactNode, type FocusEvent} from 'react' +import React, {type ReactNode} from 'react' import {type Observable, type Subscription} from 'rxjs' import {Button, MenuButton, MenuItem} from '../../../../../ui-components' import {ChangeIndicator} from '../../../../changeIndicators' @@ -47,7 +47,7 @@ export interface BaseFileInputValue extends Partial { _upload?: UploadState } -function passThrough({children}: {children?: ReactNode}) { +function passThrough({children}: {children?: React.ReactNode}) { return children } @@ -75,7 +75,7 @@ export interface BaseFileInputState { const ASSET_FIELD_PATH = ['asset'] /** @internal */ -export class BaseFileInput extends PureComponent { +export class BaseFileInput extends React.PureComponent { _assetFieldPath: Path uploadSubscription: Subscription | null = null browseButtonElement: HTMLButtonElement | null = null @@ -297,7 +297,7 @@ export class BaseFileInput extends PureComponent { + handleFileTargetFocus = (event: React.FocusEvent) => { // We want to handle focus when the file target element *itself* receives // focus, not when an interactive child element receives focus. Since React has decided // to let focus bubble, so this workaround is needed diff --git a/packages/sanity/src/core/form/inputs/files/ImageInput/ImageInput.tsx b/packages/sanity/src/core/form/inputs/files/ImageInput/ImageInput.tsx index b3e6cd35ebad..1179a0e15a1a 100644 --- a/packages/sanity/src/core/form/inputs/files/ImageInput/ImageInput.tsx +++ b/packages/sanity/src/core/form/inputs/files/ImageInput/ImageInput.tsx @@ -15,14 +15,14 @@ import { } from '@sanity/types' import {Box, Card, Menu, Stack, type ToastParams} from '@sanity/ui' import {get, startCase} from 'lodash' -import {PureComponent, type FocusEvent, type ReactNode} from 'react' +import React, {type ReactNode} from 'react' import {type Observable, type Subscription} from 'rxjs' import { Button, Dialog, MenuButton, - MenuItem, type MenuButtonProps, + MenuItem, } from '../../../../../ui-components' import {type FIXME} from '../../../../FIXME' import {ChangeIndicator} from '../../../../changeIndicators' @@ -30,7 +30,7 @@ import {ImperativeToast} from '../../../../components' import {PresenceOverlay} from '../../../../presence' import {FormInput} from '../../../components' import {MemberField, MemberFieldError, MemberFieldSet} from '../../../members' -import {setIfMissing, unset, type PatchEvent} from '../../../patch' +import {type PatchEvent, setIfMissing, unset} from '../../../patch' import {type FieldMember} from '../../../store' import { type ResolvedUploader, @@ -96,7 +96,7 @@ interface BaseImageInputState { isMenuOpen: boolean } -function passThrough({children}: {children?: ReactNode}) { +function passThrough({children}: {children?: React.ReactNode}) { return children } @@ -105,7 +105,7 @@ const ASSET_FIELD_PATH = ['asset'] const ASSET_IMAGE_MENU_POPOVER: MenuButtonProps['popover'] = {portal: true} /** @internal */ -export class BaseImageInput extends PureComponent { +export class BaseImageInput extends React.PureComponent { _previewElement: HTMLDivElement | null = null _assetPath: Path uploadSubscription: null | Subscription = null @@ -327,7 +327,7 @@ export class BaseImageInput extends PureComponent { + handleFileTargetFocus = (event: React.FocusEvent) => { // We want to handle focus when the file target element *itself* receives // focus, not when an interactive child element receives focus. Since React has decided // to let focus bubble, so this workaround is needed diff --git a/packages/sanity/src/core/form/members/object/fields/ArrayOfObjectsField.tsx b/packages/sanity/src/core/form/members/object/fields/ArrayOfObjectsField.tsx index bd15d378fa0f..9e6ca3ca9a3c 100644 --- a/packages/sanity/src/core/form/members/object/fields/ArrayOfObjectsField.tsx +++ b/packages/sanity/src/core/form/members/object/fields/ArrayOfObjectsField.tsx @@ -1,6 +1,6 @@ import {type Path, type SchemaType} from '@sanity/types' import {useToast} from '@sanity/ui' -import React, {useCallback, useEffect, useMemo, useRef, type FocusEvent} from 'react' +import {useCallback, useEffect, useMemo, useRef, type FocusEvent} from 'react' import {type Subscription} from 'rxjs' import {map, tap} from 'rxjs/operators' import {useClient} from '../../../../hooks' @@ -8,7 +8,7 @@ import {useResolveInitialValueForType} from '../../../../store' import {DEFAULT_STUDIO_CLIENT_OPTIONS} from '../../../../studioClient' import {useDidUpdate} from '../../../hooks/useDidUpdate' import {createProtoArrayValue} from '../../../inputs/arrays/ArrayOfObjectsInput/createProtoArrayValue' -import {insert, PatchEvent, setIfMissing, unset, type PatchArg} from '../../../patch' +import {insert, type PatchArg, PatchEvent, setIfMissing, unset} from '../../../patch' import {applyAll} from '../../../patch/applyPatch' import {type ArrayOfObjectsFormNode, type FieldMember} from '../../../store' import {useDocumentFieldActions} from '../../../studio/contexts/DocumentFieldActions' diff --git a/packages/sanity/src/core/form/studio/inputs/reference/StudioReferenceInput.tsx b/packages/sanity/src/core/form/studio/inputs/reference/StudioReferenceInput.tsx index 26e2c4c2b43e..b55da458c0b7 100644 --- a/packages/sanity/src/core/form/studio/inputs/reference/StudioReferenceInput.tsx +++ b/packages/sanity/src/core/form/studio/inputs/reference/StudioReferenceInput.tsx @@ -8,7 +8,7 @@ import { } from '@sanity/types' import * as PathUtils from '@sanity/util/paths' import {get} from '@sanity/util/paths' -import { +import React, { forwardRef, useCallback, useMemo, diff --git a/packages/sanity/src/core/studio/components/navbar/search/contexts/search/reducer.ts b/packages/sanity/src/core/studio/components/navbar/search/contexts/search/reducer.ts index 88e592e0631a..e914cdfb2be7 100644 --- a/packages/sanity/src/core/studio/components/navbar/search/contexts/search/reducer.ts +++ b/packages/sanity/src/core/studio/components/navbar/search/contexts/search/reducer.ts @@ -1,6 +1,8 @@ import {type CurrentUser} from '@sanity/types' import {type SearchableType, type SearchTerms, type WeightedHit} from '../../../../../../search' -import {type RecentSearch} from '../../datastores/recentSearches' +import {type RecentSearch} from '../../datastores/recentSearches' +import {type SearchFieldDefinitionDictionary} from '../../definitions/fields' +import {type SearchFilterDefinitionDictionary} from '../../definitions/filters' import { getOperatorDefinition, getOperatorInitialValue, @@ -17,8 +19,6 @@ import { } from '../../utils/filterUtils' import {isRecentSearchTerms} from '../../utils/isRecentSearchTerms' import {sortTypes} from '../../utils/selectors' -import {type SearchFieldDefinitionDictionary} from '../../definitions/fields' -import {type SearchFilterDefinitionDictionary} from '../../definitions/filters' export interface SearchReducerState { currentUser: CurrentUser | null