Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize options sections in docs [skip ci] #5244

Merged
merged 2 commits into from Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 23 additions & 6 deletions packages/babel-code-frame/README.md
Expand Up @@ -35,9 +35,26 @@ If the column number is not known, you may pass `null` instead.

## Options

name | type | default | description
-----------------------|----------|-----------------|------------------------------------------------------
highlightCode | boolean | `false` | Syntax highlight the code as JavaScript for terminals
linesAbove | number | 2 | The number of lines to show above the error
linesBelow | number | 3 | The number of lines to show below the error
forceColor | boolean | `false` | Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode
### `highlightCode`

`boolean`, defaults to `false`.

Toggles syntax highlighting the code as JavaScript for terminals.

### `linesAbove`

`number`, defaults to `2`.

Adjust the number of lines to show above the error.

### `linesBelow`

`number`, defaults to `3`.

Adjust the number of lines to show below the error.

### `forceColor`

`boolean`, defaults to `false`.

Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`.
1 change: 1 addition & 0 deletions packages/babel-core/README.md
Expand Up @@ -117,4 +117,5 @@ Following is a table of the options you can use:
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. |
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. |
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. |
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be either "script" or "module". |
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
6 changes: 5 additions & 1 deletion packages/babel-plugin-transform-class-properties/README.md
Expand Up @@ -76,7 +76,11 @@ require("babel-core").transform("code", {

## Options

* `spec` - Class properties are compiled to use `Object.defineProperty. Static fields are now defined even if they are not initialized
### `spec`

`boolean`, defaults to `false`.

Class properties are compiled to use `Object.defineProperty`. Static fields are now defined even if they are not initialized.

## References

Expand Down
Expand Up @@ -73,7 +73,7 @@ Without options:

With options:

```json
```json
{
"plugins": [
["transform-es2015-arrow-functions", { "spec": true }]
Expand All @@ -97,4 +97,8 @@ require("babel-core").transform("code", {

## Options

* `spec` - This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated.
### `spec`

`boolean`, defaults to `false`.

This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated.
6 changes: 5 additions & 1 deletion packages/babel-plugin-transform-es2015-classes/README.md
Expand Up @@ -50,7 +50,11 @@ require("babel-core").transform("code", {
});
```

## Options `loose`
## Options

### `loose`

`boolean`, defaults to `false`.

#### Method enumerability

Expand Down
Expand Up @@ -62,7 +62,11 @@ require("babel-core").transform("code", {
});
```

## Options `loose`
## Options

### `loose`

`boolean`, defaults to `false`.

As per the spec, `import` and `export` are only allowed to be used at the top
level. When in loose mode these are allowed to be used anywhere.
Expand Down
6 changes: 5 additions & 1 deletion packages/babel-plugin-transform-es2015-spread/README.md
Expand Up @@ -80,4 +80,8 @@ require("babel-core").transform("code", {

## Options

* `loose` - All iterables are assumed to be arrays.
### `loose`

`boolean`, defaults to `false`.

In loose mode, **all** iterables are assumed to be arrays.
Expand Up @@ -62,10 +62,15 @@ require("babel-core").transform("code", {
## Options

### `loose`
In loose mode, tagged template literal objects aren't frozen.

`boolean`, defaults to `false`.

In loose mode, tagged template literal objects aren't frozen.

### `spec`

`boolean`, defaults to `false`.

This option wraps all template literal expressions with `String`. See [babel/babel#1065](https://github.com/babel/babel/issues/1065) for more info.

**In**
Expand Down
16 changes: 13 additions & 3 deletions packages/babel-plugin-transform-react-jsx/README.md
Expand Up @@ -95,6 +95,16 @@ require("babel-core").transform("code", {

## Options

* `pragma` - Replace the function used when compiling JSX expressions (Defaults to `React.createElement`).
- Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12
* `useBuiltIns` - When spreading props, use Object.assign instead of Babel's extend helper (Disabled by default).
### `pragma`

`string`, defaults to `React.createElement`.

Replace the function used when compiling JSX expressions.

Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12

### `useBuiltIns`

`boolean`, defaults to `false`.

When spreading props, use `Object.assign` directly instead of Babel's extend helper.
44 changes: 18 additions & 26 deletions packages/babel-preset-es2015/README.md
Expand Up @@ -36,30 +36,22 @@ require("babel-core").transform("code", {

## Options

* `loose` - Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).
* `modules` - Enable transformation of ES6 module syntax to another module type (Enabled by default to `"commonjs"`).
* Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "commonjs"]`
* `spec` - Enable "spec" transformations for any plugins in this preset that allow them (Disabled by default)
### `loose`

```js
{
presets: [
["es2015", { "loose": true }]
]
}
{
presets: [
["es2015", { "modules": false }]
]
}
{
presets: [
["es2015", { "loose": true, "modules": false }]
]
}
{
presets: [
["es2015", { "spec": true }]
]
}
```
`boolean`, defaults to `false`.

Enable "loose" transformations for any plugins in this preset that allow them.

### `modules`

`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.

Enable transformation of ES6 module syntax to another module type.

Setting this to `false` will not transform modules.

### `spec`

`boolean`, defaults to `false`.

Enable "spec" transformations for any plugins in this preset that allow them.
26 changes: 21 additions & 5 deletions packages/babel-preset-latest/README.md
Expand Up @@ -36,15 +36,17 @@ require("babel-core").transform("code", {

### Options

- `es2015`: Optionally not run any plugins from this preset (defaults to true)
- `es2016`: Optionally not run any plugins from this preset (defaults to true)
- `es2017`: Optionally not run any plugins from this preset (defaults to true)
### `es2015`

`boolean`, defaults to `true`.

Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugins/preset-es2015/).

```js
{
"presets": [
["latest", {
"es2015": false // defaults to true
"es2015": false
}]
]
}
Expand All @@ -57,9 +59,23 @@ You can also pass options down to the `es2015` preset.
"presets": [
["latest", {
"es2015": {
"modules": false
"modules": false
}
}]
]
}
```

**Note:** This also works for the other preset-year options below.

### `es2016`

`boolean`, defaults to `true`.

Toggles including plugins from the [es2016 preset](https://babeljs.io/docs/plugins/preset-es2016/).

### `es2017`

`boolean`, defaults to `true`.

Toggles including plugins from the [es2017 preset](https://babeljs.io/docs/plugins/preset-es2017/).