Skip to content

Commit 36f40c2

Browse files
committed
Docs: Achieve consistent order of h2 in rule pages
1 parent 41be483 commit 36f40c2

18 files changed

+247
-202
lines changed

docs/rules/callback-return.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The rule takes a single option, which is an array of possible callback names.
5757
callback-return: [2, ["callback", "cb", "next"]]
5858
```
5959

60-
## Gotchas
60+
## Known Limitations
6161

6262
There are several cases of bad behavior that this rule will not catch and even a few cases where
6363
the rule will warn even though you are handling your callbacks correctly. Most of these issues arise

docs/rules/func-style.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ An additional option object can be added with a property `"allowArrowFunctions"`
6262
"func-style": [2, "expression", { "allowArrowFunctions": true }]
6363
```
6464

65+
The following patterns are considered problems:
66+
67+
```js
68+
/*eslint func-style: [2, "expression"]*/
69+
70+
function foo() {
71+
// ...
72+
}
73+
```
74+
75+
The following patterns are not considered problems:
76+
77+
```js
78+
/*eslint func-style: [2, "expression"]*/
79+
80+
var foo = function() {
81+
// ...
82+
};
83+
```
84+
85+
```js
86+
/*eslint func-style: [2, "declaration", { "allowArrowFunctions": true }]*/
87+
88+
var foo = () => {};
89+
```
90+
6591
### "declaration"
6692

6793
This reports an error if any function expressions are used where function declarations are expected. You can specify to use expressions instead:
@@ -70,8 +96,6 @@ This reports an error if any function expressions are used where function declar
7096
"func-style": [2, "declaration"]
7197
```
7298

73-
## Examples
74-
7599
The following patterns are considered problems:
76100

77101
```js
@@ -82,14 +106,6 @@ var foo = function() {
82106
};
83107
```
84108

85-
```js
86-
/*eslint func-style: [2, "expression"]*/
87-
88-
function foo() {
89-
// ...
90-
}
91-
```
92-
93109
```js
94110
/*eslint func-style: [2, "declaration"]*/
95111

@@ -111,20 +127,6 @@ SomeObject.foo = function() {
111127
};
112128
```
113129

114-
```js
115-
/*eslint func-style: [2, "expression"]*/
116-
117-
var foo = function() {
118-
// ...
119-
};
120-
```
121-
122-
```js
123-
/*eslint func-style: [2, "declaration", { "allowArrowFunctions": true }]*/
124-
125-
var foo = () => {};
126-
```
127-
128130

129131
## When Not To Use It
130132

docs/rules/no-ex-assign.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ try {
4141
}
4242
```
4343

