Skip to content

v3.9.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 21:34
· 39 commits to main since this release
v3.9.0
c288fab

v3.9.0: New no-nested-hook-calls rule for React hook calls

This release adds the no-nested-hook-calls React rule, which reports a hook call placed inside the arguments or callee of another hook call. Existing rules are unchanged.

🚀 Added

  • no-nested-hook-calls: The rule reports a hook call nested inside another hook call's arguments, callee, or member chain. For example, useAttribute(useCharacter(), "Health") reports, and the fix is to assign the inner result to a const first. A hook is a function named use followed by a capital letter or digit, and calls inside a function passed to another hook are not checked. - by @howmanysmall in #105
const character = useCharacter();
const health = useAttribute(character, "Health");

The rule is marked recommended in its metadata, so configs that pull in recommended React rules may start reporting existing nested hook calls after upgrading. Hoist each nested call into a const to clear them, or disable the rule.

Full Changelog: v3.8.0...v3.9.0