Skip to content

fix(noComponentHookFactories): don't report non-function use* bindings - #11346

Merged
ematipico merged 1 commit into
biomejs:mainfrom
Jayllyz:fix/11335-hook-non-function-bindings
Aug 15, 2026
Merged

fix(noComponentHookFactories): don't report non-function use* bindings#11346
ematipico merged 1 commit into
biomejs:mainfrom
Jayllyz:fix/11335-hook-non-function-bindings

Conversation

@Jayllyz

@Jayllyz Jayllyz commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #11335

The hook path detected hooks purely by name, so any use-prefixed binding was reported
regardless of what it held.

A call expression does not qualify, so const useStore = createStore(..) is no longer
reported even though it may evaluate to a function.

Test Plan

Added the reported case and other non-function initializers to valid.jsx. Extended
invalid.jsx with function-expression and parenthesized-arrow hooks.

Docs

N/A


Claude Code with Opus 5 was used with Biome skills, but reviewed and PR written by me.

@changeset-bot

changeset-bot Bot commented Aug 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9b5947b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

✅ Organic activity

No automation signals detected in the analyzed events.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Aug 15, 2026
@Jayllyz
Jayllyz marked this pull request as ready for review August 15, 2026 08:34
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7cf777a4-3033-4dac-a819-ec2cbb4f6afd

📥 Commits

Reviewing files that changed from the base of the PR and between 037f0d8 and 9b5947b.

📒 Files selected for processing (1)
  • crates/biome_js_analyze/src/lint/nursery/no_component_hook_factories.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_js_analyze/src/lint/nursery/no_component_hook_factories.rs

Walkthrough

The noComponentHookFactories rule now reports hook-named bindings only when they are function declarations or directly function-valued initialisers. Non-function bindings and other initialiser forms are excluded. Tests cover function expressions, parenthesised arrows, TypeScript assertions, satisfies, and non-function bindings. A patch changeset documents the behaviour.

Possibly related PRs

Suggested reviewers: dyc3, ematipico

Merge Risk: ⚪ Minimal · up to 9b594

The change narrows hook detection to function-valued bindings and adds focused test coverage; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the rule and the fix for non-function use-prefixed bindings.
Description check ✅ Passed The description accurately explains the bug, the fix, and the added test coverage.
Linked Issues check ✅ Passed The changes satisfy issue #11335 by limiting hook detection to function declarations and function-valued initialisers.
Out of Scope Changes check ✅ Passed The code, tests, and changeset directly support issue #11335 and contain no unrelated changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Aug 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 66 untouched benchmarks
⏩ 233 skipped benchmarks1


Comparing Jayllyz:fix/11335-hook-non-function-bindings (9b5947b) with main (f34e15c)

Open in CodSpeed

Footnotes

  1. 233 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread crates/biome_js_analyze/src/lint/nursery/no_component_hook_factories.rs Outdated
@Jayllyz
Jayllyz force-pushed the fix/11335-hook-non-function-bindings branch from 037f0d8 to 9b5947b Compare August 15, 2026 08:57
@ematipico
ematipico merged commit 674f5f4 into biomejs:main Aug 15, 2026
34 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 15, 2026
@Jayllyz
Jayllyz deleted the fix/11335-hook-non-function-bindings branch August 15, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 noComponentHookFactories: use*-named non-function bindings are flagged as hooks

2 participants