facebook / facebook/jscodeshift

Is there proper way to remove all comments?

オープン
#293 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
JavaScript
スター
10k
フォーク
498
PR マージ指標
30日以内にマージされた PR はありません

説明

Now I have to iterate comment nodes and modify values, but comment's signature is staying untouched.
In:
```
// leading_comment
const definition = 'string'
/* block_comment */
```

Modification:

```
const j = api.jscodeshift
const root = j(file.source)

root.find(j.Comment).forEach(comment => (comment.value.value = ''))
```

Out:

```
//
const definition = 'string'
/**/
```

Expected:

```
const definition = 'string'
```

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

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

評価

この issue はまだ評価されていません。

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

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