biome icon indicating copy to clipboard operation
biome copied to clipboard

Cleanup of unused imports mangles them

Open roderik opened this issue 8 months ago • 1 comments

Environment information

CLI:
  Version:                      1.4.1
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

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

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 file has a bunch of unused imports: https://share.cleanshot.com/BGMXFDqb Saving it ends up like this: https://share.cleanshot.com/KM1tSmWZ

But it does work for just one like this https://share.cleanshot.com/WcB9RLBR Or like this: https://share.cleanshot.com/KTx3wrC3

And it fails for the combination of the two working ones above https://share.cleanshot.com/wLZry1GL

In the CBS template, using the commandline, it does not break In my own project using the commandline it also works

With the vscode extension, it breaks.

  • vscode config https://gist.github.com/roderik/6154f22a0f75bae75176a3472118fe3f
  • Biome extension v2.0.0
  • biome 1.4.1 listed at the right bottom of the screen

Expected result

Do not break

Code of Conduct

  • [X] I agree to follow Biome's Code of Conduct

roderik avatar Dec 02 '23 12:12 roderik

Workaround

  "editor.codeActionsOnSave": {
    "source.fixAll": "explicit",
    "quickfix.biome": true,
    "source.organizeImports.biome": true
  },

this makes vscode clean up the imports first it seems

roderik avatar Dec 03 '23 07:12 roderik