⬆️(frontend) upgrade eslint-plugin-react-hooks by two major versions

The upgrade introduced around 50 new linting errors. Fix the
low-hanging fruit and address straightforward violations.

Several of the new rules appear to target patterns intended for newer
React compiler capabilities. Since the project currently runs on
React 18 rather than React 19, disable these rules for now instead of
applying potentially inappropriate changes.

Follow-up work can address the new rules in a dedicated PR, potentially
alongside a future React version upgrade.
This commit is contained in:
lebaudantoine
2026-06-04 12:54:43 +02:00
committed by aleb_the_flash
parent 27ebc2f2e3
commit a01f0256a1
28 changed files with 158 additions and 100 deletions
+7
View File
@@ -54,6 +54,13 @@ export default tseslint.config(
{ allowConstantExport: true },
],
// React Compiler rules (v7+) — disable until migrated to React 19
'react-hooks/react-compiler': 'off',
'react-hooks/set-state-in-effect': 'off',
'react-hooks/preserve-manual-memoization': 'off',
'react-hooks/immutability': 'off',
'react-hooks/refs': 'off',
// jsx-a11y recommended rules
...jsxA11y.configs.recommended.rules,
+52 -15
View File
@@ -48,11 +48,11 @@
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "6.0.2",
"eslint": "9.39.4",
"eslint-config-prettier": "10.1.5",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "0.4.20",
"eslint-plugin-react-hooks": "7.1.1",
"eslint-plugin-react-refresh": "0.5.2",
"globals": "17.6.0",
"postcss": "8.5.15",
"prettier": "3.8.3",
@@ -6932,9 +6932,9 @@
}
},
"node_modules/eslint-config-prettier": {
"version": "10.1.5",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz",
"integrity": "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw==",
"version": "10.1.8",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
"integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
"dev": true,
"license": "MIT",
"bin": {
@@ -7035,26 +7035,33 @@
}
},
"node_modules/eslint-plugin-react-hooks": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz",
"integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz",
"integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/core": "^7.24.4",
"@babel/parser": "^7.24.4",
"hermes-parser": "^0.25.1",
"zod": "^3.25.0 || ^4.0.0",
"zod-validation-error": "^3.5.0 || ^4.0.0"
},
"engines": {
"node": ">=10"
"node": ">=18"
},
"peerDependencies": {
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0"
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0"
}
},
"node_modules/eslint-plugin-react-refresh": {
"version": "0.4.20",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.20.tgz",
"integrity": "sha512-XpbHQ2q5gUF8BGOX4dHe+71qoirYMhApEPZ7sfhF/dNnOF1UXnCMGZf79SFTBO7Bz5YEIT4TMieSlJBWhP9WBA==",
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.5.2.tgz",
"integrity": "sha512-hmgTH57GfzoTFjVN0yBwTggnsVUF2tcqi7RJZHqi9lIezSs4eFyAMktA68YD4r5kNw1mxyY4dmkyoFDb3FIqrA==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"eslint": ">=8.40"
"eslint": "^9 || ^10"
}
},
"node_modules/eslint-plugin-react/node_modules/brace-expansion": {
@@ -8079,6 +8086,23 @@
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.2.1.tgz",
"integrity": "sha512-Rf4YVNYpKjZ6ASAmibcwTNciQ5Co5Ztq6iZPEykHpkoflnD/K5ryE/rHehFsTm4NJj8nKDhbi3eKBWGogmNnkg=="
},
"node_modules/hermes-estree": {
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz",
"integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==",
"dev": true,
"license": "MIT"
},
"node_modules/hermes-parser": {
"version": "0.25.1",
"resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz",
"integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"hermes-estree": "0.25.1"
}
},
"node_modules/hono": {
"version": "4.12.18",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.18.tgz",
@@ -13873,6 +13897,19 @@
"peerDependencies": {
"zod": "^3.25.28 || ^4"
}
},
"node_modules/zod-validation-error": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz",
"integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"peerDependencies": {
"zod": "^3.25.0 || ^4.0.0"
}
}
}
}
+3 -3
View File
@@ -55,11 +55,11 @@
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "6.0.2",
"eslint": "9.39.4",
"eslint-config-prettier": "10.1.5",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "5.2.0",
"eslint-plugin-react-refresh": "0.4.20",
"eslint-plugin-react-hooks": "7.1.1",
"eslint-plugin-react-refresh": "0.5.2",
"globals": "17.6.0",
"postcss": "8.5.15",
"prettier": "3.8.3",
@@ -0,0 +1,11 @@
import { styled } from '@/styled-system/jsx'
export const StyledToast = styled('div', {
base: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
gap: '1rem',
padding: '10px',
},
})
@@ -0,0 +1,16 @@
import { styled } from '@/styled-system/jsx'
export const StyledToastContainer = styled('div', {
base: {
margin: 0.5,
boxShadow:
'rgba(0, 0, 0, 0.5) 0px 4px 8px 0px, rgba(0, 0, 0, 0.3) 0px 6px 20px 4px',
backgroundColor: 'greyscale.700',
color: 'white',
borderRadius: '8px',
'&[data-entering]': { animation: 'fade 200ms' },
'&[data-exiting]': { animation: 'fade 150ms reverse ease-in' },
width: 'fit-content',
marginLeft: 'auto',
},
})
@@ -1,36 +1,12 @@
import { useToast } from '@react-aria/toast'
import { Button } from '@/primitives'
import { RiCloseLine } from '@remixicon/react'
import { styled } from '@/styled-system/jsx'
import { useRef } from 'react'
import type { ToastState } from '@react-stately/toast'
import type { ToastData } from './ToastProvider'
import type { QueuedToast } from '@react-stately/toast'
export const StyledToastContainer = styled('div', {
base: {
margin: 0.5,
boxShadow:
'rgba(0, 0, 0, 0.5) 0px 4px 8px 0px, rgba(0, 0, 0, 0.3) 0px 6px 20px 4px',
backgroundColor: 'greyscale.700',
color: 'white',
borderRadius: '8px',
'&[data-entering]': { animation: 'fade 200ms' },
'&[data-exiting]': { animation: 'fade 150ms reverse ease-in' },
width: 'fit-content',
marginLeft: 'auto',
},
})
export const StyledToast = styled('div', {
base: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
gap: '1rem',
padding: '10px',
},
})
import { StyledToastContainer } from './StyledToastContainer'
import { StyledToast } from './StyledToast'
export interface ToastProps {
key: string
@@ -1,7 +1,8 @@
import { useToast } from '@react-aria/toast'
import { useMemo, useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import type { ToastProps } from './Toast'
import { StyledToastContainer } from './StyledToastContainer'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { NotificationType } from '../NotificationType'
@@ -6,10 +6,11 @@ import Source = Track.Source
import { useMaybeLayoutContext } from '@livekit/components-react'
import { ParticipantTile } from '@/features/rooms/livekit/components/ParticipantTile'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack, styled } from '@/styled-system/jsx'
import { Div } from '@/primitives'
import { useTranslation } from 'react-i18next'
import { StyledToastContainer } from './StyledToastContainer'
const ClickableToast = styled(RACButton, {
base: {
@@ -1,11 +1,12 @@
import { useToast } from '@react-aria/toast'
import { useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { Button } from '@/primitives'
import { css } from '@/styled-system/css'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastLowerHand({ state, ...props }: Readonly<ToastProps>) {
const { t } = useTranslation('notifications', { keyPrefix: 'lowerHand' })
@@ -1,13 +1,14 @@
import { useToast } from '@react-aria/toast'
import { useEffect, useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { Text } from '@/primitives'
import { RiMessage2Line } from '@remixicon/react'
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
import { Button as RACButton } from 'react-aria-components'
import { css } from '@/styled-system/css'
import { useTranslation } from 'react-i18next'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastMessageReceived({
state,
@@ -1,9 +1,10 @@
import { useToast } from '@react-aria/toast'
import { useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastMuted({ state, ...props }: Readonly<ToastProps>) {
const { t } = useTranslation('notifications')
@@ -1,9 +1,10 @@
import { useToast } from '@react-aria/toast'
import { useMemo, useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastPermissionsRemoved({
state,
@@ -1,13 +1,14 @@
import { useToast } from '@react-aria/toast'
import { useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { Button, Div } from '@/primitives'
import { useTranslation } from 'react-i18next'
import { RiCloseLine, RiHand } from '@remixicon/react'
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
import { css } from '@/styled-system/css'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastRaised({ state, ...props }: Readonly<ToastProps>) {
const { t } = useTranslation('notifications')
@@ -1,13 +1,14 @@
import { useToast } from '@react-aria/toast'
import { useMemo, useRef } from 'react'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { NotificationType } from '../NotificationType'
import { Button } from '@/primitives'
import { css } from '@/styled-system/css'
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastRecordingRequest({
state,
@@ -2,12 +2,13 @@ import { useToast } from '@react-aria/toast'
import { useMemo, useRef } from 'react'
import { Text } from '@/primitives'
import { StyledToastContainer, type ToastProps } from './Toast'
import { type ToastProps } from './Toast'
import { HStack } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { useUser } from '@/features/auth/api/useUser'
import { css } from '@/styled-system/css'
import { RecordingMode } from '@/features/recording'
import { StyledToastContainer } from './StyledToastContainer'
export function ToastRecordingSaving({
state,
@@ -1,4 +1,4 @@
import { StyledToastContainer } from './Toast'
import { StyledToastContainer } from './StyledToastContainer'
import { HStack, VStack } from '@/styled-system/jsx'
import { Avatar } from '@/components/Avatar'
import { Button, Text } from '@/primitives'
@@ -1,3 +1,4 @@
/* eslint-disable react-refresh/only-export-components */
import { styled } from '@/styled-system/jsx'
import { useTranslation } from 'react-i18next'
import { AudioDevicesControl } from '@/features/rooms/livekit/components/controls/Device/AudioDevicesControl'
@@ -1,6 +1,6 @@
import { useSnapshot } from 'valtio'
import { reactionsStore } from '@/stores/reactions'
import { useMemo, useRef } from 'react'
import { useRef, useState } from 'react'
import { FloatingReaction } from '@/features/reactions/components/ReactionPortals'
import { Reaction } from '@/features/reactions/types'
import { css } from '@/styled-system/css'
@@ -19,8 +19,8 @@ export const PipFloatingReactions = () => {
const PipFloatingReaction = ({ reaction }: { reaction: Reaction }) => {
const containerRef = useRef<HTMLDivElement>(null)
const speed = useMemo(() => Math.random() * 1.5 + 0.5, [])
const scale = useMemo(() => Math.max(Math.random() + 0.5, 1), [])
const [speed] = useState(() => Math.random() * 1.5 + 0.5)
const [scale] = useState(() => Math.max(Math.random() + 0.5, 1))
return (
<div
ref={containerRef}
@@ -1,5 +1,5 @@
import { createPortal } from 'react-dom'
import { useState, useEffect, useMemo } from 'react'
import { useState, useEffect } from 'react'
import { Text } from '@/primitives'
import { css } from '@/styled-system/css'
import { useSnapshot } from 'valtio'
@@ -32,9 +32,8 @@ export function FloatingReaction({
const [deltaY, setDeltaY] = useState(0)
const [opacity, setOpacity] = useState(1)
const left = useMemo(
() => Math.random() * window.innerWidth * REACTION_SPAWN_WIDTH_RATIO,
[]
const [left] = useState(
() => Math.random() * window.innerWidth * REACTION_SPAWN_WIDTH_RATIO
)
useEffect(() => {
@@ -115,8 +114,8 @@ export function FloatingReaction({
}
const ReactionPortal = ({ reaction }: { reaction: Reaction }) => {
const speed = useMemo(() => Math.random() * 1.5 + 0.5, [])
const scale = useMemo(() => Math.max(Math.random() + 0.5, 1), [])
const [speed] = useState(() => Math.random() * 1.5 + 0.5)
const [scale] = useState(() => Math.max(Math.random() + 0.5, 1))
return createPortal(
<div
className={css({
@@ -50,7 +50,6 @@ const VisualCountDown = () => {
useSrCountdownAnnouncement(remainingSeconds)
useEffect(() => {
setTimeRemaining(IDLE_DISCONNECT_TIMEOUT_MS)
const interval = setInterval(() => {
setTimeRemaining((prev) => {
if (prev <= 1000) {
@@ -31,13 +31,14 @@ export const useCopyRoomToClipboard = (room: ApiRoom | undefined) => {
}
}, [isRoomUrlCopied])
const roomSlug = room?.slug
const roomUrl = useMemo(() => {
return room?.slug ? getRouteUrl('room', room.slug) : ''
}, [room?.slug])
return roomSlug ? getRouteUrl('room', roomSlug) : ''
}, [roomSlug])
const hasTelephonyInfo = useMemo(() => {
return telephony.enabled && room?.pin_code
}, [telephony.enabled, room?.pin_code])
}, [telephony.enabled, room])
const content = useMemo(() => {
if (!roomUrl || !room) return ''
+1 -1
View File
@@ -10,7 +10,7 @@ import { FieldErrors } from './FieldErrors'
import { FieldDescription } from './FieldDescription'
// styled taken from example at https://react-spectrum.adobe.com/react-aria/Checkbox.html
export const StyledCheckbox = styled(RACCheckbox, {
const StyledCheckbox = styled(RACCheckbox, {
base: {
display: 'flex',
alignItems: 'center',
+1 -1
View File
@@ -1,6 +1,6 @@
import { ReactNode } from 'react'
import { MenuTrigger } from 'react-aria-components'
import { StyledPopover } from './Popover'
import { StyledPopover } from './StyledPopover'
import { Box } from './Box'
/**
+1 -28
View File
@@ -2,39 +2,12 @@ import { ReactNode } from 'react'
import {
DialogProps,
DialogTrigger,
Popover as RACPopover,
Dialog,
OverlayArrow,
} from 'react-aria-components'
import { styled } from '@/styled-system/jsx'
import { Box } from './Box'
export const StyledPopover = styled(RACPopover, {
base: {
minWidth: 'var(--trigger-width)',
'&[data-entering]': {
animation: 'slide 200ms',
},
'&[data-exiting]': {
animation: 'slide 200ms reverse ease-in',
},
'&[data-placement="bottom"]': {
marginTop: 0.25,
},
'&[data-placement=top]': {
'--origin': 'translateY(8px)',
},
'&[data-placement=bottom]': {
'--origin': 'translateY(-8px)',
},
'&[data-placement=right]': {
'--origin': 'translateX(-8px)',
},
'&[data-placement=left]': {
'--origin': 'translateX(8px)',
},
},
})
import { StyledPopover } from './StyledPopover'
const StyledOverlayArrow = styled(OverlayArrow, {
base: {
+1 -1
View File
@@ -6,7 +6,7 @@ import { styled } from '@/styled-system/jsx'
import { type StyledVariantProps } from '@/styled-system/types'
// styled taken from example at https://react-spectrum.adobe.com/react-aria/Checkbox.html and changed for round radios
export const StyledRadio = styled(RACRadio, {
const StyledRadio = styled(RACRadio, {
base: {
display: 'flex',
alignItems: 'center',
+1 -1
View File
@@ -11,7 +11,7 @@ import {
} from 'react-aria-components'
import { useTranslation } from 'react-i18next'
import { Box } from './Box'
import { StyledPopover } from './Popover'
import { StyledPopover } from './StyledPopover'
import { menuRecipe } from '@/primitives/menuRecipe.ts'
import { css } from '@/styled-system/css'
import type { Placement } from '@react-types/overlays'
@@ -0,0 +1,29 @@
import { Popover as RACPopover } from 'react-aria-components'
import { styled } from '@/styled-system/jsx'
export const StyledPopover = styled(RACPopover, {
base: {
minWidth: 'var(--trigger-width)',
'&[data-entering]': {
animation: 'slide 200ms',
},
'&[data-exiting]': {
animation: 'slide 200ms reverse ease-in',
},
'&[data-placement="bottom"]': {
marginTop: 0.25,
},
'&[data-placement=top]': {
'--origin': 'translateY(8px)',
},
'&[data-placement=bottom]': {
'--origin': 'translateY(-8px)',
},
'&[data-placement=right]': {
'--origin': 'translateX(-8px)',
},
'&[data-placement=left]': {
'--origin': 'translateX(8px)',
},
},
})
+1 -1
View File
@@ -6,7 +6,7 @@ import { styled } from '@/styled-system/jsx'
import { type StyledVariantProps } from '@/styled-system/types'
import { RiCheckLine, RiCloseFill } from '@remixicon/react'
export const StyledSwitch = styled(RACSwitch, {
const StyledSwitch = styled(RACSwitch, {
base: {
display: 'flex',
alignItems: 'center',