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

@@ -9,21 +9,6 @@ export default buildConfigWithDefaults({
collections: [
{
slug: 'posts',
hooks: {
beforeOperation: [
({ req, operation, args }) => {
if (operation === 'update') {
const defaultIDType = req.payload.db.defaultIDType
if (defaultIDType === 'number' && typeof args.id === 'string') {
throw new Error('ID was not sanitized to a number properly')
}
}
return args
},
],
},
fields: [
{
name: 'title',
@@ -45,6 +30,21 @@ export default buildConfigWithDefaults({
},
},
],
hooks: {
beforeOperation: [
({ args, operation, req }) => {
if (operation === 'update') {
const defaultIDType = req.payload.db.defaultIDType
if (defaultIDType === 'number' && typeof args.id === 'string') {
throw new Error('ID was not sanitized to a number properly')
}
}
return args
},
],
},
},
{
slug: 'relation-a',
@@ -92,7 +92,6 @@ export default buildConfigWithDefaults({
},
{
slug: 'pg-migrations',
versions: true,
fields: [
{
name: 'relation1',
@@ -115,8 +114,8 @@ export default buildConfigWithDefaults({
{
name: 'relation3',
type: 'relationship',
relationTo: 'relation-b',
localized: true,
relationTo: 'relation-b',
},
],
},
@@ -129,8 +128,8 @@ export default buildConfigWithDefaults({
{
name: 'relation4',
type: 'relationship',
relationTo: 'relation-b',
localized: true,
relationTo: 'relation-b',
},
],
},
@@ -149,14 +148,15 @@ export default buildConfigWithDefaults({
{
name: 'relation6',
type: 'relationship',
relationTo: 'relation-b',
localized: true,
relationTo: 'relation-b',
},
],
},
],
},
],
versions: true,
},
{
slug: 'custom-schema',

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

@@ -18,7 +18,7 @@ const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
let payload: Payload
let user: TypeWithID & Record<string, unknown>
let user: Record<string, unknown> & TypeWithID
let token: string
let restClient: NextRESTClient
const collection = 'posts'