react icon indicating copy to clipboard operation
react copied to clipboard

Possible missed rule for eslint-plugin-react-hooks?

Open afzalsayed96 opened this issue 3 years ago • 1 comments

Summary

Recreating #22044

Rebasing my fork triggered GitHub to close the original PR

Summary

It seems that it is possible to use react hooks as callback to functions like map, forEach or even custom hooks without getting a lint error. My hunch is that this could be an oversight as it is not allowed to use hooks inside callbacks.

Usage in the wild: https://twitter.com/erikras/status/1418487174866128897

Test Plan

I've added a failing test-case for the team to look at and decide on the intended behavior.

afzalsayed96 avatar Aug 17 '22 14:08 afzalsayed96

Comparing: f993ffc5141a58e2a53d4b822b15744b0542aa93...8124cfc1c331020af205958f6d8d10dbb296ff37

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.min.js = 131.21 kB 131.21 kB = 41.98 kB 41.98 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 136.47 kB 136.47 kB = 43.57 kB 43.57 kB
facebook-www/ReactDOM-prod.classic.js = 434.63 kB 434.63 kB = 79.87 kB 79.87 kB
facebook-www/ReactDOM-prod.modern.js = 419.63 kB 419.63 kB = 77.50 kB 77.50 kB
facebook-www/ReactDOMForked-prod.classic.js = 434.63 kB 434.63 kB = 79.87 kB 79.87 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +1.74% 25.63 kB 26.07 kB +1.09% 8.78 kB 8.88 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +1.74% 25.63 kB 26.07 kB +1.09% 8.78 kB 8.88 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.production.min.js +1.74% 25.63 kB 26.07 kB +1.09% 8.78 kB 8.88 kB
oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +1.19% 87.43 kB 88.46 kB +0.99% 20.77 kB 20.97 kB
oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +1.19% 87.43 kB 88.46 kB +0.99% 20.77 kB 20.97 kB
oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js +1.19% 87.43 kB 88.46 kB +0.99% 20.77 kB 20.97 kB

Generated by :no_entry_sign: dangerJS against 8124cfc1c331020af205958f6d8d10dbb296ff37

sizebot avatar Aug 17 '22 14:08 sizebot

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

github-actions[bot] avatar Apr 10 '24 02:04 github-actions[bot]

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

github-actions[bot] avatar Apr 17 '24 12:04 github-actions[bot]