babel plugin adds annotations even when no @flow pragma is present
This is a:
- [x] Bug Report
Which concerns:
- [x] babel-plugin-flow-runtime
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
(Flow looks for @flow, not ^@flow$, and @flow-runtime satisfies the regex).
nasty!
On a second thought, it might be good to make it configurable: whether we want to:
- opt-in by specifying
@flow-runtime(or another pragma) - execute always, even when
@flowpragma is not present, opt-out of it via@flow-runtime disable(or perhaps to not collide with flow the pragma could be changed?) - execute only when
@flowis enabled opt-out of it via@flow-runtime disableor another pragma.
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.