44-
## Notes
45-
46-
Related aside: there are some interesting caveats in IE 6-8 where the exception identifier will leak into the outer scope causing some unexpected behavior. Ben Alman has a [great article](http://weblog.bocoup.com/the-catch-with-try-catch/) that explains this behavior in detail
47-
4844
## Further Reading
4945

5046
* [Do not assign to the exception parameter](http://jslinterrors.com/do-not-assign-to-the-exception-parameter/)
51-
* [The "catch" with try...catch -- Ben Alman](http://weblog.bocoup.com/the-catch-with-try-catch/)
47+
* [The "catch" with try...catch](http://weblog.bocoup.com/the-catch-with-try-catch/) by Ben Alman explains how the exception identifier can leak into the outer scope in IE 6-8

docs/rules/no-extra-label.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ C: switch (a) {
7171
}
7272
```
7373

74+
## When Not To Use It
75+
76+
If you don't want to be notified about usage of labels, then it's safe to disable this rule.
77+
7478
## Related Rules
7579

7680
* [no-labels](./no-labels.md)
7781
* [no-label-var](./no-label-var.md)
7882
* [no-unused-labels](./no-unused-labels.md)
79-
80-
## When Not To Use It
81-
82-
If you don't want to be notified about usage of labels, then it's safe to disable this rule.

docs/rules/no-floating-decimal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ var num = 0.5;
3333
var num = 2.0;
3434
```
3535

36-
## Compatibility
37-
38-
* **JSHint**: W008
39-
4036
## When Not To Use It
4137

4238
If you aren't concerned about misinterpreting floating decimal point values, then you can safely turn this rule off.
4339

40+
## Compatibility
41+
42+
* **JSHint**: W008
43+
4444
## Further Reading
4545

4646
* [A leading decimal point can be confused with a dot](http://jslinterrors.com/a-leading-decimal-point-can-be-confused-with-a-dot-a/)

docs/rules/no-invalid-regexp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ new RegExp
2828
this.RegExp('[')
2929
```
3030

31-
## New ECMAScript 6 Flags
31+
## Environments
3232

3333
ECMAScript 6 adds the "u" ([unicode](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.unicode)) and "y" ([sticky](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.sticky)) flags. You can enable these to be recognized as valid by setting the ECMAScript version to 6 in your [ESLint configuration](../user-guide/configuring).
3434

docs/rules/no-invalid-this.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ And this rule allows `this` keywords in functions below:
2727

2828
Otherwise are considered problems.
2929

30-
### The following patterns are considered problems:
30+
The following patterns are considered problems:
3131

3232
This rule warns below **only** under the strict mode.
3333
Please note your code in ES2015 Modules/Classes is always the strict mode.
@@ -80,7 +80,7 @@ foo.forEach(function() {
8080
});
8181
```
8282

83-
### The following patterns are not considered problems:
83+
The following patterns are not considered problems:
8484

8585
```js
8686
/*eslint no-invalid-this: 2*/

docs/rules/no-label-var.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ q:
4141

4242
If you don't want to be notified about usage of labels, then it's safe to disable this rule.
4343

44+
## Further Reading
45+
46+
* ['{a}' is a statement label](http://jslinterrors.com/a-is-a-statement-label/)
47+
4448
## Related Rules
4549

4650
* [no-extra-label](./no-extra-label.md)
4751
* [no-labels](./no-labels.md)
4852
* [no-unused-labels](./no-unused-labels.md)
49-
50-
## Further Reading
51-
52-
* ['{a}' is a statement label](http://jslinterrors.com/a-is-a-statement-label/)

docs/rules/no-mixed-requires.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ In the Node.JS community it is often customary to separate the `require`d module
44

55
## Rule Details
66

7-
When this rule is enabled, all `var` statements must satisfy the following conditions:
7+
When this rule is enabled, each `var` statement must satisfy the following conditions:
88

9-
* either none or all variable declarations must be require declarations
10-
* all require declarations must be of the same type (optional)
9+
* either none or all variable declarations must be require declarations (default)
10+
* all require declarations must be of the same type (grouping)
1111

1212
This rule distinguishes between six kinds of variable declaration types:
1313

@@ -35,21 +35,28 @@ This rule comes with two boolean options. Both are turned off by default. You ca
3535

3636
```json
3737
{
38-
"no-mixed-requires": [1, {"grouping": true, "allowCall": true}]
38+
"no-mixed-requires": [2, {"grouping": true, "allowCall": true}]
3939
}
4040
```
4141

42-
The second way to configure this rule is with boolean (This way of setting is deprecated).
42+
The second way to configure this rule is with boolean. This way of setting is deprecated.
4343

4444
```json
4545
{
46-
"no-mixed-requires": [1, true]
46+
"no-mixed-requires": [2, true]
4747
}
4848
```
4949

5050
If enabled, violations will be reported whenever a single `var` statement contains require declarations of mixed types (see the examples below).
5151

52-
## Examples
52+
The following patterns are considered problems:
53+
54+
```js
55+
/*eslint no-mixed-requires: 2*/
56+
57+
var fs = require('fs'),
58+
i = 0;
59+
```
5360

5461
The following patterns are not considered problems:
5562

@@ -72,14 +79,7 @@ var foo = require('foo' + VERSION),
7279
baz = require();
7380
```
7481

75-
The following patterns are considered problems:
76-
77-
```js
78-
/*eslint no-mixed-requires: 2*/
79-
80-
var fs = require('fs'),
81-
i = 0;
82-
```
82+
### grouping
8383

8484
The following patterns are considered problems when grouping is turned on:
8585

@@ -95,6 +95,8 @@ var foo = require('foo'),
9595
bar = require(getBarModuleName());
9696
```
9797

98+
### allowCall
99+
98100
The following patterns are not considered problems when `allowCall` is turned on:
99101

100102
```js
@@ -111,14 +113,16 @@ var async = require('async'),
111113
eslint = require('eslint');
112114
```
113115

114-
## When Not To Use It
116+
## Known Limitations
115117

116-
Internally, the list of core modules is retrieved via `require("repl")._builtinLibs`. If you use different versions of Node.JS for ESLint and your application, the list of core modules for each version may be different.
117-
The above mentioned `_builtinLibs` property became available in 0.8, for earlier versions a hardcoded list of module names is used as a fallback. If your version of Node is older than 0.6 that list may be inaccurate.
118+
* The implementation is not aware of any local functions with the name `require` that may shadow Node's global `require`.
118119

119-
If you use a pattern such as [UMD][4] where the `require`d modules are not loaded in variable declarations, this rule will obviously do nothing for you.
120+
* Internally, the list of core modules is retrieved via `require("repl")._builtinLibs`. If you use different versions of Node.JS for ESLint and your application, the list of core modules for each version may be different.
121+
The above mentioned `_builtinLibs` property became available in 0.8, for earlier versions a hardcoded list of module names is used as a fallback. If your version of Node is older than 0.6 that list may be inaccurate.
120122

121-
The implementation is not aware of any local functions with the name `require` that may shadow Node's global `require`.
123+
## When Not To Use It
124+
125+
If you use a pattern such as [UMD][4] where the `require`d modules are not loaded in variable declarations, this rule will obviously do nothing for you.
122126

123127
[1]: http://nodejs.org/api/modules.html#modules_core_modules
124128
[2]: http://nodejs.org/api/modules.html#modules_file_modules

0 commit comments

Comments
 (0)