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

@@ -15,7 +15,7 @@
width: 150px;
}
:global([data-theme="light"]) {
:global([data-theme='light']) {
.logo {
filter: invert(1);
}

View File

@@ -10,12 +10,12 @@ export const RenderParams: React.FC<{
className?: string
}> = ({ params = ['error', 'message', 'success'], message, className }) => {
const searchParams = useSearchParams()
const paramValues = params.map(param => searchParams.get(param)).filter(Boolean)
const paramValues = params.map((param) => searchParams.get(param)).filter(Boolean)
if (paramValues.length) {
return (
<div className={className}>
{paramValues.map(paramValue => (
{paramValues.map((paramValue) => (
<Message
key={paramValue}
message={(message || 'PARAM')?.replace('PARAM', paramValue || '')}

View File

@@ -1,7 +1,7 @@
@use './queries.scss' as *;
@use './colors.scss' as *;
@use './type.scss' as *;
@import "./theme.scss";
@import './theme.scss';
:root {
--base: 24px;
@@ -88,7 +88,7 @@ p {
margin: var(--base) 0;
@include mid-break {
margin: calc(var(--base) * .75) 0;
margin: calc(var(--base) * 0.75) 0;
}
}
@@ -102,12 +102,12 @@ a {
color: currentColor;
&:focus {
opacity: .8;
opacity: 0.8;
outline: none;
}
&:active {
opacity: .7;
opacity: 0.7;
outline: none;
}
}

View File

@@ -16,7 +16,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const [user, setUser] = useState<User | null>()
const create = useCallback<Create>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, args)
setUser(user)
@@ -38,7 +38,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
)
const login = useCallback<Login>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/login`, args)
setUser(user)
@@ -110,7 +110,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
}, [api])
const forgotPassword = useCallback<ForgotPassword>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
@@ -132,7 +132,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
)
const resetPassword = useCallback<ResetPassword>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -139,7 +139,7 @@ export const AccountForm: React.FC = () => {
label="Confirm Password"
required
register={register}
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
error={errors.passwordConfirm}
/>
</Fragment>

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -103,7 +103,7 @@ export const CreateAccountForm: React.FC = () => {
label="Confirm Password"
required
register={register}
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
error={errors.passwordConfirm}
/>
<Button

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.createAccount {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.login {
margin-bottom: var(--block-padding);

View File

@@ -5,7 +5,7 @@ import Link from 'next/link'
import { useAuth } from '../../_providers/Auth'
export const LogoutPage: React.FC = props => {
export const LogoutPage: React.FC = (props) => {
const { logout } = useAuth()
const [success, setSuccess] = useState('')
const [error, setError] = useState('')

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.error {
color: red;
@@ -20,4 +20,3 @@
.message {
margin-bottom: var(--base);
}

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.recoverPassword {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
width: 66.66%;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@
width: 150px;
}
:global([data-theme="light"]) {
:global([data-theme='light']) {
.logo {
filter: invert(1);
}

View File

@@ -9,12 +9,12 @@ export const RenderParams: React.FC<{
}> = ({ params = ['error', 'message', 'success'], message, className }) => {
const router = useRouter()
const searchParams = new URLSearchParams(router.query as any)
const paramValues = params.map(param => searchParams.get(param)).filter(Boolean)
const paramValues = params.map((param) => searchParams.get(param)).filter(Boolean)
if (paramValues.length) {
return (
<div className={className}>
{paramValues.map(paramValue => (
{paramValues.map((paramValue) => (
<Message key={paramValue} message={(message || 'PARAM')?.replace('PARAM', paramValue)} />
))}
</div>

View File

@@ -1,7 +1,7 @@
@use './queries.scss' as *;
@use './colors.scss' as *;
@use './type.scss' as *;
@import "./theme.scss";
@import './theme.scss';
:root {
--base: 24px;
@@ -88,7 +88,7 @@ p {
margin: var(--base) 0;
@include mid-break {
margin: calc(var(--base) * .75) 0;
margin: calc(var(--base) * 0.75) 0;
}
}
@@ -102,12 +102,12 @@ a {
color: currentColor;
&:focus {
opacity: .8;
opacity: 0.8;
outline: none;
}
&:active {
opacity: .7;
opacity: 0.7;
outline: none;
}
}

View File

@@ -1,4 +1,4 @@
@import "../../css/common";
@import '../../css/common';
.account {
margin-bottom: var(--block-padding);

View File

@@ -150,7 +150,7 @@ const Account: React.FC = () => {
label="Confirm Password"
required
register={register}
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
error={errors.passwordConfirm}
/>
</Fragment>

View File

@@ -1,4 +1,4 @@
@import "../../css/common";
@import '../../css/common';
.createAccount {
margin-bottom: var(--block-padding);

View File

@@ -106,7 +106,7 @@ const CreateAccount: React.FC = () => {
label="Confirm Password"
required
register={register}
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
error={errors.passwordConfirm}
/>
<Button

View File

@@ -1,4 +1,4 @@
@import "../../css/common";
@import '../../css/common';
.login {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../css/common";
@import '../../css/common';
.recoverPassword {
margin-bottom: var(--block-padding);
@@ -24,4 +24,3 @@
.message {
margin-bottom: var(--base);
}

View File

@@ -1,4 +1,4 @@
@import "../../css/common";
@import '../../css/common';
.resetPassword {
margin-bottom: var(--block-padding);

View File

@@ -14,7 +14,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const [user, setUser] = useState<User | null>()
const create = useCallback<Create>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, args)
setUser(user)
@@ -36,7 +36,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
)
const login = useCallback<Login>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/login`, args)
setUser(user)
@@ -108,7 +108,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
}, [api])
const forgotPassword = useCallback<ForgotPassword>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
@@ -130,7 +130,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
)
const resetPassword = useCallback<ResetPassword>(
async args => {
async (args) => {
if (api === 'rest') {
const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
'use client'
import type { ElementType } from 'react';
import type { ElementType } from 'react'
import Link from 'next/link'
import React from 'react'

View File

@@ -1,4 +1,4 @@
import type { Ref } from 'react';
import type { Ref } from 'react'
import React, { forwardRef } from 'react'

View File

@@ -15,7 +15,7 @@
width: 150px;
}
:global([data-theme="light"]) {
:global([data-theme='light']) {
.logo {
filter: invert(1);
}

View File

@@ -10,12 +10,12 @@ export const RenderParams: React.FC<{
params?: string[]
}> = ({ className, message, params = ['error', 'message', 'success'] }) => {
const searchParams = useSearchParams()
const paramValues = params.map(param => searchParams.get(param)).filter(Boolean)
const paramValues = params.map((param) => searchParams.get(param)).filter(Boolean)
if (paramValues.length) {
return (
<div className={className}>
{paramValues.map(paramValue => (
{paramValues.map((paramValue) => (
<Message
key={paramValue}
message={(message || 'PARAM')?.replace('PARAM', paramValue || '')}

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -136,7 +136,7 @@ export const AccountForm: React.FC = () => {
register={register}
required
type="password"
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
/>
</Fragment>
)}

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -103,7 +103,7 @@ export const CreateAccountForm: React.FC = () => {
register={register}
required
type="password"
validate={value => value === password.current || 'The passwords do not match'}
validate={(value) => value === password.current || 'The passwords do not match'}
/>
<Button
appearance="primary"

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.createAccount {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
margin-bottom: var(--base);

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.login {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.error {
color: red;
@@ -20,4 +20,3 @@
.message {
margin-bottom: var(--base);
}

View File

@@ -1,4 +1,4 @@
@import "../_css/common";
@import '../_css/common';
.recoverPassword {
margin-bottom: var(--block-padding);

View File

@@ -1,4 +1,4 @@
@import "../../_css/common";
@import '../../_css/common';
.form {
width: 66.66%;

View File

@@ -3,8 +3,8 @@ import type { User } from '../../payload-types'
export const checkRole = (allRoles: User['roles'] = [], user: User = undefined): boolean => {
if (user) {
if (
allRoles.some(role => {
return user?.roles?.some(individualRole => {
allRoles.some((role) => {
return user?.roles?.some((individualRole) => {
return individualRole === role
})
})