fix eslint non-autofixable errors (most of them react compiler lint errors)

This commit is contained in:
Germán Jabloñski
2025-05-09 15:14:19 -03:00
parent 7818cb655c
commit 5a0d3d2077
17 changed files with 24 additions and 4 deletions

View File

@@ -16,7 +16,9 @@ export const DeviceContainer: React.FC<{
// Keep an accurate measurement of the actual device size as it is truly rendered
// This is helpful when `sizes` are non-number units like percentages, etc.
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
const { size: measuredDeviceSize } = useResize(deviceFrameRef.current)
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
const { size: outerFrameSize } = useResize(outerFrameRef.current)
let deviceIsLargerThanFrame: boolean = false

View File

@@ -1,4 +1,5 @@
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-require-imports
import React = require('react')
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>

View File

@@ -19,13 +19,13 @@ export const authenticateLocalStrategy = async ({ doc, password }: Args): Promis
const res = await new Promise<Doc | null>((resolve, reject) => {
crypto.pbkdf2(password, salt, 25000, 512, 'sha256', (e, hashBuffer) => {
if (e) {
reject(null)
reject(e)
}
if (scmp(hashBuffer, Buffer.from(hash, 'hex'))) {
resolve(doc)
} else {
reject(null)
reject(new Error('Invalid password'))
}
})
})

View File

@@ -67,6 +67,7 @@ export const TenantSelectionProviderClient = ({
}, [])
const deleteCookie = React.useCallback(() => {
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
document.cookie = 'payload-tenant=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'
}, [])

View File

@@ -1,4 +1,5 @@
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-require-imports
import React = require('react')
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>

View File

@@ -91,15 +91,18 @@ export const Autosave: React.FC<Props> = ({ id, collection, global: globalDoc })
// Store fields in ref so the autosave func
// can always retrieve the most to date copies
// after the timeout has executed
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
fieldRef.current = fields
// Store modified in ref so the autosave func
// can bail out if modified becomes false while
// timing out during autosave
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
modifiedRef.current = modified
// Store locale in ref so the autosave func
// can always retrieve the most to date locale
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
localeRef.current = locale
const { queueTask } = useQueues()

View File

@@ -192,6 +192,7 @@ function GetFieldProxy() {
const { getFormDataRef } = useFormsManager()
useEffect(() => {
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
getFormDataRef.current = getFields
}, [getFields, getFormDataRef])

View File

@@ -163,6 +163,7 @@ export const ListControls: React.FC<ListControlsProps> = (props) => {
// @ts-expect-error @todo: fix types
initialParams={query}
key={collectionSlug}
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
label={searchLabelTranslated.current}
/>
{activePreset && hasModifiedPreset ? (

View File

@@ -235,6 +235,7 @@ export const RelationshipTable: React.FC<RelationshipTableComponentProps> = (pro
if (Array.isArray(relationTo) && !isDrawerOpen && selectedCollection) {
setSelectedCollection(undefined)
}
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isDrawerOpen])

View File

@@ -125,6 +125,7 @@ const RelationshipFieldComponent: RelationshipFieldClientComponent = (props) =>
const [options, dispatchOptions] = useReducer(optionsReducer, [])
const valueRef = useRef(value)
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
valueRef.current = value
const [DocumentDrawer, , { isDrawerOpen, openDrawer }] = useDocumentDrawer({

View File

@@ -1,3 +1,4 @@
/* eslint-disable react-compiler/react-compiler -- TODO: fix */
'use client'
import { dequal } from 'dequal/lite' // lite: no need for Map and Set support
import { useRouter } from 'next/navigation.js'

View File

@@ -21,7 +21,6 @@ type Props<T> = {
} & Omit<RowLabelType<T>, 'data'>
export const RowLabelProvider: React.FC<Props<unknown>> = ({ children, path, rowNumber }) => {
'use no memo'
const { getDataByPath, getSiblingData } = useWatchForm()
const collapsibleData = getSiblingData(path)
const arrayData = getDataByPath(path)

View File

@@ -40,6 +40,7 @@ export const ListQueryProvider: React.FC<ListQueryProps> = ({
const contextRef = useRef({} as IListQueryContext)
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
contextRef.current.modified = modified
const { onQueryChange } = useListDrawerContext()
@@ -215,6 +216,7 @@ export const ListQueryProvider: React.FC<ListQueryProps> = ({
query: currentQuery,
refineListData,
setModified,
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
...contextRef.current,
}}
>

View File

@@ -154,9 +154,11 @@ export const PreferencesProvider: React.FC<{ children?: React.ReactNode }> = ({
[api, getPreference, i18n.language, pendingUpdate, serverURL],
)
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
contextRef.current.getPreference = getPreference
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
contextRef.current.setPreference = setPreference
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
return <Context value={contextRef.current}>{children}</Context>
}

View File

@@ -190,6 +190,7 @@ export const SelectionProvider: React.FC<Props> = ({ children, docs = [], totalD
setCount(newCount)
}, [selectAll, selected, totalDocs])
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
contextRef.current = {
count,
getQueryParams,
@@ -200,6 +201,7 @@ export const SelectionProvider: React.FC<Props> = ({ children, docs = [], totalD
totalDocs,
}
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
return <Context value={contextRef.current}>{children}</Context>
}

View File

@@ -100,6 +100,7 @@ export const TableColumnsProvider: React.FC<TableColumnsProviderProps> = ({
resetColumnsState,
setActiveColumns,
toggleColumn,
// eslint-disable-next-line react-compiler/react-compiler -- TODO: fix
...contextRef.current,
}}
>

View File

@@ -1,3 +1,4 @@
/* eslint-disable react-compiler/react-compiler -- TODO: fix */
'use client'
import type { ClientUser, DocumentViewClientProps, FormState } from 'payload'