chore: remove all unused imports (#7999)
Removes all unused imports. Temporarily swapped in https://github.com/sweepline/eslint-plugin-unused-imports to differentiate between unused imports and unused vars. The default rule does not differentiate.
This commit is contained in:
@@ -29,7 +29,7 @@ export const rootParserOptions = {
|
||||
ecmaVersion: 'latest',
|
||||
projectService: {
|
||||
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
|
||||
allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.spec.ts'],
|
||||
allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.spec.ts', '*.d.ts'],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ let FlatConfig
|
||||
export const index = [
|
||||
...rootEslintConfig,
|
||||
{
|
||||
ignores: ['bin/cli.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
...rootParserOptions,
|
||||
|
||||
@@ -30,7 +30,7 @@ export async function getPackageManager(args: {
|
||||
}
|
||||
|
||||
return detected
|
||||
} catch (error) {
|
||||
} catch (ignore) {
|
||||
return 'npm'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { EntityToGroup } from '@payloadcms/ui/shared'
|
||||
|
||||
import { getTranslation } from '@payloadcms/translations'
|
||||
import {
|
||||
ChevronIcon,
|
||||
NavGroup,
|
||||
useAuth,
|
||||
useConfig,
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import type {
|
||||
ClientTranslationsObject,
|
||||
DefaultTranslationKeys,
|
||||
DefaultTranslationsObject,
|
||||
I18n,
|
||||
I18nClient,
|
||||
} from '@payloadcms/translations'
|
||||
import type { ClientTranslationsObject, I18nClient } from '@payloadcms/translations'
|
||||
import type { SanitizedConfig } from 'payload'
|
||||
|
||||
import { initI18n } from '@payloadcms/translations'
|
||||
@@ -18,6 +12,7 @@ import { getRequestLanguage } from './getRequestLanguage.js'
|
||||
* It must be called on the server side, and within the lifecycle of a request since it relies on the request headers and cookies.
|
||||
*/
|
||||
export const getNextRequestI18n = async <
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
TAdditionalTranslations = {},
|
||||
TAdditionalClientTranslationKeys extends string = never,
|
||||
>({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CORSConfig, PayloadRequest } from 'payload'
|
||||
import type { PayloadRequest } from 'payload'
|
||||
|
||||
type CorsArgs = {
|
||||
headers: Headers
|
||||
|
||||
@@ -2,8 +2,6 @@ import type { AdminViewProps } from 'payload'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
import type { LoginFieldProps } from '../Login/LoginField/index.js'
|
||||
|
||||
import { getDocumentData } from '../Document/getDocumentData.js'
|
||||
import { CreateFirstUserClient } from './index.client.js'
|
||||
import './index.scss'
|
||||
|
||||
@@ -7,9 +7,8 @@ import type {
|
||||
SanitizedConfig,
|
||||
} from 'payload'
|
||||
|
||||
import { HydrateAuthProvider } from '@payloadcms/ui'
|
||||
import { formatAdminURL } from '@payloadcms/ui/shared'
|
||||
import React, { Fragment } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
import { DefaultTemplate } from '../../templates/Default/index.js'
|
||||
import { getNextRequestI18n } from '../../utilities/getNextRequestI18n.js'
|
||||
|
||||
@@ -17,7 +17,7 @@ export const Verify: React.FC<AdminViewProps> = async ({
|
||||
searchParams,
|
||||
}) => {
|
||||
// /:collectionSlug/verify/:token
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
||||
const [collectionSlug, verify, token] = params.segments
|
||||
const { locale, permissions, req } = initPageResult
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use client'
|
||||
import type { DiffMethod } from 'react-diff-viewer-continued'
|
||||
|
||||
import { UIFieldClient } from 'payload'
|
||||
import { fieldAffectsData } from 'payload/shared'
|
||||
import React from 'react'
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import type React from 'react'
|
||||
|
||||
import fs from 'fs'
|
||||
import process from 'node:process'
|
||||
import path from 'path'
|
||||
|
||||
@@ -25,7 +25,6 @@ import type {
|
||||
LabelFunction,
|
||||
LivePreviewConfig,
|
||||
MetaConfig,
|
||||
OpenGraphConfig,
|
||||
PayloadComponent,
|
||||
StaticLabel,
|
||||
} from '../../config/types.js'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { BatchLoadFn } from 'dataloader'
|
||||
|
||||
import DataLoader from 'dataloader'
|
||||
|
||||
import type { JsonValue, PayloadRequest } from '../types/index.js'
|
||||
import type { PayloadRequest } from '../types/index.js'
|
||||
import type { TypeWithID } from './config/types.js'
|
||||
|
||||
import { isValidID } from '../utilities/isValidID.js'
|
||||
|
||||
@@ -17,7 +17,6 @@ import { InvalidConfiguration } from '../errors/index.js'
|
||||
import { sanitizeGlobals } from '../globals/config/sanitize.js'
|
||||
import getPreferencesCollection from '../preferences/preferencesCollection.js'
|
||||
import checkDuplicateCollections from '../utilities/checkDuplicateCollections.js'
|
||||
import { deepMergeWithReactComponents } from '../utilities/deepMerge.js'
|
||||
import { defaults } from './defaults.js'
|
||||
|
||||
const sanitizeAdminConfig = (configToSanitize: Config): Partial<SanitizedConfig> => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
import type { BusboyConfig } from 'busboy'
|
||||
import type GraphQL from 'graphql'
|
||||
import type { JSONSchema4 } from 'json-schema'
|
||||
import type { DestinationStream, LoggerOptions, pino } from 'pino'
|
||||
import type { DestinationStream, pino } from 'pino'
|
||||
import type React from 'react'
|
||||
import type { default as sharp } from 'sharp'
|
||||
import type { DeepRequired } from 'ts-essentials'
|
||||
|
||||
@@ -92,10 +92,6 @@ import type {
|
||||
TextFieldErrorServerComponent,
|
||||
TextFieldLabelClientComponent,
|
||||
TextFieldLabelServerComponent,
|
||||
UploadFieldErrorClientComponent,
|
||||
UploadFieldErrorServerComponent,
|
||||
UploadFieldLabelClientComponent,
|
||||
UploadFieldLabelServerComponent,
|
||||
UploadFieldProps,
|
||||
} from '../../admin/types.js'
|
||||
import type { SanitizedCollectionConfig, TypeWithID } from '../../collections/config/types.js'
|
||||
|
||||
@@ -16,7 +16,6 @@ import type {
|
||||
GeneratePreviewURL,
|
||||
LivePreviewConfig,
|
||||
MetaConfig,
|
||||
OpenGraphConfig,
|
||||
} from '../../config/types.js'
|
||||
import type { DBIdentifierName } from '../../database/types.js'
|
||||
import type { Field } from '../../fields/config/types.js'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { User } from '../auth/index.js'
|
||||
import type { PayloadRequest } from '../types/index.js'
|
||||
|
||||
export type PreferenceRequest = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ResizeOptions, Sharp, Metadata as SharpMetadata } from 'sharp'
|
||||
import type { ResizeOptions, Sharp } from 'sharp'
|
||||
|
||||
import type { TypeWithID } from '../collections/config/types.js'
|
||||
import type { PayloadRequest } from '../types/index.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Data, FormState } from 'payload'
|
||||
import type { Data, FormState } from '../admin/types.js'
|
||||
|
||||
import { reduceFieldsToValues } from './reduceFieldsToValues.js'
|
||||
import { unflatten } from './unflatten.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Data, FormState } from 'payload'
|
||||
import type { Data, FormState } from '../admin/types.js'
|
||||
|
||||
import { unflatten as flatleyUnflatten } from './unflatten.js'
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,6 @@ export const OverviewComponent: React.FC<OverviewProps> = ({
|
||||
const [descIsValid, setDescIsValid] = useState<boolean | undefined>()
|
||||
const [imageIsValid, setImageIsValid] = useState<boolean | undefined>()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const resetAll = useCallback(() => {
|
||||
const fields = getFields()
|
||||
const fieldsWithoutMeta = fields
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import type { LexicalEditor } from 'lexical'
|
||||
import type { RichTextFieldClient } from 'payload'
|
||||
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'
|
||||
import * as React from 'react'
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { LexicalEditor, LexicalNode, ParagraphNode } from 'lexical'
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'
|
||||
import { $createParagraphNode } from 'lexical'
|
||||
import * as React from 'react'
|
||||
import { type JSX, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
|
||||
import { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use client'
|
||||
import { getCollapsedMargins } from '../utils/getCollapsedMargins.js'
|
||||
import { highlightElemOriginalPosition } from './highlightElemOriginalPosition.js'
|
||||
const TARGET_LINE_HALF_HEIGHT = 0
|
||||
const TEXT_BOX_HORIZONTAL_PADDING = -24
|
||||
const DEBUG = false
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'
|
||||
import type {
|
||||
FieldPermissions,
|
||||
FieldTypes,
|
||||
RichTextAdapter,
|
||||
RichTextFieldProps,
|
||||
SanitizedConfig,
|
||||
} from 'payload'
|
||||
import type { RichTextAdapter, RichTextFieldProps, SanitizedConfig } from 'payload'
|
||||
import type React from 'react'
|
||||
|
||||
import type { FeatureProviderServer } from './features/typesServer.js'
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import { useElement } from '../../providers/ElementProvider.js'
|
||||
import { Heading2Element } from '../h2/Heading2.js'
|
||||
|
||||
export const Heading3Element = () => {
|
||||
const { attributes, children } = useElement()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import { useElement } from '../../providers/ElementProvider.js'
|
||||
import { Heading2Element } from '../h2/Heading2.js'
|
||||
|
||||
export const Heading4Element = () => {
|
||||
const { attributes, children } = useElement()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import { useElement } from '../../providers/ElementProvider.js'
|
||||
import { Heading2Element } from '../h2/Heading2.js'
|
||||
|
||||
export const Heading5Element = () => {
|
||||
const { attributes, children } = useElement()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import { useElement } from '../../providers/ElementProvider.js'
|
||||
import { Heading2Element } from '../h2/Heading2.js'
|
||||
|
||||
export const Heading6Element = () => {
|
||||
const { attributes, children } = useElement()
|
||||
|
||||
@@ -56,7 +56,7 @@ export const uploadthingStorage: UploadthingPlugin =
|
||||
uploadthingStorageOptions.options.acl = 'public-read'
|
||||
}
|
||||
|
||||
const adapter = uploadthingInternal(uploadthingStorageOptions, incomingConfig)
|
||||
const adapter = uploadthingInternal(uploadthingStorageOptions)
|
||||
|
||||
// Add adapter to each collection option object
|
||||
const collectionsWithAdapter: CloudStoragePluginOptions['collections'] = Object.entries(
|
||||
@@ -101,7 +101,7 @@ export const uploadthingStorage: UploadthingPlugin =
|
||||
})(config)
|
||||
}
|
||||
|
||||
function uploadthingInternal(options: UploadthingStorageOptions, incomingConfig: Config): Adapter {
|
||||
function uploadthingInternal(options: UploadthingStorageOptions): Adapter {
|
||||
const fields: Field[] = [
|
||||
{
|
||||
name: '_key',
|
||||
|
||||
@@ -3,8 +3,6 @@ import React from 'react'
|
||||
|
||||
import { Button } from '../../Button/index.js'
|
||||
import { Thumbnail } from '../../Thumbnail/index.js'
|
||||
import { UploadActions } from '../../Upload/index.js'
|
||||
import { FileMeta } from '../FileMeta/index.js'
|
||||
import './index.scss'
|
||||
|
||||
const baseClass = 'file-details-draggable'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use client'
|
||||
import type { TypeWithID } from 'payload'
|
||||
|
||||
import * as qs from 'qs-esm'
|
||||
import React, { createContext, useCallback, useContext, useEffect, useReducer, useRef } from 'react'
|
||||
|
||||
import { useDebounce } from '../../../hooks/useDebounce.js'
|
||||
|
||||
@@ -29,7 +29,6 @@ import { useDocumentDrawer } from '../../elements/DocumentDrawer/index.js'
|
||||
import { Dropzone } from '../../elements/Dropzone/index.js'
|
||||
import { useListDrawer } from '../../elements/ListDrawer/index.js'
|
||||
import { ShimmerEffect } from '../../elements/ShimmerEffect/index.js'
|
||||
import { PlusIcon } from '../../icons/Plus/index.js'
|
||||
import { useAuth } from '../../providers/Auth/index.js'
|
||||
import { useLocale } from '../../providers/Locale/index.js'
|
||||
import { useTranslation } from '../../providers/Translation/index.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClientField, Data, Field, FormField, FormState, Row, User } from 'payload'
|
||||
import type { ClientField, Data, FormField, FormState, Row, User } from 'payload'
|
||||
import type React from 'react'
|
||||
import type { Dispatch } from 'react'
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import type {
|
||||
Data,
|
||||
DocumentPreferences,
|
||||
Field,
|
||||
FilterOptionsResult,
|
||||
FormField,
|
||||
FormState,
|
||||
PayloadRequest,
|
||||
|
||||
@@ -9,7 +9,7 @@ export type UpdatedDocument = {
|
||||
|
||||
const Context = createContext({
|
||||
mostRecentUpdate: null,
|
||||
reportUpdate: (doc: UpdatedDocument) => null, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
reportUpdate: (doc: UpdatedDocument) => null,
|
||||
})
|
||||
|
||||
export const DocumentEventsProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
|
||||
Reference in New Issue
Block a user