diff --git a/templates/website/eslint.config.mjs b/templates/website/eslint.config.mjs index 37d29ea57d2..7acd77dd1b3 100644 --- a/templates/website/eslint.config.mjs +++ b/templates/website/eslint.config.mjs @@ -30,6 +30,9 @@ const eslintConfig = [ ], }, }, + { + ignores: ['.next/'], + }, ] export default eslintConfig diff --git a/templates/website/postcss.config.js b/templates/website/postcss.config.js index 2e7af2b7f1a..393a10f832b 100644 --- a/templates/website/postcss.config.js +++ b/templates/website/postcss.config.js @@ -1,6 +1,8 @@ -export default { +const config = { plugins: { tailwindcss: {}, autoprefixer: {}, }, } + +export default config diff --git a/templates/website/src/Footer/RowLabel.tsx b/templates/website/src/Footer/RowLabel.tsx index 57e747495b2..a6f949459c6 100644 --- a/templates/website/src/Footer/RowLabel.tsx +++ b/templates/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/website/src/Header/RowLabel.tsx b/templates/website/src/Header/RowLabel.tsx index 57e747495b2..a6f949459c6 100644 --- a/templates/website/src/Header/RowLabel.tsx +++ b/templates/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/website/src/app/(frontend)/next/preview/route.ts b/templates/website/src/app/(frontend)/next/preview/route.ts index 80642637c05..0e14ad47779 100644 --- a/templates/website/src/app/(frontend)/next/preview/route.ts +++ b/templates/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/website/src/app/(frontend)/next/seed/route.ts b/templates/website/src/app/(frontend)/next/seed/route.ts index 360a7d72791..326b677ccc3 100644 --- a/templates/website/src/app/(frontend)/next/seed/route.ts +++ b/templates/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/website/src/app/(frontend)/search/page.tsx b/templates/website/src/app/(frontend)/search/page.tsx index 4c1a451d48d..46bf2b1101f 100644 --- a/templates/website/src/app/(frontend)/search/page.tsx +++ b/templates/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/website/src/blocks/Form/Checkbox/index.tsx b/templates/website/src/blocks/Form/Checkbox/index.tsx index 541138d16b9..0d43f93cfe6 100644 --- a/templates/website/src/blocks/Form/Checkbox/index.tsx +++ b/templates/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/website/src/blocks/Form/Component.tsx b/templates/website/src/blocks/Form/Component.tsx index 38913aa12d6..a4b2a6caa3f 100644 --- a/templates/website/src/blocks/Form/Component.tsx +++ b/templates/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 as keyof typeof fields] if (Field) { return ( diff --git a/templates/website/src/blocks/Form/Country/index.tsx b/templates/website/src/blocks/Form/Country/index.tsx index 8248907cc3e..f64e77515ad 100644 --- a/templates/website/src/blocks/Form/Country/index.tsx +++ b/templates/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/website/src/blocks/Form/Email/index.tsx b/templates/website/src/blocks/Form/Email/index.tsx index dc25b04126e..6df5112dc5f 100644 --- a/templates/website/src/blocks/Form/Email/index.tsx +++ b/templates/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/website/src/blocks/Form/Number/index.tsx b/templates/website/src/blocks/Form/Number/index.tsx index 06d36389633..dc33d0f96d5 100644 --- a/templates/website/src/blocks/Form/Number/index.tsx +++ b/templates/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/website/src/blocks/Form/Select/index.tsx b/templates/website/src/blocks/Form/Select/index.tsx index dc4dbac673b..f6de6346b55 100644 --- a/templates/website/src/blocks/Form/Select/index.tsx +++ b/templates/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/website/src/blocks/Form/State/index.tsx b/templates/website/src/blocks/Form/State/index.tsx index 10d26eff61f..f8215d1e10b 100644 --- a/templates/website/src/blocks/Form/State/index.tsx +++ b/templates/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/website/src/blocks/Form/Text/index.tsx b/templates/website/src/blocks/Form/Text/index.tsx index 42f04b09dab..f70a0fbec88 100644 --- a/templates/website/src/blocks/Form/Text/index.tsx +++ b/templates/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/website/src/blocks/Form/Textarea/index.tsx b/templates/website/src/blocks/Form/Textarea/index.tsx index 45f0418be9d..9c596915e13 100644 --- a/templates/website/src/blocks/Form/Textarea/index.tsx +++ b/templates/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/website/src/blocks/RelatedPosts/Component.tsx b/templates/website/src/blocks/RelatedPosts/Component.tsx index 214657f5df4..8d8c9798b20 100644 --- a/templates/website/src/blocks/RelatedPosts/Component.tsx +++ b/templates/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/website/src/blocks/RenderBlocks.tsx b/templates/website/src/blocks/RenderBlocks.tsx index 459a6788159..c84634a64ad 100644 --- a/templates/website/src/blocks/RenderBlocks.tsx +++ b/templates/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/website/src/components/CollectionArchive/index.tsx b/templates/website/src/components/CollectionArchive/index.tsx index 49adc958399..b0a2a1c4935 100644 --- a/templates/website/src/components/CollectionArchive/index.tsx +++ b/templates/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/website/src/components/Media/ImageMedia/index.tsx b/templates/website/src/components/Media/ImageMedia/index.tsx index d60a98ff25a..948346ce535 100644 --- a/templates/website/src/components/Media/ImageMedia/index.tsx +++ b/templates/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/website/src/components/Media/index.tsx b/templates/website/src/components/Media/index.tsx index 2714c8a708d..a4e2b9d0ef3 100644 --- a/templates/website/src/components/Media/index.tsx +++ b/templates/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 ( = { { blockType: 'formBlock', enableIntro: true, - // @ts-ignore form: '{{CONTACT_FORM_ID}}', introContent: { root: { diff --git a/templates/website/src/endpoints/seed/home-static.ts b/templates/website/src/endpoints/seed/home-static.ts index 91a652dfea6..91c7558e2d5 100644 --- a/templates/website/src/endpoints/seed/home-static.ts +++ b/templates/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: '', + layout: [], + updatedAt: '', + createdAt: '', } diff --git a/templates/website/src/endpoints/seed/home.ts b/templates/website/src/endpoints/seed/home.ts index 09ce6e87cd4..3856eaa1ad8 100644 --- a/templates/website/src/endpoints/seed/home.ts +++ b/templates/website/src/endpoints/seed/home.ts @@ -23,7 +23,6 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { }, }, ], - // @ts-ignore media: '{{IMAGE_1}}', richText: { root: { @@ -502,7 +501,6 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { { blockName: 'Media Block', blockType: 'mediaBlock', - // @ts-ignore media: '{{IMAGE_2}}', }, { @@ -659,7 +657,6 @@ export const home: RequiredDataFromCollectionSlug<'pages'> = { ], meta: { description: 'An open-source website built with Payload and Next.js.', - // @ts-ignore image: '{{IMAGE_1}}', title: 'Payload Website Template', }, diff --git a/templates/website/src/endpoints/seed/index.ts b/templates/website/src/endpoints/seed/index.ts index 8681da25808..c8ce659b605 100644 --- a/templates/website/src/endpoints/seed/index.ts +++ b/templates/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/website/src/fields/slug/formatSlug.ts b/templates/website/src/fields/slug/formatSlug.ts index 004e9f2ede1..9129de8932d 100644 --- a/templates/website/src/fields/slug/formatSlug.ts +++ b/templates/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/website/src/fields/slug/index.ts b/templates/website/src/fields/slug/index.ts index 95416af59c5..77feae0e315 100644 --- a/templates/website/src/fields/slug/index.ts +++ b/templates/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/website/src/payload-types.ts b/templates/website/src/payload-types.ts index 4a797f0044f..7051d8f2042 100644 --- a/templates/website/src/payload-types.ts +++ b/templates/website/src/payload-types.ts @@ -1645,4 +1645,4 @@ export interface Auth { declare module 'payload' { export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/templates/website/src/search/beforeSync.ts b/templates/website/src/search/beforeSync.ts index d0c03c83c1b..5fc5f128ec5 100644 --- a/templates/website/src/search/beforeSync.ts +++ b/templates/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/website/src/utilities/deepMerge.ts b/templates/website/src/utilities/deepMerge.ts index e0e9352c415..62cc18d4410 100644 --- a/templates/website/src/utilities/deepMerge.ts +++ b/templates/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) } /** diff --git a/templates/website/tailwind.config.mjs b/templates/website/tailwind.config.mjs index 52f1043c696..44469ab102a 100644 --- a/templates/website/tailwind.config.mjs +++ b/templates/website/tailwind.config.mjs @@ -1,5 +1,8 @@ +import tailwindcssAnimate from 'tailwindcss-animate' +import typography from '@tailwindcss/typography' + /** @type {import('tailwindcss').Config} */ -export default { +const config = { content: [ './pages/**/*.{ts,tsx}', './components/**/*.{ts,tsx}', @@ -7,7 +10,7 @@ export default { './src/**/*.{ts,tsx}', ], darkMode: ['selector', '[data-theme="dark"]'], - plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')], + plugins: [tailwindcssAnimate, typography], prefix: '', safelist: [ 'lg:col-span-4', @@ -104,7 +107,7 @@ export default { to: { height: '0' }, }, }, - typography: ({ theme }) => ({ + typography: () => ({ DEFAULT: { css: [ { @@ -146,3 +149,5 @@ export default { }, }, } + +export default config