UNPKG

1.24 kBMarkdownView Raw
1# babel-preset-airbnb
2
3> A babel preset for transforming your JavaScript for Airbnb.
4
5Currently contains transforms for all standard syntax that is [stage 4](https://tc39.github.io/ecma262/) (ES2017) or [stage 3](https://github.com/tc39/proposals#active-proposals), except for the following:
6 - generators: `regenerator-runtime` is too heavyweight for our use.
7 - `async/await`: `regenerator-runtime` is too heavyweight for our use, and [async-to-promises](https://www.npmjs.com/package/babel-plugin-async-to-promises) is not yet complete enough to be safely used.
8 - `SIMD`: this is a performance feature, so is pretty pointless to polyfill/transpile.
9 - lifted template literal restrictions: we do not use tagged template literals, nor implement custom DSLs, otherwise we would enable this.
10
11We have also enabled object rest/spread, although it is only at stage 2. It will hopefully achieve stage 3 soon.
12
13## Install
14
15```sh
16$ npm install --save-dev babel-preset-airbnb
17```
18
19## Usage
20
21### Via `.babelrc` (Recommended)
22
23**.babelrc**
24
25```json
26{
27 "presets": ["airbnb"]
28}
29```
30
31### Via CLI
32
33```sh
34$ babel script.js --presets airbnb
35```
36
37### Via Node API
38
39```javascript
40require("babel-core").transform("code", {
41 presets: ["airbnb"]
42});
43```