Skip to content
Permalink
Browse files

Docs: Formatting inconsistencies (fixes #4912)

  • Loading branch information...
alberto committed Jan 12, 2016
1 parent f3dbbd9 commit 13a4e307daf32f6400eac2e43262a8b4992f3d0f
@@ -92,7 +92,7 @@ Object.defineProperty(o, 'c', {
```

#### getWithoutSet
#### `getWithoutSet`

The following patterns are considered problems with option `getWithoutSet` set:

@@ -35,7 +35,7 @@ Depending on your coding conventions, you can choose either option by specifying
"array-bracket-spacing": [2, "always"]
```

#### never
#### "never"

When `"never"` is set, the following patterns are considered problems:

@@ -80,7 +80,7 @@ var [x, ...y] = z;
var [,,x,] = z;
```

#### always
#### "always"

When `"always"` is used, the following patterns are considered problems:

@@ -47,7 +47,7 @@ a => {}

### Options

The rule takes one option, a string, which could be either "always" or "as-needed". The default is "always".
The rule takes one option, a string, which could be either `"always"` or `"as-needed"`. The default is `"always"`.

You can set the option in configuration like this:

@@ -12,7 +12,7 @@ This rule has a option, its value is `"always"` or `"never"`.
- `"always"` (by default) enforces one or more spaces.
- `"never"` disallows space(s).

### always
### "always"

```json
{
@@ -37,7 +37,7 @@ function foo() { return true; }
if (foo) { bar = 0; }
```

### never
### "never"

```json
{
@@ -46,7 +46,7 @@ This rule is aimed at enforcing a particular brace style in JavaScript. As such,

The rule takes two options:

1. A string which must be either "1tbs", "stroustrup" or "allman". The default is "1tbs".
1. A string which must be either `"1tbs"`, `"stroustrup"` or `"allman"`. The default is `"1tbs"`.
2. An object that further controls the behaviour of this rule. Currently, the only available parameter is `allowSingleLine`, which indicates whether start and end braces may be on the same line.

You can set the style in configuration like this:
@@ -24,7 +24,7 @@ The rule takes one option, an object, which has two keys `before` and `after` ha

The following examples show two primary usages of this option.

#### {"before": false, "after": true}
#### `{"before": false, "after": true}`

This is the default option. It enforces spacing after commas and disallows spacing before commas.

@@ -57,7 +57,7 @@ function foo(a, b){}
a, b
```

#### {"before": true, "after": false}
#### `{"before": true, "after": false}`

This option enforces spacing before commas and disallows spacing after commas.

@@ -12,7 +12,7 @@ This rule is aimed at enforcing a particular comma style in JavaScript. As such,

### Options

The rule takes an option, a string, which could be either "last" or "first". The default is "last".
The rule takes an option, a string, which could be either `"last"` or `"first"`. The default is `"last"`.

You can set the style in configuration like this:

@@ -38,7 +38,7 @@ Depending on your coding conventions, you can choose either option by specifying
"computed-property-spacing": [2, "never"]
```

#### never
#### "never"

When `"never"` is set, the following patterns will give a warning:

@@ -64,7 +64,7 @@ var x = {[b]: a}
obj[foo[bar]]
```

#### always
#### "always"

When `"always"` is used, the following patterns will give a warning:

@@ -57,7 +57,7 @@ if (foo) {

### Options

#### multi
#### "multi"

By default, this rule warns whenever `if`, `else`, `for`, `while`, or `do` are used without block statements as their body. However, you can specify that block statements should be used only when there are multiple statements in the block and warn when there is only one statement in the block. To do so, configure the rule as:

@@ -103,7 +103,7 @@ while (true) {
}
```

#### multi-line
#### "multi-line"

Alternatively, you can relax the rule to allow brace-less single-line `if`, `else if`, `else`, `for`, `while`, or `do`, while still enforcing the use of curly braces for other instances. To do so, configure the rule as:

@@ -155,7 +155,7 @@ while (true) {
}
```

#### multi-or-nest
#### "multi-or-nest"

You can use another configuration that forces brace-less `if`, `else if`, `else`, `for`, `while`, or `do` if their body contains only one single-line statement. And forces braces in all other cases.

@@ -222,7 +222,7 @@ for (var i = 0; foo; i++)
doSomething();
```

#### consistent
#### "consistent"

When using any of the `multi*` option, you can add an option to enforce all bodies of a `if`,
`else if` and `else` chain to be with or without braces.
@@ -29,7 +29,7 @@ if (obj.getStuff() != undefined) { } /*error Expected '!==' and instead saw '!='

### Options

* `"smart"`
#### "smart"

This option enforces the use of `===` and `!==` except for these cases:

@@ -71,7 +71,7 @@ bananas != 1 /*error Expected '!==' and instead saw '!='.*/
value == undefined /*error Expected '===' and instead saw '=='.*/
```

* `"allow-null"`
#### "allow-null"

This option will enforce `===` and `!==` in your code with one exception - it permits comparing to `null` to check for `null` or `undefined` in a single expression.

@@ -48,7 +48,7 @@ This rule is aimed at enforcing a particular type of function style throughout a

### Options

#### expression
#### "expression"

This is the default configuration. It reports an error when function declarations are used instead of function expressions.

@@ -62,7 +62,7 @@ An additional option object can be added with a property `"allowArrowFunctions"`
"func-style": [2, "expression", { "allowArrowFunctions": true }]
```

#### declaration
#### "declaration"

This reports an error if any function expressions are used where function declarations are expected. You can specify to use expressions instead:

@@ -16,7 +16,7 @@ However, if you're using Node.js, you may want to turn strict mode on globally.

This rule requires or disallows global strict mode invoked by a `"use strict"` pragma in the global scope.

The following pattern is under strict mode globally and is considered valid with the "always" option and a warning with the "never" option.
The following pattern is under strict mode globally and is considered valid with the `"always"` option and a warning with the `"never"` option.

```js
"use strict";
@@ -26,7 +26,7 @@ function foo() {
}
```

The following patterns apply strict mode only to functions so are valid with the "never" option but are problems with the "always" option.
The following patterns apply strict mode only to functions so are valid with the `"never"` option but are problems with the `"always"` option.

```js
function foo() {
@@ -11,7 +11,7 @@ var x = 5; // too short

This rule is aimed at increasing code readability and maintainability by enforcing an identifier length convention. It will warn on any type of identifier which doesn't conform to length limits (upper and lower).

It allows the programmers to silently by-pass this check by using "quoted" property names or calculated property access to allow potential server-side data requirements.
It allows the programmers to silently by-pass this check by using `"quoted"` property names or calculated property access to allow potential server-side data requirements.

The following patterns are considered problems:

@@ -46,20 +46,20 @@ var colleague = foo.Person();

By default both `newIsCap` and `capIsNew` options are set to `true`.

### newIsCap
### `newIsCap`

When `true`, rule checks if all `new` operators are called only with uppercase-started functions.

### capIsNew
### `capIsNew`

When `true`, rule checks if all uppercase-started functions are called only with `new` operator.

### newIsCapExceptions
### `newIsCapExceptions`

Array of lowercase function names that are permitted to be used with the `new` operator.
If provided, it must be an `Array`.

### capIsNewExceptions
### `capIsNewExceptions`

Array of uppercase-starting function names that are permitted to be used without the `new` operator. If not provided, `capIsNewExceptions` defaults to the following:

@@ -76,7 +76,7 @@ Array of uppercase-starting function names that are permitted to be used without

If provided, it must be an `Array`. The default values will continue to be excluded when `capIsNewExceptions` is provided.

### properties
### `properties`

By default, this rule will check properties such as `object.Property` using the other options (default value is `true`). When set to `false`, this rule will not check properties so `new object.property()` is valid even when `newIsCap` is `true`.

@@ -45,7 +45,7 @@ This rule has three options.
* `"number"` (`true` by default) - When this is `true`, this rule warns shorter type conversions for `number` type.
* `"string"` (`true` by default) - When this is `true`, this rule warns shorter type conversions for `string` type.

#### boolean
#### `boolean`

The following patterns are considered problems:

@@ -69,7 +69,7 @@ var b = foo.indexOf(".") !== -1;
var n = ~foo; // This is a just binary negating.
```

#### number
#### `number`

The following patterns are considered problems:

@@ -90,7 +90,7 @@ var b = parseFloat(foo);
var b = parseInt(foo, 10);
```

#### string
#### `string`

The following patterns are considered problems:

@@ -84,7 +84,7 @@ function doSomethingElse() {
}
```

With "both" option to check variable declarations, the following are considered problems:
With `"both"` option to check variable declarations, the following are considered problems:

```js
/*eslint no-inner-declarations: [2, "both"]*/
@@ -41,12 +41,12 @@ var dutyFreePrice = 100,

## Options

### ignore
### `ignore`

An array of numbers to ignore. It's set to `[]` by default.
If provided, it must be an `Array`.

### ignoreArrayIndexes
### `ignoreArrayIndexes`

A boolean to specify if numbers used as array indexes are considered okay. `false` by default.

@@ -59,10 +59,10 @@ var data = ['foo', 'bar', 'baz'];
var thirdValue = data[3];
```

### enforceConst
### `enforceConst`

A boolean to specify if we should check for the const keyword in variable declaration of numbers. `false` by default.

### detectObjects
### `detectObjects`

A boolean to specify if we should detect numbers when setting object properties for example. `false` by default.
@@ -50,7 +50,7 @@ This rule takes one option, an object, with properties `"builtinGlobals"`, `"hoi
}
```

#### builtinGlobals
#### `builtinGlobals`

`false` by default.
If this is `true`, this rule checks with built-in global variables such as `Object`, `Array`, `Number`, ...
@@ -65,15 +65,15 @@ function foo() {
}
```

#### hoist
#### `hoist`

The option has three settings:

* `all` - reports all shadowing before the outer variables/functions are defined.
* `functions` (by default) - reports shadowing before the outer functions are defined.
* `never` - never report shadowing before the outer variables/functions are defined.

##### { "hoist": "all" }
##### `{ "hoist": "all" }`

With `"hoist"` set to `"all"`, both `let a` and `let b` in the `if` statement are considered problems.

@@ -90,7 +90,7 @@ let a = 5;
function b() {}
```

##### { "hoist": "functions" } (default)
##### `{ "hoist": "functions" }` (default)

With `"hoist"` set to `"functions"`, `let b` is considered a warning. But `let a` in the `if` statement is not considered a warning, because it is before `let a` of the outer scope.

@@ -107,7 +107,7 @@ let a = 5;
function b() {}
```

##### { "hoist": "never" }
##### `{ "hoist": "never" }`

With `"hoist"` set to `"never"`, neither `let a` nor `let b` in the `if` statement are considered problems, because they are before the declarations of the outer scope.

@@ -124,7 +124,7 @@ let a = 5;
function b() {}
```

#### allow
#### `allow`

The option is an array of identifier names to be allowed (ie. "resolve", "reject", "done", "cb" etc.):

@@ -58,7 +58,7 @@ if (typeof UndefinedIdentifier === "undefined") {
}
```

#### typeof
#### `typeof`

You can use this option if you want to prevent `typeof` check on a variable which has not been declared.

@@ -83,7 +83,7 @@ if(typeof a === "string"){}

For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in [Specifying Environments](http://eslint.org/docs/user-guide/configuring#specifying-environments). A few examples are given below.

### browser
### `browser`

Defines common browser globals.

@@ -95,7 +95,7 @@ setTimeout(function() {
});
```

### node
### `node`

Defines globals for Node.js development.

Oops, something went wrong.

0 comments on commit 13a4e30

Please sign in to comment.
You can’t perform that action at this time.