microsoft / microsoft/TypeScript
If autoimporting import that is commented out - uncomment it instead of adding new one
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in TypeScripts language-service-Behandlung für Auto-Imports und finde die Tests, die Imports mit auskommentierten benannten Imports abdecken. Füge einen Regressionstest für den gezeigten React-artigen Import hinzu und verifiziere, dass die Auswahl des Auto-Imports den Kommentar entfernt, anstatt einen doppelten Import hinzuzufügen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100