Skip to content

Commit

Permalink
style: [skip ci] lint code snippets in md (#5379)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc authored and hzoo committed Feb 25, 2017
1 parent 6614a63 commit eb9d699
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 38 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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;
});
```
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-plugin-transform-async-to-module-method/README.md
Expand Up @@ -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", {
Expand Down
Expand Up @@ -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", {
Expand Down
8 changes: 6 additions & 2 deletions packages/babel-plugin-transform-es2015-for-of/README.md
Expand Up @@ -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", {
Expand Down
Expand Up @@ -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", {
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-plugin-transform-es2015-spread/README.md
Expand Up @@ -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", {
Expand Down
Expand Up @@ -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", {
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-transform-object-rest-spread/README.md
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions packages/babel-plugin-transform-react-jsx/README.md
Expand Up @@ -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", {
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-plugin-transform-runtime/README.md
Expand Up @@ -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", {
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-plugin-transform-strict-mode/README.md
Expand Up @@ -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", {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-preset-latest/README.md
Expand Up @@ -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", {
Expand All @@ -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", {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-register/README.md
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions packages/babel-template/README.md
Expand Up @@ -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
Expand Down

0 comments on commit eb9d699

Please sign in to comment.