Closed c-lliope closed 8 years ago
As far as I know Babel automatically strips Flow annotations itself during transpilation and it doesn't need additional plugin for that. Have in mind that Flow is just a static type checker and doesn't add any code transformations and is more a code documentation tool.
@ralekna thanks for the fast response!
According to Flow's documentation, a special plugin is needed to strip out Flow annotations. I've tried using Flow in my Rails project without the plugin, and I got syntax errors that prevented the JS on the page from running.
The bottom section of this page shows what the flow plugin is doing when it transforms the input.
The http://babeljs.io/docs/plugins/transform-flow-strip-types/ plugin is for babel 6 which has no plugins by default thus everything is opt-in.
@graysonwright it's a bit strange because as I see a PR for Babel v.6 (https://github.com/babel/ruby-babel-transpiler/pull/282) is not yet merged into master. Are you really sure that those syntax errors are cause by Flow markup? I use current version of this gem with Flow annotations and it works like a charm without adding any plugins.
@ralekna - sorry for letting this get stale. I no longer have access to the app, so I'm not able to reproduce. It seems like it's working well for everyone else, so I'm OK closing this.
Thanks for your help!
Getting the same error while using transform-decorators
plugin. Are there any plans to merge the babel v6 PR ?
Hello! I'm trying out Flow on my Rails app, and I'm trying to set up
ruby-babel-transpiler
to strip out Flow type annotations.There's an existing Babel plugin that can take care of this, but it doesn't look like it's available in
ruby-babel-transpiler
.I've added this configuration to my
config/application.rb
file:And in the browser, I get an error:
I'm curious - is there a plan to make babel plugins available through this project? Would they be packaged as separate gems? If so, what would the structure of those gems look like?