biome: `useHookAtTopLevel` reports errors on code that is not React

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.10.2"

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

Workspace:
  Open Documents:               0

What happened?

The following sample NestJS snippet triggers the useHookAtTopLevel thinking useGlobalInterceptors is a React hook.

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  app.useGlobalInterceptors(new RandomInterceptor());
}

bootstrap();

Expected result

It should not raise any warning/error

Code of Conduct

  • I agree to follow Biome’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 17 (13 by maintainers)

Most upvoted comments

Would it make sense to have more collections of rules similar to how we currently have recommended rules?

There’s an RFC for that, you can find it from the pinned umbrella issue “Biome developments”