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

Docs: Improve examples and clarify default option #12067

Merged
merged 2 commits into from Sep 14, 2019
Merged
Changes from 1 commit
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
24 changes: 17 additions & 7 deletions docs/rules/operator-linebreak.md
Expand Up @@ -38,7 +38,7 @@ The default configuration is `"after", { "overrides": { "?": "before", ":": "bef

### after

Examples of **incorrect** code for this rule with the default `"after"` option:
Examples of **incorrect** code for this rule with the `"after"` option:

```js
/*eslint operator-linebreak: ["error", "after"]*/
Expand All @@ -62,7 +62,7 @@ answer = everything
: foo;
```

Examples of **correct** code for this rule with the default `"after"` option:
Examples of **correct** code for this rule with the `"after"` option:

```js
/*eslint operator-linebreak: ["error", "after"]*/
Expand Down Expand Up @@ -175,14 +175,24 @@ answer = everything ? 42 : foo;

### overrides

Examples of additional **correct** code for this rule with the `{ "overrides": { "+=": "before" } }` option:
Examples of additional **incorrect** code for this rule with the default `{ "overrides": { "?": "before", ":": "before" } }` option:

```js
/*eslint operator-linebreak: ["error", "after", { "overrides": { "+=": "before" } }]*/
/*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/

var thing = 'thing';
thing
+= 's';
answer = everything ?
42 :
foo;
```

Examples of additional **correct** code for this rule with the default `{ "overrides": { "?": "before", ":": "before" } }` option:
zypA13510 marked this conversation as resolved.
Show resolved Hide resolved

```js
/*eslint operator-linebreak: ["error", "after", { "overrides": { "?": "before", ":": "before" } }]*/

answer = everything
? 42
: foo;
```

Examples of additional **correct** code for this rule with the `{ "overrides": { "?": "ignore", ":": "ignore" } }` option:
Expand Down