gajus / flow-runtime

A runtime type system for JavaScript with full Flow compatibility.
MIT License
802 stars 57 forks source link

babel plugin adds annotations even when no @flow pragma is present #89

Open niieani opened 7 years ago

niieani commented 7 years ago

This is a:

Which concerns:


What is the current behaviour?

Currently, a file that contains type annotations, but no @flow pragma, will still get the flow-runtime annotations. This is a problem, especially since you cannot write @flow-runtime ignore, without enabling flow itself at the same time 🤓

(Flow looks for @flow, not ^@flow$, and @flow-runtime satisfies the regex).


What is the expected behaviour?

The babel plugin should not annotate files without the @flow pragma.


Which package versions are you using?

0.10.0

phpnode commented 7 years ago

(Flow looks for @flow, not ^@flow$, and @flow-runtime satisfies the regex).

nasty!

niieani commented 7 years ago

On a second thought, it might be good to make it configurable: whether we want to:

Not sure what's the best solution here, but I can see cases where the combination of using @flow-runtime, while at the same time NOT using @flow also might make sense.

In essence, we'd need to support all permutations.