Skip to content

Commit

Permalink
Docs: Add configuration comments in examples (#13738)
Browse files Browse the repository at this point in the history
* Docs: Add configuration comments in examples

* declare var in example

* typo
  • Loading branch information
yeonjuan committed Oct 6, 2020
1 parent 504408c commit fe301b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/rules/no-unmodified-loop-condition.md
Expand Up @@ -29,6 +29,10 @@ If a reference is inside of a dynamic expression (e.g. `CallExpression`,
Examples of **incorrect** code for this rule:

```js
/*eslint no-unmodified-loop-condition: "error"*/

var node = something;

while (node) {
doSomething(node);
}
Expand All @@ -46,6 +50,8 @@ while (node !== root) {
Examples of **correct** code for this rule:

```js
/*eslint no-unmodified-loop-condition: "error"*/

while (node) {
doSomething(node);
node = node.parent;
Expand Down
2 changes: 2 additions & 0 deletions docs/rules/prefer-object-spread.md
Expand Up @@ -9,6 +9,7 @@ Introduced in ES2018, object spread is a declarative alternative which may perfo
Examples of **incorrect** code for this rule:

```js
/*eslint prefer-object-spread: "error"*/

Object.assign({}, foo)

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

```js
/*eslint prefer-object-spread: "error"*/

Object.assign(...foo);

Expand Down
4 changes: 4 additions & 0 deletions docs/rules/valid-typeof.md
Expand Up @@ -37,6 +37,8 @@ typeof bar === typeof qux
Examples of **incorrect** code with the `{ "requireStringLiterals": true }` option:

```js
/*eslint valid-typeof: ["error", { "requireStringLiterals": true }]*/

typeof foo === undefined
typeof bar == Object
typeof baz === "strnig"
Expand All @@ -48,6 +50,8 @@ typeof foo == 5
Examples of **correct** code with the `{ "requireStringLiterals": true }` option:

```js
/*eslint valid-typeof: ["error", { "requireStringLiterals": true }]*/

typeof foo === "undefined"
typeof bar == "object"
typeof baz === "string"
Expand Down

0 comments on commit fe301b8

Please sign in to comment.