[SERVER-27007] JavaScript linter poorly formats generator functions Created: 11/Nov/16  Updated: 29/Aug/23  Resolved: 29/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Kyle Suarez Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Done Votes: 0
Labels: clang-format, platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Development Platform
Operating System: ALL
Participants:

 Description   

Generator functions aren't formatted in a sane manner. Here's an example of how an anonymous generator function would be formatted with the current formatting rules:

-    docs: function *() {
-           for (let i = 0; i < 100; i++) {
-               yield {};
-           }
-    },
+    docs: function *
+        () {
+            for (let i = 0; i < 100; i++) {
+                yield{};
+            }
+        },

Specifically, I'm requesting that both the asterisk/newline spacing be fixed to one line, and another space added between the yield keyword and the subsequent expression.



 Comments   
Comment by Alex Neben [ 29/Aug/23 ]

This has been fixed in a new version of clang format

Comment by Kyle Suarez [ 14/Nov/16 ]

justin.cohler – yes, the mongo shell does indeed parse it correctly!

Comment by Mark Benvenuto [ 14/Nov/16 ]

Fixed in Clang 4.0

https://github.com/llvm-mirror/clang/commit/51b10ccf7ab813af35c2e3d1e3c52f3f95006fc4

Comment by Justin Cohler [ 14/Nov/16 ]

kyle.suarez is the formatted js still syntactically correct?

Generated at Thu Feb 08 04:13:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.