microsoft / microsoft/TypeScript

Make JS/TS Import fix insert import in linter specified order

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

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

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

説明

Popular linting rules in the TypeScript community require imports to be in alphabetic order (see ordered-imports in tslint:recommended). This is generally useful for readability of imports.

In VS Code, when a developer references an external module that hasn't been imported, VS Code offers a useful fix, which adds the appropriate import:

image

This is extremely useful! Thanks you! 🎉

However, once automatically imported, the import is just added to the end of the import list, leading to a linter error (since it's not in alphabetic order)😕:

image

You can then auto-fix the import issue (VS Code is aware of the TSLint preferences):
image

Would it be possible to short-circuit these steps such that when a developer "fixes" a missing import, it automatically inserts it in the appropriate order based on linting rules? FWIW, this also applies to the JS community (eslint has import order rules as well).

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

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

はじめの一歩

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

調査の方向性

この Issue では、VS Code の不足している import の自動修正と、TypeScript および ESLint または TSLint の import-order ルールとの相互作用について説明していますが、ソースファイルやテストは指定されていません。まず、自動 import のコードパスと、既存の import 順序の処理を特定してください。JavaScript と TypeScript で、新しく挿入された import が適用可能な設定済みの順序に従えば完了です。

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

評価

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

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

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