Skip to content

Commit fe301b8

Browse files
authored
Docs: Add configuration comments in examples (#13738)
* Docs: Add configuration comments in examples * declare var in example * typo
1 parent 504408c commit fe301b8

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docs/rules/no-unmodified-loop-condition.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ If a reference is inside of a dynamic expression (e.g. `CallExpression`,
2929
Examples of **incorrect** code for this rule:
3030

3131
```js
32+
/*eslint no-unmodified-loop-condition: "error"*/
33+
34+
var node = something;
35+
3236
while (node) {
3337
doSomething(node);
3438
}
@@ -46,6 +50,8 @@ while (node !== root) {
4650
Examples of **correct** code for this rule:
4751

4852
```js
53+
/*eslint no-unmodified-loop-condition: "error"*/
54+
4955
while (node) {
5056
doSomething(node);
5157
node = node.parent;

docs/rules/prefer-object-spread.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Introduced in ES2018, object spread is a declarative alternative which may perfo
99
Examples of **incorrect** code for this rule:
1010

1111
```js
12+
/*eslint prefer-object-spread: "error"*/
1213

1314
Object.assign({}, foo)
1415

@@ -31,6 +32,7 @@ Object.assign({ foo: bar });
3132
Examples of **correct** code for this rule:
3233

3334
```js
35+
/*eslint prefer-object-spread: "error"*/
3436

3537
Object.assign(...foo);
3638

docs/rules/valid-typeof.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ typeof bar === typeof qux
3737
Examples of **incorrect** code with the `{ "requireStringLiterals": true }` option:
3838

3939
```js
40+
/*eslint valid-typeof: ["error", { "requireStringLiterals": true }]*/
41+
4042
typeof foo === undefined
4143
typeof bar == Object
4244
typeof baz === "strnig"
@@ -48,6 +50,8 @@ typeof foo == 5
4850
Examples of **correct** code with the `{ "requireStringLiterals": true }` option:
4951

5052
```js
53+
/*eslint valid-typeof: ["error", { "requireStringLiterals": true }]*/
54+
5155
typeof foo === "undefined"
5256
typeof bar == "object"
5357
typeof baz === "string"

0 commit comments

Comments
 (0)