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: fix curly multi-or-nest examples with comments (refs #12972) #13151

Merged
merged 1 commit into from Apr 7, 2020
Merged
Changes from all commits
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
16 changes: 12 additions & 4 deletions docs/rules/curly.md
Expand Up @@ -181,10 +181,6 @@ while (true) {
for (var i = 0; foo; i++) {
doSomething();
}

if (foo)
// some comment
bar();
```

Examples of **correct** code for the `"multi-or-nest"` option:
Expand Down Expand Up @@ -214,6 +210,18 @@ while (true)

for (var i = 0; foo; i++)
doSomething();
```

For single-line statements preceded by a comment, braces are allowed but not required.

Examples of additional **correct** code for the `"multi-or-nest"` option:

```js
/*eslint curly: ["error", "multi-or-nest"]*/

if (foo)
// some comment
bar();

if (foo) {
// some comment
Expand Down