microsoft / microsoft/TypeScript

Double slash comment `//` will be wrongly removed in the trailing position of the object attribute

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

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

Domain: Comment Emit Help Wanted Possible Improvement
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

🔎 Search Terms
  • comment removal
  • removeComments
🕗 Version & Regression Information
  • This is the behavior in every version I tried.
⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.2.2#code/KYDwDg9gTgLgBAYwgOwM7wGYQnAvHAbwCg5S4sIAuOAcgpoBo4B6ZuGACwEtVEIBbfsGTwA7lwA2EuACNgcKMH4QAbsAAmAOhJkZAQyjUa+qDRZtOPPoOFjJ0uXADWwMDCYyArmI4BPbQC+QA

💻 Code
export const foo = {
    foo: 'foo', // this comment will be removed, however this should be kept
    bar: 'bar' // this comment will be kept, works well
}
🙁 Actual behavior
export const foo = {
    foo: 'foo',
    bar: 'bar' // this comment will be kept, works well
}
🙂 Expected behavior
export const foo = {
    foo: 'foo', // this comment will be removed, however this should be kept
    bar: 'bar' // this comment will be kept, works well
}
Additional information about the issue

No response

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

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

はじめの一歩

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

調査の方向性

まず、issue で示されている removeComments の動作を追跡し、リンク先の TypeScript Playground でケースを再現します。オブジェクトの末尾の属性について、後続のカンマがある場合とない場合のコメント処理を比較します。示されている foo コメントが保持され、既存の bar コメントが変更されないことを、例をカバーするリグレッションテストで確認できれば完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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