chore: run lint and prettier on entire codebase

This commit is contained in:
Alessio Gravili
2024-07-11 15:27:01 -04:00
parent f8ab5a9f1e
commit 83fd4c6622
364 changed files with 2578 additions and 2658 deletions

View File

@@ -2,16 +2,12 @@ import type { CollectionConfig } from 'payload'
export const CustomIdRow: CollectionConfig = {
slug: 'customIdRow',
labels: {
singular: 'Custom Id Row',
plural: 'Custom Ids Row',
},
admin: {
description: 'Description',
listSearchableFields: ['id', 'title', 'description', 'number'],
group: 'One',
useAsTitle: 'title',
defaultColumns: ['id', 'number', 'title'],
description: 'Description',
group: 'One',
listSearchableFields: ['id', 'title', 'description', 'number'],
useAsTitle: 'title',
},
fields: [
{
@@ -36,4 +32,8 @@ export const CustomIdRow: CollectionConfig = {
],
},
],
labels: {
plural: 'Custom Ids Row',
singular: 'Custom Id Row',
},
}

View File

@@ -2,23 +2,18 @@ import type { CollectionConfig } from 'payload'
export const CustomIdTab: CollectionConfig = {
slug: 'customIdTab',
labels: {
singular: 'Custom Id Tab',
plural: 'Custom Ids Tab',
},
admin: {
description: 'Description',
listSearchableFields: ['id', 'title', 'description', 'number'],
group: 'One',
useAsTitle: 'title',
defaultColumns: ['id', 'number', 'title'],
description: 'Description',
group: 'One',
listSearchableFields: ['id', 'title', 'description', 'number'],
useAsTitle: 'title',
},
fields: [
{
type: 'tabs',
tabs: [
{
label: 'Tab 1',
fields: [
{
name: 'title',
@@ -37,8 +32,13 @@ export const CustomIdTab: CollectionConfig = {
type: 'number',
},
],
label: 'Tab 1',
},
],
},
],
labels: {
plural: 'Custom Ids Tab',
singular: 'Custom Id Tab',
},
}

View File

@@ -23,6 +23,14 @@ export const CustomViews2: CollectionConfig = {
views: {
Edit: {
// This will override one specific nested view within the `/edit/:id` route, i.e. `/edit/:id/versions`
CustomViewWithParam: {
Component: CustomTabWithParamView,
Tab: {
href: `${customCollectionParamViewPathBase}/123`,
label: 'Custom Param View',
},
path: customCollectionParamViewPath,
},
Default: {
Tab: {
label: customEditLabel,
@@ -43,21 +51,13 @@ export const CustomViews2: CollectionConfig = {
},
MyCustomViewWithNestedPath: {
Component: CustomNestedTabView,
path: customNestedTabViewPath,
Tab: {
label: 'Custom Nested Tab View',
href: customNestedTabViewPath,
label: 'Custom Nested Tab View',
},
path: customNestedTabViewPath,
},
Versions: CustomVersionsView,
CustomViewWithParam: {
Component: CustomTabWithParamView,
path: customCollectionParamViewPath,
Tab: {
label: 'Custom Param View',
href: `${customCollectionParamViewPathBase}/123`,
},
},
},
},
},

View File

@@ -16,15 +16,15 @@ export const Posts: CollectionConfig = {
description: 'Description',
group: 'One',
listSearchableFields: ['id', 'title', 'description', 'number'],
preview: () => 'https://payloadcms.com',
useAsTitle: 'title',
meta: {
description: 'This is a custom meta description for posts',
openGraph: {
title: 'This is a custom OG title for posts',
description: 'This is a custom OG description for posts',
title: 'This is a custom OG title for posts',
},
},
preview: () => 'https://payloadcms.com',
useAsTitle: 'title',
},
fields: [
{

View File

@@ -4,13 +4,13 @@ import { uploadCollectionSlug } from '../slugs.js'
export const UploadCollection: CollectionConfig = {
slug: uploadCollectionSlug,
upload: {
adminThumbnail: () => 'https://payloadcms.com/images/universal-truth.jpg',
},
fields: [
{
name: 'title',
type: 'text',
},
],
upload: {
adminThumbnail: () => 'https://payloadcms.com/images/universal-truth.jpg',
},
}

View File

@@ -86,14 +86,8 @@ export default buildConfigWithDefaults({
},
},
},
routes: customAdminRoutes,
meta: {
titleSuffix: '- Custom CMS',
description: 'This is a custom meta description',
openGraph: {
title: 'This is a custom OG title',
description: 'This is a custom OG description',
},
icons: [
{
type: 'image/png',
@@ -107,7 +101,13 @@ export default buildConfigWithDefaults({
url: customFaviconLight.src,
},
],
openGraph: {
description: 'This is a custom OG description',
title: 'This is a custom OG title',
},
titleSuffix: '- Custom CMS',
},
routes: customAdminRoutes,
},
collections: [
UploadCollection,

View File

@@ -102,7 +102,7 @@ describe('admin1', () => {
snapshotKey: 'adminTests1',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL, customAdminRoutes })
await ensureAutoLoginAndCompilationIsDone({ customAdminRoutes, page, serverURL })
adminRoutes = getAdminRoutes({ customAdminRoutes })
@@ -114,7 +114,7 @@ describe('admin1', () => {
snapshotKey: 'adminTests1',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL, customAdminRoutes })
await ensureAutoLoginAndCompilationIsDone({ customAdminRoutes, page, serverURL })
})
describe('metadata', () => {

View File

@@ -67,7 +67,7 @@ describe('admin2', () => {
snapshotKey: 'adminTests2',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL, customAdminRoutes })
await ensureAutoLoginAndCompilationIsDone({ customAdminRoutes, page, serverURL })
adminRoutes = getAdminRoutes({ customAdminRoutes })
})
@@ -77,7 +77,7 @@ describe('admin2', () => {
snapshotKey: 'adminTests2',
})
await ensureAutoLoginAndCompilationIsDone({ page, serverURL, customAdminRoutes })
await ensureAutoLoginAndCompilationIsDone({ customAdminRoutes, page, serverURL })
})
describe('custom CSS', () => {
@@ -267,8 +267,8 @@ describe('admin2', () => {
const tableRows = page.locator(tableRowLocator)
await expect(tableRows).toHaveCount(1)
const firstId = await page.locator(tableRowLocator).first().locator('.cell-id').innerText()
expect(firstId).toEqual(`ID: ${id}`)
const firstId = page.locator(tableRowLocator).first().locator('.cell-id')
await expect(firstId).toHaveText(`ID: ${id}`)
// Remove filter
await page.locator('.condition__actions-remove').click()

View File

@@ -1,11 +1,12 @@
import { rootEslintConfig, rootParserOptions } from '../../eslint.config.js'
import { rootParserOptions } from '../../eslint.config.js'
import testEslintConfig from '../eslint.config.js'
/** @typedef {import('eslint').Linter.FlatConfig} */
let FlatConfig
/** @type {FlatConfig[]} */
export const index = [
...rootEslintConfig,
...testEslintConfig,
{
languageOptions: {
parserOptions: {

View File

@@ -45,8 +45,8 @@ export const seed = async (_payload) => {
_payload.create({
collection: postsCollectionSlug,
data: {
title: 'Title',
description: 'Description',
title: 'Title',
},
depth: 0,
overrideAccess: true,
@@ -122,9 +122,9 @@ export const seed = async (_payload) => {
export async function clearAndSeedEverything(_payload: Payload) {
return await seedDB({
snapshotKey: 'adminTest',
collectionSlugs,
_payload,
collectionSlugs,
seedFunction: seed,
snapshotKey: 'adminTest',
})
}

View File

@@ -36,6 +36,6 @@ export const customCollectionParamViewPathBase = '/custom-param'
export const customCollectionParamViewPath = `${customCollectionParamViewPathBase}/:slug`
export const customAdminRoutes = {
logout: '/custom-logout',
inactivity: '/custom-inactivity',
logout: '/custom-logout',
}