Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gozala/babel-preset-flow-syntax
Babel preset for all Flow plugins
https://github.com/gozala/babel-preset-flow-syntax
babel flow preset
Last synced: 13 days ago
JSON representation
Babel preset for all Flow plugins
- Host: GitHub
- URL: https://github.com/gozala/babel-preset-flow-syntax
- Owner: Gozala
- Created: 2017-06-23T22:30:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-23T22:58:08.000Z (over 7 years ago)
- Last Synced: 2024-12-09T17:07:24.946Z (about 1 month ago)
- Topics: babel, flow, preset
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-preset-flow-syntax
This is an extension of the official [flow][preset-flow] that is supposly is a:
> Babel preset for all Flow plugins.
But there are certain features like [class properties syntax][] that flow
supports out of the box while babel requires [transform-class-properties][]
plugin in order to be able to parse it.> Babel preset that supports full flow syntax.
This preset includes the following plugins & presets:
- [preset-flow][]
- [transform-class-properties][]## Example
**In**
```javascript
function foo(one: any, two: number, three?): string {}
```**Out**
```javascript
function foo(one, two, three) {}
```## Installation
```sh
npm install --save-dev babel-preset-flow-syntax
```## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"presets": ["flow-sytax"]
}
```### Via CLI
```sh
babel --presets flow-syntax script.js
```### Via Node API
```javascript
require("babel-core").transform("code", {
presets: ["flow-syntax"]
});
```[preset-flow]:https://babeljs.io/docs/plugins/preset-flow/
[class properties syntax]:https://tc39.github.io/proposal-class-public-fields/
[transform-class-properties]:https://babeljs.io/docs/plugins/transform-class-properties/