chore: significantly improve eslint performance, lint and prettier everything

This commit is contained in:
Alessio Gravili
2024-08-29 21:25:50 -04:00
parent bc367ab73c
commit 86fdad0bb8
653 changed files with 50289 additions and 19143 deletions

View File

@@ -9,9 +9,8 @@ export const index = [
{
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigDirName: import.meta.dirname,
...rootParserOptions,
tsconfigRootDir: import.meta.dirname,
},
},
},

View File

@@ -2,7 +2,7 @@ import type { DrizzleAdapter } from '@payloadcms/drizzle/types'
import type { Connect } from 'payload'
import { pushDevSchema } from '@payloadcms/drizzle'
import { VercelPool, sql } from '@vercel/postgres'
import { sql, VercelPool } from '@vercel/postgres'
import { drizzle } from 'drizzle-orm/node-postgres'
import type { VercelPostgresAdapter } from './types.js'
@@ -40,7 +40,9 @@ export const connect: Connect = async function connect(
}
} catch (err) {
this.payload.logger.error(`Error: cannot connect to Postgres. Details: ${err.message}`, err)
if (typeof this.rejectInitializing === 'function') this.rejectInitializing()
if (typeof this.rejectInitializing === 'function') {
this.rejectInitializing()
}
process.exit(1)
}
@@ -53,7 +55,9 @@ export const connect: Connect = async function connect(
await pushDevSchema(this as unknown as DrizzleAdapter)
}
if (typeof this.resolveInitializing === 'function') this.resolveInitializing()
if (typeof this.resolveInitializing === 'function') {
this.resolveInitializing()
}
if (process.env.NODE_ENV === 'production' && this.prodMigrations) {
await this.migrate({ migrations: this.prodMigrations })

View File

@@ -193,7 +193,9 @@ export const traverseFields = ({ doc, fields, locale, path, rows }: Args) => {
const matchedRelationship = rows.find((row) => {
const matchesPath = row.path === relationshipPath
if (locale) return matchesPath && locale === row.locale
if (locale) {
return matchesPath && locale === row.locale
}
return row.path === relationshipPath
})

View File

@@ -35,7 +35,9 @@ export const migrateRelationships = async ({
req,
tableName,
}: Args) => {
if (pathsToQuery.size === 0) return
if (pathsToQuery.size === 0) {
return
}
let offset = 0
@@ -54,7 +56,9 @@ export const migrateRelationships = async ({
paginationResult = await adapter.drizzle.execute(sql.raw(`${paginationStatement}`))
if (paginationResult.rows.length === 0) return
if (paginationResult.rows.length === 0) {
return
}
offset += 1
@@ -74,7 +78,9 @@ export const migrateRelationships = async ({
const parentID = row.parent_id
if (typeof parentID === 'string' || typeof parentID === 'number') {
if (!docsToResave[parentID]) docsToResave[parentID] = []
if (!docsToResave[parentID]) {
docsToResave[parentID] = []
}
docsToResave[parentID].push(row)
}
})

View File

@@ -33,7 +33,7 @@ export type Args = {
* @experimental This only works when there are not other tables or enums of the same name in the database under a different schema. Awaiting fix from Drizzle.
*/
schemaName?: string
transactionOptions?: PgTransactionConfig | false
transactionOptions?: false | PgTransactionConfig
versionsSuffix?: string
}