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

💅 Only removing unused imports is not working properly #3738

Closed
1 task done
redsuperbat opened this issue Aug 28, 2024 · 1 comment
Closed
1 task done

💅 Only removing unused imports is not working properly #3738

redsuperbat opened this issue Aug 28, 2024 · 1 comment

Comments

@redsuperbat
Copy link

redsuperbat commented Aug 28, 2024

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:                         "screen-256color"
  JS_RUNTIME_VERSION:           "v20.11.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.2.4"

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0

Rule name

lint/correctness/noUnusedImports

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAdABlAHMAdAAgAH0AIABmAHIAbwBtACAAJwB0AGUAcwB0ACcAOwA%3D

Expected result

Biome finds the error and with the --error-on-warnings flag it should properly fix the file. It does not fix the file.

As you can see from the command:

> npx @biomejs/biome lint --write --error-on-warnings --only=correctness/noUnusedImports ./services/CustomersService.ts

And the output:

./services/CustomersService.ts:2:21 lint/correctness/noUnusedImports  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━

  ⚠ This import is unused.

    1 │ import { type HttpClient, HttpError } from "./HttpClient";
  > 2 │ import type { Cart, CartItem } from "./models/Cart";
      │                     ^^^^^^^^
    3 │ import type { Customer } from "./models/Customer";
    4 │

  ℹ Unused imports might be the result of an incomplete refactoring.

  ℹ Safe fix: Remove the unused import.

    2 │ import·type·{·Cart,·CartItem·}·from·"./models/Cart";
      │                     ---------

Checked 1 file in 2ms. No fixes applied.
Found 1 warning.
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ Some warnings were emitted while running checks.

Biome did not write the fix even though it found an error.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico
Copy link
Member

Duplicate of #3470

@ematipico ematipico marked this as a duplicate of #3470 Aug 29, 2024
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