Skip to content

Commit

Permalink
chore: manually fix remaining non-autofixable eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Jan 22, 2024
1 parent 607bbd1 commit 1ed75e1
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 60 deletions.
2 changes: 1 addition & 1 deletion packages/@sanity/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/import/src/importFromFolder.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/import/src/references.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/import/src/uploadAssets.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/import/src/validateAssetDocuments.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/src/schema/definition/type/block.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
4 changes: 2 additions & 2 deletions packages/@sanity/types/src/schema/types.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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'

Expand Down
22 changes: 11 additions & 11 deletions packages/@sanity/vision/src/components/VisionGui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -145,7 +145,7 @@ interface VisionGuiState {
paneSizeOptions: PaneSizeOptions
}

export class VisionGui extends PureComponent<VisionGuiProps, VisionGuiState> {
export class VisionGui extends React.PureComponent<VisionGuiProps, VisionGuiState> {
_visionRoot: RefObject<HTMLDivElement>
_queryEditorContainer: RefObject<HTMLDivElement>
_paramsEditorContainer: RefObject<HTMLDivElement>
Expand Down Expand Up @@ -187,11 +187,11 @@ export class VisionGui extends PureComponent<VisionGuiProps, VisionGuiState> {
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,
Expand Down
11 changes: 1 addition & 10 deletions packages/sanity/playwright-ct/tests/utils/testHelpers.tsx
Original file line number Diff line number Diff line change
@@ -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<ReturnType<ComponentFixtures['mount']>>

export function testHelpers({page}: {page: PlaywrightTestArgs['page']}) {
const activatePTInputOverlay = async ($pteField: Locator) => {
const $overlay = $pteField.getByTestId('activate-overlay')
Expand Down
22 changes: 11 additions & 11 deletions packages/sanity/src/_internal/cli/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ 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'
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'
Expand Down
4 changes: 2 additions & 2 deletions packages/sanity/src/core/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -47,7 +47,7 @@ export interface BaseFileInputValue extends Partial<BaseFile> {
_upload?: UploadState
}

function passThrough({children}: {children?: ReactNode}) {
function passThrough({children}: {children?: React.ReactNode}) {
return children
}

Expand Down Expand Up @@ -75,7 +75,7 @@ export interface BaseFileInputState {
const ASSET_FIELD_PATH = ['asset']

/** @internal */
export class BaseFileInput extends PureComponent<BaseFileInputProps, BaseFileInputState> {
export class BaseFileInput extends React.PureComponent<BaseFileInputProps, BaseFileInputState> {
_assetFieldPath: Path
uploadSubscription: Subscription | null = null
browseButtonElement: HTMLButtonElement | null = null
Expand Down Expand Up @@ -297,7 +297,7 @@ export class BaseFileInput extends PureComponent<BaseFileInputProps, BaseFileInp
this.setState({selectedAssetSource: null})
}

handleFileTargetFocus = (event: FocusEvent) => {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ 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'
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,
Expand Down Expand Up @@ -96,7 +96,7 @@ interface BaseImageInputState {
isMenuOpen: boolean
}

function passThrough({children}: {children?: ReactNode}) {
function passThrough({children}: {children?: React.ReactNode}) {
return children
}

Expand All @@ -105,7 +105,7 @@ const ASSET_FIELD_PATH = ['asset']
const ASSET_IMAGE_MENU_POPOVER: MenuButtonProps['popover'] = {portal: true}

/** @internal */
export class BaseImageInput extends PureComponent<BaseImageInputProps, BaseImageInputState> {
export class BaseImageInput extends React.PureComponent<BaseImageInputProps, BaseImageInputState> {
_previewElement: HTMLDivElement | null = null
_assetPath: Path
uploadSubscription: null | Subscription = null
Expand Down Expand Up @@ -327,7 +327,7 @@ export class BaseImageInput extends PureComponent<BaseImageInputProps, BaseImage
this.setState({selectedAssetSource: null})
}

handleFileTargetFocus = (event: FocusEvent) => {
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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'
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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 1ed75e1

Please sign in to comment.