facebookarchive / flow-remove-types

🚿 Removes Flow type annotations from JavaScript files with speed and simplicity.
MIT License
467 stars 52 forks source link

Remove pragma comment completely if no other content present #59

Open StreetStrider opened 6 years ago

StreetStrider commented 6 years ago

Is it possible to supply an option to remove pragmas with corresponding comments completely, if comments have no other content but pragma only? Like: /* @flow foo *//* foo */, but /* @flow */ → (empty string).

For now I got emptish comments in my generated code like this: /* */.

dashed commented 6 years ago

Also // @flow gets transformed to just //. Be useful to just remove this completely.

motiz88 commented 5 years ago

Hey @StreetStrider @dashed, apologies for the long radio silence. I wonder: What's the impact of this issue? Does anything actually not work because we leave these empty comments in the output? I mean, I can see a case for this in --pretty mode, but still, it seems fairly benign to me.

StreetStrider commented 5 years ago

@motiz88 nothing broken, it's just a matter of style. If the only reason I create comment is to put flow pragma in it, I would like this comment to be eleminated completely by something like flow pragma removing utility.