microsoft / microsoft/TypeScript

If autoimporting import that is commented out - uncomment it instead of adding new one

オープン
#39,690 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

TypeScript の language-service における auto-import の処理から始め、コメントアウトされた名前付き import を含む import を対象とするテストを見つけてください。示されている React スタイルの import の回帰テストケースを追加し、auto-import を選択すると重複した import が追加されるのではなくコメントが削除されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。