microsoft / microsoft/TypeScript

Organize Import removes React import on React JS files

Open
#60,775 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs More Info
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.96.0
  • OS Version: Windows_NT x64 10.0.22631

Version: 1.96.0 (user setup)
Commit: 138f619c86f1199955d53b4166bef66ef252935c
Date: 2024-12-11T02:29:09.626Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

Steps to Reproduce:

  1. Open a JS file containing a React import
  2. Have Organize Imports as a code action on save
  3. See the React import get removed, despite it being used

Looks like this got re-introduced in latest update microsoft/vscode#47287

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Organize Imports code action on save with a JavaScript file containing a used React import, using the reported VS Code and TypeScript context. Compare the behavior with the referenced microsoft/vscode#47287 issue; done means Organize Imports preserves React imports that are used.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.