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

@@ -19,9 +19,9 @@ export default buildConfigWithDefaults({
{
slug: collectionSlug,
access: {
read: () => true,
create: () => true,
delete: () => true,
read: () => true,
update: () => true,
},
endpoints: collectionEndpoints,
@@ -34,7 +34,6 @@ export default buildConfigWithDefaults({
},
{
slug: noEndpointsCollectionSlug,
graphQL: false,
endpoints: false,
fields: [
{
@@ -42,8 +41,10 @@ export default buildConfigWithDefaults({
type: 'text',
},
],
graphQL: false,
},
],
endpoints,
globals: [
{
slug: globalSlug,
@@ -52,7 +53,6 @@ export default buildConfigWithDefaults({
},
{
slug: noEndpointsGlobalSlug,
graphQL: false,
endpoints: false,
fields: [
{
@@ -60,9 +60,9 @@ export default buildConfigWithDefaults({
type: 'text',
},
],
graphQL: false,
},
],
endpoints,
onInit: async (payload) => {
await payload.create({
collection: 'users',

View File

@@ -2,31 +2,29 @@ import type { CollectionConfig } from 'payload'
export const collectionEndpoints: CollectionConfig['endpoints'] = [
{
path: '/say-hello/joe-bloggs',
method: 'get',
handler: () => {
return Response.json({ message: 'Hey Joey!' })
},
method: 'get',
path: '/say-hello/joe-bloggs',
},
{
path: '/say-hello/:group/:name',
method: 'get',
handler: (req) => {
return Response.json({
message: `Hello ${req.routeParams.name as string} @ ${req.routeParams.group as string}`,
})
},
method: 'get',
path: '/say-hello/:group/:name',
},
{
path: '/say-hello/:name',
method: 'get',
handler: (req) => {
return Response.json({ message: `Hello ${req.routeParams.name as string}!` })
},
method: 'get',
path: '/say-hello/:name',
},
{
path: '/whoami',
method: 'post',
handler: async (req) => {
let data
@@ -43,5 +41,7 @@ export const collectionEndpoints: CollectionConfig['endpoints'] = [
age: req.data.age,
})
},
method: 'post',
path: '/whoami',
},
]

View File

@@ -4,10 +4,10 @@ import { globalEndpoint } from '../shared.js'
export const globalEndpoints: GlobalConfig['endpoints'] = [
{
path: `/${globalEndpoint}`,
method: 'post',
handler: (req) => {
return Response.json(req.body)
},
method: 'post',
path: `/${globalEndpoint}`,
},
]

View File

@@ -4,38 +4,38 @@ import { applicationEndpoint, rootEndpoint } from '../shared.js'
export const endpoints: Config['endpoints'] = [
{
path: `/${applicationEndpoint}`,
method: 'post',
handler: (req) => {
return Response.json(req.body)
},
method: 'post',
path: `/${applicationEndpoint}`,
},
{
path: `/${applicationEndpoint}`,
method: 'get',
handler: () => {
return Response.json({ message: 'Hello, world!' })
},
method: 'get',
path: `/${applicationEndpoint}`,
},
{
path: `/${applicationEndpoint}/i18n`,
method: 'get',
handler: (req) => {
return Response.json({ message: req.t('general:updatedSuccessfully') })
},
method: 'get',
path: `/${applicationEndpoint}/i18n`,
},
{
path: `/${rootEndpoint}`,
method: 'get',
handler: () => {
return Response.json({ message: 'Hello, world!' })
},
method: 'get',
path: `/${rootEndpoint}`,
},
{
path: `/${rootEndpoint}`,
method: 'post',
handler: (req) => {
return Response.json(req.body)
},
method: 'post',
path: `/${rootEndpoint}`,
},
]

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: {