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:
Elliot DeNolf
2024-08-30 16:52:08 -04:00
committed by GitHub
parent b5fb92530c
commit 9816787fbf
37 changed files with 19 additions and 56 deletions

View File

@@ -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'],
},
}

View File

@@ -7,6 +7,7 @@ let FlatConfig
export const index = [
...rootEslintConfig,
{
ignores: ['bin/cli.js'],
languageOptions: {
parserOptions: {
...rootParserOptions,

View File

@@ -30,7 +30,7 @@ export async function getPackageManager(args: {
}
return detected
} catch (error) {
} catch (ignore) {
return 'npm'
}
}

View File

@@ -4,7 +4,6 @@ import type { EntityToGroup } from '@payloadcms/ui/shared'
import { getTranslation } from '@payloadcms/translations'
import {
ChevronIcon,
NavGroup,
useAuth,
useConfig,

View File

@@ -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,
>({

View File

@@ -1,4 +1,4 @@
import type { CORSConfig, PayloadRequest } from 'payload'
import type { PayloadRequest } from 'payload'
type CorsArgs = {
headers: Headers

View File

@@ -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'

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -1,5 +1,3 @@
import type React from 'react'
import fs from 'fs'
import process from 'node:process'
import path from 'path'

View File

@@ -25,7 +25,6 @@ import type {
LabelFunction,
LivePreviewConfig,
MetaConfig,
OpenGraphConfig,
PayloadComponent,
StaticLabel,
} from '../../config/types.js'

View File

@@ -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'

View File

@@ -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> => {

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -1,4 +1,3 @@
import type { User } from '../auth/index.js'
import type { PayloadRequest } from '../types/index.js'
export type PreferenceRequest = {

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'
/**

View File

@@ -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

View File

@@ -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'

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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',

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -2,7 +2,6 @@ import type {
Data,
DocumentPreferences,
Field,
FilterOptionsResult,
FormField,
FormState,
PayloadRequest,

View File

@@ -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 }) => {