microsoft / microsoft/TypeScript
If autoimporting import that is commented out - uncomment it instead of adding new one
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Search Terms
autoimport commented uncomment import
Suggestion
Consider we have such imports already in some file:
import React, {
useState,
// useEffect,
} from 'react';
Then - if you write useEffect - TS will suggest auto importing it - which is cool. If you choose to auto import it - your import statement will look something like:
import React, {
useState,
// useEffect,
useEffect,
} from 'react';
Which is not a big deal, but leads to some kind of duplication.
Desired result would be:
import React, {
useState,
useEffect,
} from 'react';
Which is just removing the comment next to the import I want to use.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla gestione degli auto-import del language-service di TypeScript e trova i test che coprono gli import con import nominati commentati. Aggiungi un caso di regressione per l’import in stile React mostrato e verifica che la selezione dell’auto-import rimuova il commento invece di aggiungere un import duplicato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100