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

@@ -30,7 +30,7 @@ export default async function Page({ params }: PageParams) {
`${
process.env.NEXT_PUBLIC_PAYLOAD_URL
}/api/pages?where[slug][equals]=${lastSlug.toLowerCase()}&depth=1`,
)?.then(res => res.json()?.then(data => data.docs[0]))
)?.then((res) => res.json()?.then((data) => data.docs[0]))
if (!page) {
return notFound()
@@ -50,10 +50,10 @@ export async function generateStaticParams() {
const pages: Page[] = await fetch(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/pages?depth=0&limit=300`,
)?.then(res => res.json()?.then(data => data.docs))
)?.then((res) => res.json()?.then((data) => data.docs))
if (pages && Array.isArray(pages) && pages.length > 0) {
paths = pages.map(page => {
paths = pages.map((page) => {
const { slug, breadcrumbs } = page
let slugs = [slug]
@@ -62,7 +62,7 @@ export async function generateStaticParams() {
if (hasBreadcrumbs) {
slugs = breadcrumbs
.map(crumb => {
.map((crumb) => {
const { url } = crumb
let slug: string = ''

View File

@@ -9,7 +9,7 @@ import classes from './index.module.scss'
const Title: React.FC = () => <span>Dashboard</span>
export const AdminBarClient: React.FC<PayloadAdminBarProps> = props => {
export const AdminBarClient: React.FC<PayloadAdminBarProps> = (props) => {
const [user, setUser] = useState<PayloadMeUser>()
return (

View File

@@ -11,7 +11,7 @@ import classes from './index.module.scss'
export async function Header() {
const mainMenu: MainMenu = await fetch(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/globals/main-menu`,
).then(res => res.json())
).then((res) => res.json())
const { navItems } = mainMenu

View File

@@ -29,7 +29,18 @@ $breakpoint: 1000px;
html {
font-size: 20px;
line-height: 1.5;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
@media (max-width: $breakpoint) {
font-size: 16px;

View File

@@ -11,7 +11,7 @@ export const AdminBar: React.FC<{
adminBarProps?: PayloadAdminBarProps
user?: PayloadMeUser
setUser?: (user: PayloadMeUser) => void // eslint-disable-line no-unused-vars
}> = props => {
}> = (props) => {
const { adminBarProps, user, setUser } = props
return (

View File

@@ -43,7 +43,7 @@ export const Header: React.FC<{
mainMenu: MainMenu
}
adminBarProps: PayloadAdminBarProps
}> = props => {
}> = (props) => {
const { globals, adminBarProps } = props
const [user, setUser] = useState<PayloadMeUser>()

View File

@@ -13,7 +13,7 @@ const Page: React.FC<
mainMenu: MainMenu
preview?: boolean
}
> = props => {
> = (props) => {
const { title, richText } = props
return (
@@ -44,7 +44,7 @@ export const getStaticProps: GetStaticProps = async (context: GetStaticPropsCont
`${
process.env.NEXT_PUBLIC_PAYLOAD_URL
}/api/pages?where[slug][equals]=${lastSlug.toLowerCase()}&depth=1`,
)?.then(res => res.json()?.then(data => data.docs[0]))
)?.then((res) => res.json()?.then((data) => data.docs[0]))
return {
props: {
@@ -70,11 +70,11 @@ export const getStaticPaths: GetStaticPaths = async () => {
const pages: Page[] = await fetch(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/pages?depth=0&limit=300`,
)
?.then(res => res.json())
?.then(data => data.docs)
?.then((res) => res.json())
?.then((data) => data.docs)
if (pages && Array.isArray(pages) && pages.length > 0) {
paths = pages.map(page => {
paths = pages.map((page) => {
const { slug, breadcrumbs } = page
let slugs = [slug]
@@ -83,7 +83,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
if (hasBreadcrumbs) {
slugs = breadcrumbs
.map(crumb => {
.map((crumb) => {
const { url } = crumb
let slug: string = ''

View File

@@ -29,7 +29,18 @@ $breakpoint: 1000px;
html {
font-size: 20px;
line-height: 1.5;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
@media (max-width: $breakpoint) {
font-size: 16px;
@@ -136,7 +147,18 @@ $breakpoint: 1000px;
html {
font-size: 20px;
line-height: 1.5;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
system-ui,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
@media (max-width: $breakpoint) {
font-size: 16px;

View File

@@ -4,7 +4,7 @@ import Page, { getStaticProps as sharedGetStaticProps } from './[...slug]'
export default Page
export const getStaticProps: GetStaticProps = async ctx => {
export const getStaticProps: GetStaticProps = async (ctx) => {
const func = sharedGetStaticProps.bind(this)
return func(ctx)
}

View File

@@ -12,10 +12,10 @@
"preLaunchTask": "npm: build:server",
"env": {
"PAYLOAD_CONFIG_PATH": "${workspaceFolder}/src/payload.config.ts"
},
}
// "outFiles": [
// "${workspaceFolder}/dist/**/*.js"
// ]
},
}
]
}

View File

@@ -125,7 +125,7 @@ const link: LinkType = ({ appearances, disableLabel = false, overrides = {} } =
]
if (appearances) {
appearanceOptionsToUse = appearances.map(appearance => appearanceOptions[appearance])
appearanceOptionsToUse = appearances.map((appearance) => appearanceOptions[appearance])
}
linkResult.fields.push({

View File

@@ -31,7 +31,7 @@ export default buildConfig({
nestedDocs({
collections: ['pages'],
generateLabel: (_, doc) => doc.title as string,
generateURL: docs => docs.reduce((url, doc) => `${url}/${doc.slug}`, ''),
generateURL: (docs) => docs.reduce((url, doc) => `${url}/${doc.slug}`, ''),
}),
],
})

View File

@@ -15,7 +15,7 @@ export const seed = async (payload: Payload): Promise<void> => {
})
const [parentDoc, childDoc, grandchildDoc] = await Promise.all(
Array.from(Array(3).keys()).map(key =>
Array.from(Array(3).keys()).map((key) =>
payload.create({
collection: 'pages',
data: {

View File

@@ -17,7 +17,7 @@ export function isObject(item: unknown): boolean {
export default function deepMerge<T, R>(target: T, source: R): T {
const output = { ...target }
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(key => {
Object.keys(source).forEach((key) => {
if (isObject(source[key])) {
if (!(key in target)) {
Object.assign(output, { [key]: source[key] })