This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
f810a5a
commit 1365c3c
Showing
2 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
let x = (y = 1, z = 2); | ||
~~~~~~~~~~~~ [Don't use the comma operator.] | ||
~~~~~~~~~~~~ [0] | ||
|
||
// Error prone: forgot to add parens around arguments. | ||
(x, y => x + y)(a, b); | ||
~~~~~~~~~~~~~ [Don't use the comma operator.] | ||
~~~~~~~~~~~~~ [0] | ||
|
||
foo((bar, baz)); | ||
~~~~~~~~ [0] | ||
|
||
switch (blah) { | ||
case 1, 2: // equals `case 2` - probably intended `case 1: case2:` | ||
~~~~ [0] | ||
return true; | ||
case 3: | ||
return false; | ||
} | ||
|
||
|
||
[0]: Do not use comma operator here because it can be easily misunderstood or lead to unintended bugs. |