Skip to content

Commit 75f33f0

Browse files
authored
Include eslint-plugin-react-hooks in React sync (vercel#82294)
`eslint-plugin-react-hooks` is also published in React's nightly release cycle. I want to start dog fooding it in Next.js so that we can spot issues as early as possible. It also includes some new heuristics that are important to flag React Compiler incompatibilities. Compat with the React Compiler of the Next.js codebase is especially relevant for Next DevTools which uses the React Compiler. I'll follow-up on these violations. Each need different treatment.
1 parent c86a07d commit 75f33f0

File tree

13 files changed

+27
-17
lines changed

13 files changed

+27
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"eslint-plugin-jsdoc": "48.0.4",
174174
"eslint-plugin-mdx": "3.1.5",
175175
"eslint-plugin-react": "7.35.0",
176-
"eslint-plugin-react-hooks": "6.0.0-rc.1",
176+
"eslint-plugin-react-hooks": "0.0.0-experimental-c260b38d-20250731",
177177
"eslint-v8": "npm:eslint@^8.57.0",
178178
"event-stream": "4.0.1",
179179
"execa": "2.0.3",

packages/next/src/next-devtools/dev-overlay/components/devtools-indicator/hooks/use-minimum-loading-time-multiple.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function useMinimumLoadingTimeMultiple(
3131
if (loadStartTimeRef.current === null) {
3232
loadStartTimeRef.current = Date.now()
3333
}
34+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
3435
setIsLoading(true)
3536
} else {
3637
// If we're exiting the "loading" state:

packages/next/src/next-devtools/dev-overlay/components/devtools-indicator/hooks/use-update-animation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function useUpdateAnimation(
1919
return
2020
}
2121

22+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
2223
setAnimate(true)
2324
// It is important to use a CSS transitioned state, not a CSS keyframed animation
2425
// because if the issue count increases faster than the animation duration, it

packages/next/src/next-devtools/dev-overlay/components/devtools-indicator/next-logo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function NextLogo({
4444
const width = measuredWidth === 0 ? 'auto' : measuredWidth
4545

4646
useEffect(() => {
47+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
4748
setIsErrorExpanded(hasError)
4849
}, [hasError])
4950

packages/next/src/next-devtools/dev-overlay/components/devtools-panel/resize/resize-handle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const ResizeHandle = ({
7676
const borderBottom = parseFloat(computedStyle.borderBottomWidth) || 0
7777
const borderLeft = parseFloat(computedStyle.borderLeftWidth) || 0
7878

79+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
7980
setBorderWidths({
8081
top: borderTop,
8182
right: borderRight,

packages/next/src/next-devtools/dev-overlay/components/dialog/dialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const Dialog: React.FC<DialogProps> = function Dialog({
3636
)
3737

3838
useOnClickOutside(
39+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
3940
dialogRef.current,
4041
CSS_SELECTORS_TO_EXCLUDE_ON_CLICK_OUTSIDE,
4142
(e) => {

packages/next/src/next-devtools/dev-overlay/components/errors/dev-tools-indicator/dev-tools-info/shortcut-recorder.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ function MetaKey() {
316316
useEffect(() => {
317317
// Meta is Command on Apple devices, otherwise Control
318318
if (apple === true) {
319+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
319320
setLabel('⌘')
320321
}
321322

packages/next/src/next-devtools/dev-overlay/components/errors/dev-tools-indicator/drag-context.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function DragProvider({
3636
}, [])
3737

3838
const value = useMemo<DragContextValue>(
39+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
3940
() => ({ register, unregister, handles: handlesRef.current, disabled }),
4041
[register, unregister, disabled]
4142
)

packages/next/src/next-devtools/dev-overlay/components/errors/error-message/error-message.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function ErrorMessage({ errorMessage }: ErrorMessageProps) {
1313

1414
useLayoutEffect(() => {
1515
if (messageRef.current) {
16+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
1617
setShouldTruncate(messageRef.current.scrollHeight > 200)
1718
}
1819
}, [errorMessage])

packages/next/src/next-devtools/dev-overlay/components/overview/segment-boundary-trigger.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function SegmentBoundaryTrigger({
4848
() => {
4949
setIsOpen(false)
5050
},
51+
// eslint-disable-next-line react-hooks/react-compiler -- TODO
5152
triggerRef.current?.ownerDocument
5253
)
5354

0 commit comments

Comments
 (0)