facebook / facebook/jscodeshift

Is there proper way to remove all comments?

Aperta
#293 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
JavaScript
Stelle
10k
Fork
498
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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'
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.