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

Autofix on save leaves empty import #2668

Open
1 of 3 tasks
OliverJAsh opened this issue May 1, 2024 · 1 comment
Open
1 of 3 tasks

Autofix on save leaves empty import #2668

OliverJAsh opened this issue May 1, 2024 · 1 comment

Comments

@OliverJAsh
Copy link

VS Code version

1.88.1

Extension version

2.2.2

Biome version

1.7.2

Operating system

  • Windows
  • macOS
  • Linux

Description

When noUnusedImports is enabled, autofix on save leaves an empty import.

Steps to reproduce

Given:

biome.json:

{
    "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
    "linter": {
      "enabled": true,
      "rules": {
        "correctness": {
          "noUnusedImports": "warn"
        }
      }
    }
  }
  

.vscode/settings.json:

{
    "editor.codeActionsOnSave": {
      "quickfix.biome": "explicit"
    }
  }
  

index.ts:

import { A, B } from 'foo';

// edit this comment and save the file

When I save index.ts and the autofix runs, I end up with an empty import:

import {} from 'foo';

Expected behavior

Import is removed.

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Logs

No response

@nhedger nhedger transferred this issue from biomejs/biome-vscode May 1, 2024
@samhh
Copy link

samhh commented May 8, 2024

If it helps narrow the issue down, I can't repro this with biome lint --apply. The import statement is fully removed. I also can't repro with code actions in my editor (not VS Code), however I'm applying them manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants