biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
13.94k stars 421 forks source link

🐛 False positive of `useExportType` for `export {}` #3535

Closed alex-kinokon closed 1 month ago

alex-kinokon commented 1 month ago

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:           "v22.5.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.8.2"

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

Workspace:
  Open Documents:               0

What happened?

https://biomejs.dev/playground/?code=ZQB4AHAAbwByAHQAIAB7AH0A

Expected result

No lint error.

Code of Conduct

yossydev commented 1 month ago

This was not mentioned in the documentation, but looking at the tests, this feels like a specification.

https://github.com/biomejs/biome/blob/9aea758a0173c4115b2e4415d77705ba383cf8ab/crates/biome_js_analyze/tests/specs/style/useExportType/invalid.ts#L31

alex-kinokon commented 1 month ago

I read the original PR and the one in rome/tools. Neither of it mentions this case in the description so I’m assuming this is not something intentional.

Conaclos commented 1 month ago

Is there an issue of turning export into export type? The intended behavior of turning a file into a module is still preserved?

alex-kinokon commented 1 month ago

The intention of exportKind: "type" is to ask the bundler to drop an export, and in this case there’s nothing to drop so the fix serves no purpose except leaving the reader wondering if this has some deliberate semantic difference.

alex-kinokon commented 1 month ago

Thanks!