From c41de382a330d4789488fd2dcf6db5a3163bb5d2 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Tue, 7 Apr 2020 02:10:25 +0200 Subject: [PATCH] Docs: fix curly multi-or-nest examples with comments (refs #12972) (#13151) --- docs/rules/curly.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/rules/curly.md b/docs/rules/curly.md index 9f4df27353c..aecbca5576e 100644 --- a/docs/rules/curly.md +++ b/docs/rules/curly.md @@ -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: @@ -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