Skip to content

Commit 48218bc

Browse files
authored
chore: fix lint warnings for default exports, unused imports, unused err in catch (#12666)
Fix various lint warnings in payload package. 387 warnings -> 215 warnings - Migrate (most) default exports to named - Remove unused imports - Rename unused errors in catch statements to `ignore`
1 parent bd512f1 commit 48218bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+130
-139
lines changed

packages/payload/src/admin/RichText.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import type { GenericLanguages, I18n } from '@payloadcms/translations'
23
import type { JSONSchema4 } from 'json-schema'
34

45
import type { SanitizedCollectionConfig, TypeWithID } from '../collections/config/types.js'
5-
import type {
6-
Config,
7-
ImportMapGenerators,
8-
PayloadComponent,
9-
SanitizedConfig,
10-
} from '../config/types.js'
6+
import type { ImportMapGenerators, PayloadComponent, SanitizedConfig } from '../config/types.js'
117
import type { ValidationFieldError } from '../errors/ValidationError.js'
128
import type {
139
FieldAffectingData,
@@ -22,8 +18,11 @@ import type { RichTextFieldClientProps, RichTextFieldServerProps } from './field
2218
import type { FieldDiffClientProps, FieldDiffServerProps, FieldSchemaMap } from './types.js'
2319

2420
export type AfterReadRichTextHookArgs<
21+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2522
TData extends TypeWithID = any,
23+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2624
TValue = any,
25+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2726
TSiblingData = any,
2827
> = {
2928
currentDepth?: number
@@ -58,6 +57,7 @@ export type AfterReadRichTextHookArgs<
5857
export type AfterChangeRichTextHookArgs<
5958
TData extends TypeWithID = any,
6059
TValue = any,
60+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6161
TSiblingData = any,
6262
> = {
6363
/** A string relating to which operation the field type is currently executing within. */
@@ -73,6 +73,7 @@ export type AfterChangeRichTextHookArgs<
7373
export type BeforeValidateRichTextHookArgs<
7474
TData extends TypeWithID = any,
7575
TValue = any,
76+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7677
TSiblingData = any,
7778
> = {
7879
/** A string relating to which operation the field type is currently executing within. */
@@ -87,6 +88,7 @@ export type BeforeValidateRichTextHookArgs<
8788
export type BeforeChangeRichTextHookArgs<
8889
TData extends TypeWithID = any,
8990
TValue = any,
91+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9092
TSiblingData = any,
9193
> = {
9294
/**

packages/payload/src/admin/fields/Select.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { MarkOptional } from 'ts-essentials'
22

3-
import type { Option, SelectField, SelectFieldClient } from '../../fields/config/types.js'
3+
import type { SelectField, SelectFieldClient } from '../../fields/config/types.js'
44
import type { SelectFieldValidation } from '../../fields/validations.js'
5-
import type { PayloadRequest } from '../../types/index.js'
65
import type { FieldErrorClientComponent, FieldErrorServerComponent } from '../forms/Error.js'
76
import type {
87
ClientFieldBase,

packages/payload/src/admin/forms/Diff.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type {
55
ClientFieldWithOptionalType,
66
PayloadRequest,
77
SanitizedFieldPermissions,
8-
TypedLocale,
98
} from '../../index.js'
109

1110
export type VersionTab = {

packages/payload/src/auth/operations/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { afterRead } from '../../fields/hooks/afterRead/index.js'
1919
import { Forbidden } from '../../index.js'
2020
import { killTransaction } from '../../utilities/killTransaction.js'
21-
import sanitizeInternalFields from '../../utilities/sanitizeInternalFields.js'
21+
import { sanitizeInternalFields } from '../../utilities/sanitizeInternalFields.js'
2222
import { getFieldsToSign } from '../getFieldsToSign.js'
2323
import { getLoginOptions } from '../getLoginOptions.js'
2424
import { isUserLocked } from '../isUserLocked.js'

packages/payload/src/auth/strategies/apiKey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const APIKeyAuthentication =
5252
user: user as User,
5353
}
5454
}
55-
} catch (err) {
55+
} catch (ignore) {
5656
return { user: null }
5757
}
5858
}

packages/payload/src/auth/strategies/jwt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { jwtVerify } from 'jose'
22

33
import type { Payload, Where } from '../../types/index.js'
4-
import type { AuthStrategyFunction, AuthStrategyResult, User } from '../index.js'
4+
import type { AuthStrategyFunction, AuthStrategyResult } from '../index.js'
55

66
import { extractJWT } from '../extractJWT.js'
77

packages/payload/src/auth/strategies/local/authenticate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const authenticateLocalStrategy = async ({ doc, password }: Args): Promis
3434
}
3535

3636
return null
37-
} catch (err) {
37+
} catch (ignore) {
3838
return null
3939
}
4040
}

packages/payload/src/bin/generateImportMap/iterateConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AdminViewConfig } from '../../admin/views/index.js'
21
import type { SanitizedConfig } from '../../config/types.js'
32
import type { AddToImportMap, Imports, InternalImportMap } from './index.js'
43

packages/payload/src/bin/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import minimist from 'minimist'
55
import { pathToFileURL } from 'node:url'
66
import path from 'path'
77

8-
import type { BinScript } from '../config/types.js'
9-
108
import { findConfig } from '../config/find.js'
119
import payload, { getPayload } from '../index.js'
1210
import { generateImportMap } from './generateImportMap/index.js'

packages/payload/src/collections/config/sanitize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { getBaseAuthFields } from '../../auth/getAuthFields.js'
1111
import { TimestampsRequired } from '../../errors/TimestampsRequired.js'
1212
import { sanitizeFields } from '../../fields/config/sanitize.js'
1313
import { fieldAffectsData } from '../../fields/config/types.js'
14-
import mergeBaseFields from '../../fields/mergeBaseFields.js'
14+
import { mergeBaseFields } from '../../fields/mergeBaseFields.js'
1515
import { uploadCollectionEndpoints } from '../../uploads/endpoints/index.js'
1616
import { getBaseUploadFields } from '../../uploads/getBaseFields.js'
1717
import { flattenAllFields } from '../../utilities/flattenAllFields.js'
1818
import { formatLabels } from '../../utilities/formatLabels.js'
19-
import baseVersionFields from '../../versions/baseFields.js'
19+
import { baseVersionFields } from '../../versions/baseFields.js'
2020
import { versionDefaults } from '../../versions/defaults.js'
2121
import { defaultCollectionEndpoints } from '../endpoints/index.js'
2222
import {

0 commit comments

Comments
 (0)