Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
StyleShit opened this issue May 12, 2024 · 0 comments · May be fixed by #29046
Open

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

StyleShit opened this issue May 12, 2024 · 0 comments · May be fixed by #29046
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@StyleShit
Copy link
Contributor

Splits from WordPress/gutenberg#61598 & WordPress/gutenberg#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 StyleShit added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant