Skip to content

Conversation

Ayc0
Copy link
Contributor

@Ayc0 Ayc0 commented Aug 1, 2025

Summary

This is a fix for #34074

How did you test this change?

I added tests in the eslint package, and ran yarn jest. After adding the new tests, I have this:

On main On this branch
image image

Changes

  • Add link: to the eslint-plugin-react-hooks pointing to babel-plugin-react-compiler otherwise it wouldn't run locally
  • Add tests to check that we are checking both CallExpression (useEffect(), and MemberExpression (React.useEffect(). To do that, I copied the getNodeWithoutReactNamespace( fn from ExhaustiveDeps.ts to RulesOfHooks.ts

@meta-cla meta-cla bot added the CLA Signed label Aug 1, 2025
return false;
}

function getNodeWithoutReactNamespace(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from ExhaustiveDeps.ts

return node;
}

function isUseEffectIdentifier(node: Node): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have kept the code inlined, but it makes it a bit more readable

@Ayc0 Ayc0 requested a review from jackpope August 13, 2025 08:59
Copy link
Contributor

@jbrown215 jbrown215 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing @jackpope's feedback. This looks great, thanks for taking this on.

@react-sizebot
Copy link

Comparing: c260b38...5526704

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.04 kB 530.04 kB = 93.63 kB 93.63 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 654.48 kB 654.48 kB = 115.34 kB 115.34 kB
facebook-www/ReactDOM-prod.classic.js = 674.42 kB 674.42 kB = 118.68 kB 118.68 kB
facebook-www/ReactDOM-prod.modern.js = 664.84 kB 664.84 kB = 117.02 kB 117.03 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 5526704

@jackpope jackpope merged commit 87a45ae into facebook:main Aug 18, 2025
241 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 18, 2025
…ddition to useEffect (#34076)

## Summary

This is a fix for #34074

## How did you test this change?

I added tests in the eslint package, and ran `yarn jest`. After adding
the new tests, I have this:

On main | On this branch
-|-
<img width="356" height="88" alt="image"
src="https://github.com/user-attachments/assets/4ae099a1-0156-4032-b2ca-635ebadcaa3f"
/> | <img width="435" height="120" alt="image"
src="https://github.com/user-attachments/assets/b06c04b8-6cec-43de-befa-a8b4dd20500e"
/>

## Changes

- Add tests to check that we are checking both `CallExpression`
(`useEffect(`), and `MemberExpression` (`React.useEffect(`). To do that,
I copied the `getNodeWithoutReactNamespace(` fn from `ExhaustiveDeps.ts`
to `RulesOfHooks.ts`

DiffTrain build for [87a45ae](87a45ae)
github-actions bot pushed a commit that referenced this pull request Aug 18, 2025
…ddition to useEffect (#34076)

## Summary

This is a fix for #34074

## How did you test this change?

I added tests in the eslint package, and ran `yarn jest`. After adding
the new tests, I have this:

On main | On this branch
-|-
<img width="356" height="88" alt="image"
src="https://github.com/user-attachments/assets/4ae099a1-0156-4032-b2ca-635ebadcaa3f"
/> | <img width="435" height="120" alt="image"
src="https://github.com/user-attachments/assets/b06c04b8-6cec-43de-befa-a8b4dd20500e"
/>

## Changes

- Add tests to check that we are checking both `CallExpression`
(`useEffect(`), and `MemberExpression` (`React.useEffect(`). To do that,
I copied the `getNodeWithoutReactNamespace(` fn from `ExhaustiveDeps.ts`
to `RulesOfHooks.ts`

DiffTrain build for [87a45ae](87a45ae)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants