Skip to content

linter: unused imports are not removed when using no-unused-vars.fix.imports and fixKind=dangerous-fix #20523

@antoine-cottineau

Description

@antoine-cottineau

What version of Oxlint are you using?

1.56.0

What command did you run?

Ran "Oxc: Fix all auto-fixable problems (file)" in VSCode with "oxc.fixKind": "dangerous_fix"

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "rules": {
    "no-unused-vars": [
      "error",
      { "fix": { "imports": "fix", "variables": "off" } }
    ]
  }
}

What happened?

Reproduction repo: https://github.com/antoine-cottineau/repro-unused-imports-lsp/tree/main

  • clone the repo
  • run yarn install
  • open vscode with the oxc extension installed and open App.tsx
  • run the command "Oxc: Fix all auto-fixable problems (file)"

Problem: the unused useMemo import is not removed.

However, if I run yarn oxlint --fix-dangerously, useMemo is removed.

I encountered the same problem in Neovim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions