Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of unused imports mangles them #1015

Closed
1 task done
roderik opened this issue Dec 2, 2023 · 1 comment · Fixed by #2237
Closed
1 task done

Cleanup of unused imports mangles them #1015

roderik opened this issue Dec 2, 2023 · 1 comment · Fixed by #2237
Labels
A-Linter Area: linter A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@roderik
Copy link

roderik commented Dec 2, 2023

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.

Expected result

Do not break

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-Linter Area: linter A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug labels Dec 2, 2023
@roderik
Copy link
Author

roderik commented Dec 3, 2023

Workaround

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

this makes vscode clean up the imports first it seems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants