Skip to content

🐛 useHookAtTopLevel doesn't report hooks used outside of non-hook functions #1984

@itsMapleLeaf

Description

@itsMapleLeaf

Environment information

CLI:
  Version:                      1.5.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v21.6.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.15.1"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           true
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

In this code:

function notAhook() {
	useSomeHook()
}

useHookAtTopLevel does not show an error for useSomeHook not being used inside a component-named or hook-named function.

Playground link

Expected result

useHookAtTopLevel should show an error for useSomeHook not being used inside a component-named or hook-named function.

References:

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterS-Bug-confirmedStatus: report has been confirmed as a valid bugS-Good first issueStatus: Good for newcomersS-Help-wantedStatus: you're familiar with the code base and want to help the project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions