react icon indicating copy to clipboard operation
react copied to clipboard

Bug: eslint-plugin-react-hooks documentation might be misleading

Open StyleShit opened this issue 9 months ago • 2 comments

Splits from https://github.com/WordPress/gutenberg/issues/61598 & https://github.com/WordPress/gutenberg/pull/61599

The current explanation about "additionalHooks" under react-hooks/exhaustive-deps might be misleading. The regex in the example catches more than needed.

This:

"additionalHooks": "(useMyCustomHook|useMyOtherCustomHook)"

Will catch also things like this:

function App() {
	const data1 = useMyCustomHook2();
	const data2 = useMyOtherCustomHookTest();

	// ...
}

This might be the reason why Gutenberg used the same approach (which caused the bug mentioned above): https://github.com/WordPress/gutenberg/blob/2df566c771dba22eec2841081a00963a2e56658c/packages/eslint-plugin/configs/react.js#L37-L42

StyleShit avatar May 12 '24 19:05 StyleShit

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] avatar Aug 10 '24 20:08 github-actions[bot]

Bump

StyleShit avatar Aug 10 '24 20:08 StyleShit