diff --git a/README.md b/README.md index 21a845d35400..b8fe9840efe5 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ When your supported environments don't support certain features natively, it wil ```js // ES2015 arrow function -[1,2,3].map(n => n + 1); +[1, 2, 3].map((n) => n + 1); ``` **Out** ```js -[1,2,3].map(function(n) { +[1, 2, 3].map(function(n) { return n + 1; }); ``` diff --git a/packages/babel-plugin-transform-async-to-module-method/README.md b/packages/babel-plugin-transform-async-to-module-method/README.md index 268271a16398..116da364f5d1 100644 --- a/packages/babel-plugin-transform-async-to-module-method/README.md +++ b/packages/babel-plugin-transform-async-to-module-method/README.md @@ -34,13 +34,17 @@ npm install --save-dev babel-plugin-transform-async-to-module-method **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-async-to-module-method"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-async-to-module-method", { diff --git a/packages/babel-plugin-transform-es2015-computed-properties/README.md b/packages/babel-plugin-transform-es2015-computed-properties/README.md index 573996ff5b9b..4a7c74d026fb 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/README.md +++ b/packages/babel-plugin-transform-es2015-computed-properties/README.md @@ -57,13 +57,17 @@ npm install --save-dev babel-plugin-transform-es2015-computed-properties **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-computed-properties"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-es2015-computed-properties", { diff --git a/packages/babel-plugin-transform-es2015-for-of/README.md b/packages/babel-plugin-transform-es2015-for-of/README.md index 7aff9a00f2e8..3e9efe20d90b 100644 --- a/packages/babel-plugin-transform-es2015-for-of/README.md +++ b/packages/babel-plugin-transform-es2015-for-of/README.md @@ -49,13 +49,17 @@ npm install --save-dev babel-plugin-transform-es2015-for-of **.babelrc** +Without options: + ```js -// without options { "plugins": ["transform-es2015-for-of"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-es2015-for-of", { diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/README.md b/packages/babel-plugin-transform-es2015-modules-systemjs/README.md index ca205005d9be..554421de63b8 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/README.md +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/README.md @@ -35,13 +35,17 @@ npm install --save-dev babel-plugin-transform-es2015-modules-systemjs **.babelrc** -```javascript -// without options +Without options: + +```json { "plugins": ["transform-es2015-modules-systemjs"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-es2015-modules-systemjs", { diff --git a/packages/babel-plugin-transform-es2015-spread/README.md b/packages/babel-plugin-transform-es2015-spread/README.md index af75353e36df..e33a1db7cff7 100644 --- a/packages/babel-plugin-transform-es2015-spread/README.md +++ b/packages/babel-plugin-transform-es2015-spread/README.md @@ -48,13 +48,17 @@ npm install --save-dev babel-plugin-transform-es2015-spread **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-spread"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-es2015-spread", { diff --git a/packages/babel-plugin-transform-es2015-template-literals/README.md b/packages/babel-plugin-transform-es2015-template-literals/README.md index fd0f57bf1898..477b11cce60b 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/README.md +++ b/packages/babel-plugin-transform-es2015-template-literals/README.md @@ -28,13 +28,17 @@ npm install --save-dev babel-plugin-transform-es2015-template-literals **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-template-literals"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-es2015-template-literals", { diff --git a/packages/babel-plugin-transform-object-rest-spread/README.md b/packages/babel-plugin-transform-object-rest-spread/README.md index b8f365d7afe8..61c3debfff7a 100644 --- a/packages/babel-plugin-transform-object-rest-spread/README.md +++ b/packages/babel-plugin-transform-object-rest-spread/README.md @@ -41,13 +41,15 @@ This plugin will use babel's `extends` helper, which will polyfill `Object.assig * `useBuiltIns` - Do not use Babel's helper's and just transform to use the built-in method (Disabled by default). -```js +```json { "plugins": [ ["transform-object-rest-spread", { "useBuiltIns": true }] ] } +``` +```js // source z = { x, ...y }; // compiled diff --git a/packages/babel-plugin-transform-react-jsx/README.md b/packages/babel-plugin-transform-react-jsx/README.md index 44a20066dd3b..128536db1eac 100644 --- a/packages/babel-plugin-transform-react-jsx/README.md +++ b/packages/babel-plugin-transform-react-jsx/README.md @@ -64,12 +64,17 @@ npm install --save-dev babel-plugin-transform-react-jsx **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-react-jsx"] } -// with options +``` + +With options: + +```json { "plugins": [ ["transform-react-jsx", { diff --git a/packages/babel-plugin-transform-runtime/README.md b/packages/babel-plugin-transform-runtime/README.md index ff42d7e9af98..011a3eab10de 100644 --- a/packages/babel-plugin-transform-runtime/README.md +++ b/packages/babel-plugin-transform-runtime/README.md @@ -40,13 +40,17 @@ The transformation plugin is typically used only in development, but the runtime Add the following line to your `.babelrc` file: -```js -// without options +Without options: + +```json { "plugins": ["transform-runtime"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-runtime", { diff --git a/packages/babel-plugin-transform-strict-mode/README.md b/packages/babel-plugin-transform-strict-mode/README.md index d6c258d3008a..08c5afe40508 100644 --- a/packages/babel-plugin-transform-strict-mode/README.md +++ b/packages/babel-plugin-transform-strict-mode/README.md @@ -34,13 +34,17 @@ npm install --save-dev babel-plugin-transform-strict-mode **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-strict-mode"] } +``` + +With options: -// with options +```json { "plugins": [ ["transform-strict-mode", { diff --git a/packages/babel-preset-latest/README.md b/packages/babel-preset-latest/README.md index 056d95645ded..ec4e16769dc5 100644 --- a/packages/babel-preset-latest/README.md +++ b/packages/babel-preset-latest/README.md @@ -42,7 +42,7 @@ require("babel-core").transform("code", { Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugins/preset-es2015/). -```js +```json { "presets": [ ["latest", { @@ -54,7 +54,7 @@ Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugi You can also pass options down to the `es2015` preset. -```js +```json { "presets": [ ["latest", { diff --git a/packages/babel-register/README.md b/packages/babel-register/README.md index 2f05d6a7f716..6a4682b56801 100644 --- a/packages/babel-register/README.md +++ b/packages/babel-register/README.md @@ -53,7 +53,7 @@ require("babel-register")({ // Ignore can also be specified as a function. ignore: function(filename) { - if (filename === '/path/to/es6-file.js') { + if (filename === "/path/to/es6-file.js") { return false; } else { return true; diff --git a/packages/babel-template/README.md b/packages/babel-template/README.md index 9eeb0adf3f62..c73507af5945 100644 --- a/packages/babel-template/README.md +++ b/packages/babel-template/README.md @@ -13,24 +13,24 @@ npm install --save-dev babel-template ## Usage ```js -import template from 'babel-template'; -import generate from 'babel-generator'; -import * as t from 'babel-types'; +import template from "babel-template"; +import generate from "babel-generator"; +import * as t from "babel-types"; const buildRequire = template(` var IMPORT_NAME = require(SOURCE); `); const ast = buildRequire({ - IMPORT_NAME: t.identifier('myModule'), - SOURCE: t.stringLiteral('my-module') + IMPORT_NAME: t.identifier("myModule"), + SOURCE: t.stringLiteral("my-module") }); console.log(generate(ast).code); ``` ```js -var myModule = require('my-module'); +const myModule = require("my-module"); ``` ## API