diff --git a/.vscode/settings.json b/.vscode/settings.json index 6651f1dd59..ec1c5203ef 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,34 +1,9 @@ { "npm.packageManager": "pnpm", "editor.defaultFormatter": "esbenp.prettier-vscode", - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } - }, - "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "[jsonc]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" }, "editor.formatOnSaveMode": "file", "eslint.rules.customizations": [ @@ -43,12 +18,6 @@ "typescript.tsdk": "node_modules/typescript/lib", // Load .git-blame-ignore-revs file "gitlens.advanced.blame.customArguments": ["--ignore-revs-file", ".git-blame-ignore-revs"], - "[javascript][typescript][typescriptreact]": { - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - } - }, - "files.insertFinalNewline": true, "jestrunner.jestCommand": "pnpm exec cross-env NODE_OPTIONS=\"--no-deprecation\" node 'node_modules/jest/bin/jest.js'", "jestrunner.debugOptions": { "runtimeArgs": ["--no-deprecation"] diff --git a/templates/with-vercel-postgres/src/migrations/20250114_010454_initial.ts b/templates/with-vercel-postgres/src/migrations/20250114_010454_initial.ts index f776e9ec38..323c91fb78 100644 --- a/templates/with-vercel-postgres/src/migrations/20250114_010454_initial.ts +++ b/templates/with-vercel-postgres/src/migrations/20250114_010454_initial.ts @@ -1,6 +1,6 @@ import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-vercel-postgres' -export async function up({ db, payload, req }: MigrateUpArgs): Promise { +export async function up({ db }: MigrateUpArgs): Promise { await db.execute(sql` CREATE TABLE IF NOT EXISTS "users" ( "id" serial PRIMARY KEY NOT NULL, @@ -126,7 +126,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { CREATE INDEX IF NOT EXISTS "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");`) } -export async function down({ db, payload, req }: MigrateDownArgs): Promise { +export async function down({ db }: MigrateDownArgs): Promise { await db.execute(sql` DROP TABLE "users" CASCADE; DROP TABLE "media" CASCADE; diff --git a/templates/with-vercel-website/src/Footer/RowLabel.tsx b/templates/with-vercel-website/src/Footer/RowLabel.tsx index 57e747495b..a6f949459c 100644 --- a/templates/with-vercel-website/src/Footer/RowLabel.tsx +++ b/templates/with-vercel-website/src/Footer/RowLabel.tsx @@ -2,7 +2,7 @@ import { Header } from '@/payload-types' import { RowLabelProps, useRowLabel } from '@payloadcms/ui' -export const RowLabel: React.FC = (props) => { +export const RowLabel: React.FC = () => { const data = useRowLabel[number]>() const label = data?.data?.link?.label diff --git a/templates/with-vercel-website/src/Header/RowLabel.tsx b/templates/with-vercel-website/src/Header/RowLabel.tsx index 57e747495b..a6f949459c 100644 --- a/templates/with-vercel-website/src/Header/RowLabel.tsx +++ b/templates/with-vercel-website/src/Header/RowLabel.tsx @@ -2,7 +2,7 @@ import { Header } from '@/payload-types' import { RowLabelProps, useRowLabel } from '@payloadcms/ui' -export const RowLabel: React.FC = (props) => { +export const RowLabel: React.FC = () => { const data = useRowLabel[number]>() const label = data?.data?.link?.label diff --git a/templates/with-vercel-website/src/app/(frontend)/next/preview/route.ts b/templates/with-vercel-website/src/app/(frontend)/next/preview/route.ts index 80642637c0..0e14ad4777 100644 --- a/templates/with-vercel-website/src/app/(frontend)/next/preview/route.ts +++ b/templates/with-vercel-website/src/app/(frontend)/next/preview/route.ts @@ -4,8 +4,6 @@ import { getPayload, type PayloadRequest } from 'payload' import configPromise from '@payload-config' import { CollectionSlug } from 'payload' -const payloadToken = 'payload-token' - export async function GET( req: Request & { cookies: { @@ -16,7 +14,6 @@ export async function GET( }, ): Promise { const payload = await getPayload({ config: configPromise }) - const token = req.cookies.get(payloadToken)?.value const { searchParams } = new URL(req.url) const path = searchParams.get('path') const collection = searchParams.get('collection') as CollectionSlug diff --git a/templates/with-vercel-website/src/app/(frontend)/next/seed/route.ts b/templates/with-vercel-website/src/app/(frontend)/next/seed/route.ts index 360a7d7279..326b677ccc 100644 --- a/templates/with-vercel-website/src/app/(frontend)/next/seed/route.ts +++ b/templates/with-vercel-website/src/app/(frontend)/next/seed/route.ts @@ -5,15 +5,7 @@ import { headers } from 'next/headers' export const maxDuration = 60 // This function can run for a maximum of 60 seconds -export async function POST( - req: Request & { - cookies: { - get: (name: string) => { - value: string - } - } - }, -): Promise { +export async function POST(): Promise { const payload = await getPayload({ config }) const requestHeaders = await headers() diff --git a/templates/with-vercel-website/src/app/(frontend)/search/page.tsx b/templates/with-vercel-website/src/app/(frontend)/search/page.tsx index 4c1a451d48..46bf2b1101 100644 --- a/templates/with-vercel-website/src/app/(frontend)/search/page.tsx +++ b/templates/with-vercel-website/src/app/(frontend)/search/page.tsx @@ -4,7 +4,6 @@ import { CollectionArchive } from '@/components/CollectionArchive' import configPromise from '@payload-config' import { getPayload } from 'payload' import React from 'react' -import { Post } from '@/payload-types' import { Search } from '@/search/Component' import PageClient from './page.client' import { CardPostData } from '@/components/Card' diff --git a/templates/with-vercel-website/src/blocks/Form/Checkbox/index.tsx b/templates/with-vercel-website/src/blocks/Form/Checkbox/index.tsx index 541138d16b..0d43f93cfe 100644 --- a/templates/with-vercel-website/src/blocks/Form/Checkbox/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Checkbox/index.tsx @@ -12,14 +12,8 @@ import { Width } from '../Width' export const Checkbox: React.FC< CheckboxField & { - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > - getValues: any + errors: Partial register: UseFormRegister - setValue: any } > = ({ name, defaultValue, errors, label, register, required, width }) => { const props = register(name, { required: required }) diff --git a/templates/with-vercel-website/src/blocks/Form/Component.tsx b/templates/with-vercel-website/src/blocks/Form/Component.tsx index d5a9df0e2c..7d4d7a15e3 100644 --- a/templates/with-vercel-website/src/blocks/Form/Component.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Component.tsx @@ -142,6 +142,7 @@ export const FormBlock: React.FC< {formFromProps && formFromProps.fields && formFromProps.fields?.map((field, index) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any const Field: React.FC = fields?.[field.blockType] if (Field) { return ( diff --git a/templates/with-vercel-website/src/blocks/Form/Country/index.tsx b/templates/with-vercel-website/src/blocks/Form/Country/index.tsx index 8248907cc3..f64e77515a 100644 --- a/templates/with-vercel-website/src/blocks/Form/Country/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Country/index.tsx @@ -1,5 +1,5 @@ import type { CountryField } from '@payloadcms/plugin-form-builder/types' -import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form' +import type { Control, FieldErrorsImpl } from 'react-hook-form' import { Label } from '@/components/ui/label' import { @@ -18,12 +18,8 @@ import { countryOptions } from './options' export const Country: React.FC< CountryField & { - control: Control - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + control: Control + errors: Partial } > = ({ name, control, errors, label, required, width }) => { return ( diff --git a/templates/with-vercel-website/src/blocks/Form/Email/index.tsx b/templates/with-vercel-website/src/blocks/Form/Email/index.tsx index dc25b04126..6df5112dc5 100644 --- a/templates/with-vercel-website/src/blocks/Form/Email/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Email/index.tsx @@ -10,11 +10,7 @@ import { Width } from '../Width' export const Email: React.FC< EmailField & { - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + errors: Partial register: UseFormRegister } > = ({ name, defaultValue, errors, label, register, required, width }) => { diff --git a/templates/with-vercel-website/src/blocks/Form/Number/index.tsx b/templates/with-vercel-website/src/blocks/Form/Number/index.tsx index 06d3638963..dc33d0f96d 100644 --- a/templates/with-vercel-website/src/blocks/Form/Number/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Number/index.tsx @@ -9,11 +9,7 @@ import { Error } from '../Error' import { Width } from '../Width' export const Number: React.FC< TextField & { - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + errors: Partial register: UseFormRegister } > = ({ name, defaultValue, errors, label, register, required, width }) => { diff --git a/templates/with-vercel-website/src/blocks/Form/Select/index.tsx b/templates/with-vercel-website/src/blocks/Form/Select/index.tsx index dc4dbac673..f6de6346b5 100644 --- a/templates/with-vercel-website/src/blocks/Form/Select/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Select/index.tsx @@ -1,5 +1,5 @@ import type { SelectField } from '@payloadcms/plugin-form-builder/types' -import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form' +import type { Control, FieldErrorsImpl } from 'react-hook-form' import { Label } from '@/components/ui/label' import { @@ -17,12 +17,8 @@ import { Width } from '../Width' export const Select: React.FC< SelectField & { - control: Control - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + control: Control + errors: Partial } > = ({ name, control, errors, label, options, required, width }) => { return ( diff --git a/templates/with-vercel-website/src/blocks/Form/State/index.tsx b/templates/with-vercel-website/src/blocks/Form/State/index.tsx index 10d26eff61..f8215d1e10 100644 --- a/templates/with-vercel-website/src/blocks/Form/State/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/State/index.tsx @@ -1,5 +1,5 @@ import type { StateField } from '@payloadcms/plugin-form-builder/types' -import type { Control, FieldErrorsImpl, FieldValues } from 'react-hook-form' +import type { Control, FieldErrorsImpl } from 'react-hook-form' import { Label } from '@/components/ui/label' import { @@ -18,12 +18,8 @@ import { stateOptions } from './options' export const State: React.FC< StateField & { - control: Control - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + control: Control + errors: Partial } > = ({ name, control, errors, label, required, width }) => { return ( diff --git a/templates/with-vercel-website/src/blocks/Form/Text/index.tsx b/templates/with-vercel-website/src/blocks/Form/Text/index.tsx index 42f04b09da..f70a0fbec8 100644 --- a/templates/with-vercel-website/src/blocks/Form/Text/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Text/index.tsx @@ -10,11 +10,7 @@ import { Width } from '../Width' export const Text: React.FC< TextField & { - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + errors: Partial register: UseFormRegister } > = ({ name, defaultValue, errors, label, register, required, width }) => { diff --git a/templates/with-vercel-website/src/blocks/Form/Textarea/index.tsx b/templates/with-vercel-website/src/blocks/Form/Textarea/index.tsx index 45f0418be9..9c596915e1 100644 --- a/templates/with-vercel-website/src/blocks/Form/Textarea/index.tsx +++ b/templates/with-vercel-website/src/blocks/Form/Textarea/index.tsx @@ -10,11 +10,7 @@ import { Width } from '../Width' export const Textarea: React.FC< TextField & { - errors: Partial< - FieldErrorsImpl<{ - [x: string]: any - }> - > + errors: Partial register: UseFormRegister rows?: number } diff --git a/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx b/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx index 214657f5df..8d8c9798b2 100644 --- a/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx +++ b/templates/with-vercel-website/src/blocks/RelatedPosts/Component.tsx @@ -5,11 +5,12 @@ import RichText from '@/components/RichText' import type { Post } from '@/payload-types' import { Card } from '../../components/Card' +import { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical' export type RelatedPostsProps = { className?: string docs?: Post[] - introContent?: any + introContent?: SerializedEditorState } export const RelatedPosts: React.FC = (props) => { diff --git a/templates/with-vercel-website/src/blocks/RenderBlocks.tsx b/templates/with-vercel-website/src/blocks/RenderBlocks.tsx index 459a678815..c84634a64a 100644 --- a/templates/with-vercel-website/src/blocks/RenderBlocks.tsx +++ b/templates/with-vercel-website/src/blocks/RenderBlocks.tsx @@ -1,4 +1,3 @@ -import { cn } from '@/utilities/ui' import React, { Fragment } from 'react' import type { Page } from '@/payload-types' diff --git a/templates/with-vercel-website/src/components/CollectionArchive/index.tsx b/templates/with-vercel-website/src/components/CollectionArchive/index.tsx index 49adc95839..b0a2a1c493 100644 --- a/templates/with-vercel-website/src/components/CollectionArchive/index.tsx +++ b/templates/with-vercel-website/src/components/CollectionArchive/index.tsx @@ -1,8 +1,6 @@ import { cn } from '@/utilities/ui' import React from 'react' -import type { Post } from '@/payload-types' - import { Card, CardPostData } from '@/components/Card' export type Props = { diff --git a/templates/with-vercel-website/src/components/Media/ImageMedia/index.tsx b/templates/with-vercel-website/src/components/Media/ImageMedia/index.tsx index d60a98ff25..948346ce53 100644 --- a/templates/with-vercel-website/src/components/Media/ImageMedia/index.tsx +++ b/templates/with-vercel-website/src/components/Media/ImageMedia/index.tsx @@ -35,13 +35,7 @@ export const ImageMedia: React.FC = (props) => { let src: StaticImageData | string = srcFromProps || '' if (!src && resource && typeof resource === 'object') { - const { - alt: altFromResource, - filename: fullFilename, - height: fullHeight, - url, - width: fullWidth, - } = resource + const { alt: altFromResource, height: fullHeight, url, width: fullWidth } = resource width = fullWidth! height = fullHeight! diff --git a/templates/with-vercel-website/src/components/Media/index.tsx b/templates/with-vercel-website/src/components/Media/index.tsx index 2714c8a708..a4e2b9d0ef 100644 --- a/templates/with-vercel-website/src/components/Media/index.tsx +++ b/templates/with-vercel-website/src/components/Media/index.tsx @@ -9,7 +9,7 @@ export const Media: React.FC = (props) => { const { className, htmlElement = 'div', resource } = props const isVideo = typeof resource === 'object' && resource?.mimeType?.includes('video') - const Tag = (htmlElement as any) || Fragment + const Tag = htmlElement || Fragment return ( = { underline: IS_UNDERLINE, } -export const DETAIL_TYPE_TO_DETAIL: Record = { +export const DETAIL_TYPE_TO_DETAIL: Record = { directionless: IS_DIRECTIONLESS, unmergeable: IS_UNMERGEABLE, } @@ -115,13 +109,13 @@ export const ELEMENT_FORMAT_TO_TYPE: Record = { [IS_ALIGN_START]: 'start', } -export const TEXT_MODE_TO_TYPE: Record = { +export const TEXT_MODE_TO_TYPE: Record = { normal: IS_NORMAL, segmented: IS_SEGMENTED, token: IS_TOKEN, } -export const TEXT_TYPE_TO_MODE: Record = { +export const TEXT_TYPE_TO_MODE: Record = { [IS_NORMAL]: 'normal', [IS_SEGMENTED]: 'segmented', [IS_TOKEN]: 'token', diff --git a/templates/with-vercel-website/src/components/RichText/serialize.tsx b/templates/with-vercel-website/src/components/RichText/serialize.tsx index b70c45f894..e9991a63bb 100644 --- a/templates/with-vercel-website/src/components/RichText/serialize.tsx +++ b/templates/with-vercel-website/src/components/RichText/serialize.tsx @@ -160,7 +160,6 @@ export function serializeLexical({ nodes }: Props): JSX.Element { aria-checked={node.checked ? 'true' : 'false'} className={` ${node.checked ? '' : ''}`} key={index} - // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role role="checkbox" tabIndex={-1} value={node?.value} @@ -190,7 +189,8 @@ export function serializeLexical({ nodes }: Props): JSX.Element { diff --git a/templates/with-vercel-website/src/endpoints/seed/contact-page.ts b/templates/with-vercel-website/src/endpoints/seed/contact-page.ts index f17fa373cd..4290f1117c 100644 --- a/templates/with-vercel-website/src/endpoints/seed/contact-page.ts +++ b/templates/with-vercel-website/src/endpoints/seed/contact-page.ts @@ -10,7 +10,7 @@ export const contact: Partial = { { blockType: 'formBlock', enableIntro: true, - // @ts-ignore + // @ts-expect-error this should dissapear when upgrading to the latest version of Payload form: '{{CONTACT_FORM_ID}}', introContent: { root: { diff --git a/templates/with-vercel-website/src/endpoints/seed/home-static.ts b/templates/with-vercel-website/src/endpoints/seed/home-static.ts index 91a652dfea..547a6a790f 100644 --- a/templates/with-vercel-website/src/endpoints/seed/home-static.ts +++ b/templates/with-vercel-website/src/endpoints/seed/home-static.ts @@ -1,7 +1,6 @@ import type { Page } from '@/payload-types' // Used for pre-seeded content so that the homepage is not empty -// @ts-expect-error export const homeStatic: Page = { slug: 'home', _status: 'published', @@ -85,4 +84,8 @@ export const homeStatic: Page = { title: 'Payload Website Template', }, title: 'Home', + id: 0, + layout: [], + updatedAt: '', + createdAt: '', } diff --git a/templates/with-vercel-website/src/endpoints/seed/home.ts b/templates/with-vercel-website/src/endpoints/seed/home.ts index 09ce6e87cd..d8f7902dc6 100644 --- a/templates/with-vercel-website/src/endpoints/seed/home.ts +++ b/templates/with-vercel-website/src/endpoints/seed/home.ts @@ -23,7 +23,7 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { }, }, ], - // @ts-ignore + // @ts-expect-error - this should disappear when upgrading to the latest version of Payload media: '{{IMAGE_1}}', richText: { root: { @@ -502,7 +502,7 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { { blockName: 'Media Block', blockType: 'mediaBlock', - // @ts-ignore + // @ts-expect-error - this should disappear when upgrading to the latest version of Payload media: '{{IMAGE_2}}', }, { @@ -659,7 +659,7 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { ], meta: { description: 'An open-source website built with Payload and Next.js.', - // @ts-ignore + // @ts-expect-error - this should disappear when upgrading to the latest version of Payload image: '{{IMAGE_1}}', title: 'Payload Website Template', }, diff --git a/templates/with-vercel-website/src/endpoints/seed/index.ts b/templates/with-vercel-website/src/endpoints/seed/index.ts index 8681da2580..c8ce659b60 100644 --- a/templates/with-vercel-website/src/endpoints/seed/index.ts +++ b/templates/with-vercel-website/src/endpoints/seed/index.ts @@ -104,9 +104,6 @@ export const seed = async ({ technologyCategory, newsCategory, financeCategory, - designCategory, - softwareCategory, - engineeringCategory, ] = await Promise.all([ payload.create({ collection: 'users', diff --git a/templates/with-vercel-website/src/fields/slug/formatSlug.ts b/templates/with-vercel-website/src/fields/slug/formatSlug.ts index 004e9f2ede..9129de8932 100644 --- a/templates/with-vercel-website/src/fields/slug/formatSlug.ts +++ b/templates/with-vercel-website/src/fields/slug/formatSlug.ts @@ -8,7 +8,7 @@ export const formatSlug = (val: string): string => export const formatSlugHook = (fallback: string): FieldHook => - ({ data, operation, originalDoc, value }) => { + ({ data, operation, value }) => { if (typeof value === 'string') { return formatSlug(value) } diff --git a/templates/with-vercel-website/src/fields/slug/index.ts b/templates/with-vercel-website/src/fields/slug/index.ts index 95416af59c..77feae0e31 100644 --- a/templates/with-vercel-website/src/fields/slug/index.ts +++ b/templates/with-vercel-website/src/fields/slug/index.ts @@ -23,8 +23,7 @@ export const slugField: Slug = (fieldToUse = 'title', overrides = {}) => { ...checkboxOverrides, } - // Expect ts error here because of typescript mismatching Partial with TextField - // @ts-expect-error + // @ts-expect-error - ts mismatch Partial with TextField const slugField: TextField = { name: 'slug', type: 'text', diff --git a/templates/with-vercel-website/src/migrations/20250114_010510_initial.ts b/templates/with-vercel-website/src/migrations/20250114_010510_initial.ts index 78ba9f258e..c1a729be25 100644 --- a/templates/with-vercel-website/src/migrations/20250114_010510_initial.ts +++ b/templates/with-vercel-website/src/migrations/20250114_010510_initial.ts @@ -1,6 +1,6 @@ import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-vercel-postgres' -export async function up({ db, payload, req }: MigrateUpArgs): Promise { +export async function up({ db }: MigrateUpArgs): Promise { await db.execute(sql` CREATE TYPE "public"."enum_pages_hero_links_link_type" AS ENUM('reference', 'custom'); CREATE TYPE "public"."enum_pages_hero_links_link_appearance" AS ENUM('default', 'outline'); @@ -1558,7 +1558,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { CREATE INDEX IF NOT EXISTS "footer_rels_posts_id_idx" ON "footer_rels" USING btree ("posts_id");`) } -export async function down({ db, payload, req }: MigrateDownArgs): Promise { +export async function down({ db }: MigrateDownArgs): Promise { await db.execute(sql` DROP TABLE "pages_hero_links" CASCADE; DROP TABLE "pages_blocks_cta_links" CASCADE; diff --git a/templates/with-vercel-website/src/search/beforeSync.ts b/templates/with-vercel-website/src/search/beforeSync.ts index d0c03c83c1..5fc5f128ec 100644 --- a/templates/with-vercel-website/src/search/beforeSync.ts +++ b/templates/with-vercel-website/src/search/beforeSync.ts @@ -1,11 +1,11 @@ import { BeforeSync, DocToSync } from '@payloadcms/plugin-search/types' -export const beforeSyncWithSearch: BeforeSync = async ({ originalDoc, searchDoc, payload }) => { +export const beforeSyncWithSearch: BeforeSync = async ({ originalDoc, searchDoc }) => { const { doc: { relationTo: collection }, } = searchDoc - const { slug, id, categories, title, meta, excerpt } = originalDoc + const { slug, id, categories, title, meta } = originalDoc const modifiedDoc: DocToSync = { ...searchDoc, @@ -33,7 +33,7 @@ export const beforeSyncWithSearch: BeforeSync = async ({ originalDoc, searchDoc, }) modifiedDoc.categories = mappedCategories - } catch (err) { + } catch (_err) { console.error( `Failed. Category not found when syncing collection '${collection}' with id: '${id}' to search.`, ) diff --git a/templates/with-vercel-website/src/utilities/deepMerge.ts b/templates/with-vercel-website/src/utilities/deepMerge.ts index e0e9352c41..62cc18d441 100644 --- a/templates/with-vercel-website/src/utilities/deepMerge.ts +++ b/templates/with-vercel-website/src/utilities/deepMerge.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck /** @@ -5,8 +6,8 @@ * @param item * @returns {boolean} */ -export function isObject(item: unknown): boolean { - return item && typeof item === 'object' && !Array.isArray(item) +export function isObject(item: unknown): item is object { + return typeof item === 'object' && !Array.isArray(item) } /**