* Add all option to babel-plugin-syntax-flow The Flow parser has some conditional logic based on whether types should be parsed or not, which is based on either (a) the @flow pragma in the docblock of the file of (b) the `all` configuration, provided via command line or .flowconfig. This commit adds the ability to provide the `all` configuration to Babel as well, via the syntax-flow plugin. This should be set to `true` if the project uses all=true. * Parse @flow pragma The Flow parser has some conditional logic based on whether types should be parsed or not, which is based on either (a) the @flow pragma in the docblock of the file of (b) the `all` configuration, provided via command line or .flowconfig. This commit parses the @flow (or @noflow) pragma from the first comment in the source file. Directives are allowed to appear before the comment. * WIP: add tests for explicit type arguments This commit includes tests which have unexpected output, but will change to the expected output as later commits add parsing support for various features. * Parse type arguments in new expressions * Parse type arguments in call expressions * Parse optional call expressions with explicit type args * Add explicit type arguments to babel-types Flow calls these typeArguments instead of typeParameters, which clearly separates formal/actual parameters, and mirrors the existing arguments key. The existing definitions to support TypeScript also included Flow's TypeParameterInstantiation node type, which I've moved to the the new field. * Add support for explicit type arguments to babel-generator * Add test for explicit type args to transform-flow-strip-types plugin * Oops. Forgot to regenerate the babel-types README. * Fix Flow parser shouldParseTypes() function I was looking at `options.all`, but the correct property ws `options.flowAll`. Oops! * Remove typeapp_call from whitelist of expected failures Now that Babylon parses this syntax extension, we can remove the typeapp_call tests from the list of expected differences. Note that I am using the `flowAll` option, mirroring the behavior of the Flow tests, which assume types without requiring the `@flow` pragma. * Use Babylon plugin options instead of parser options * Parse optional call expressions type arguments unambiguously
The compiler for writing next generation JavaScript.
Supporting Babel
Babel is a community-driven project used by many companies and projects, and is maintained by a group of volunteers. If you'd like to help support the future of the project, please consider:
- Giving developer time on the project. (Message us on Twitter or Slack for guidance!)
- Giving funds by becoming a sponsor (see below)!
Open Collective Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
Patreon Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
Bronze
Intro
Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
In
// ES2015 arrow function
[1, 2, 3].map((n) => n + 1);
Out
[1, 2, 3].map(function(n) {
return n + 1;
});
Try it out at our REPL.
FAQ
Who maintains Babel?
Mostly a handful of volunteers! Please check out our team page!
Looking for support?
For questions and support please visit join our Slack Community (you can sign-up here for an invite), ask a question on Stack Overflow, or ping us on Twitter.
Is there a Babel song?
I'm so glad you asked: Hallelujah —— In Praise of Babel by @angus-c. Tweet us your recordings!
Where are the docs?
Check out our website: babeljs.io, and report issues/features at babel/website.
Want to report a bug or request a feature?
Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!
Want to contribute to Babel?
Check out our CONTRIBUTING.md to get started with setting up the repo.
- If you have already joined Slack, join our #development channel and say hi!
- Check out the issues with the good first issue and help wanted label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
- Our discussions/notes/roadmap: babel/notes
- Our progress on TC39 proposals: babel/proposals
How is the repo structured?
The Babel repo is managed as a monorepo that is composed of many npm packages.

