-
Notifications
You must be signed in to change notification settings - Fork 495
[ECMAScript6BestPractices] fix common-serve.js
#2773
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
base: main
Are you sure you want to change the base?
[ECMAScript6BestPractices] fix common-serve.js
#2773
Conversation
Signed-off-by: Vincent Potucek <vpotucek@me.com>
| } | ||
|
|
||
| function getInstanceId() { | ||
| const args = process.argv.slice(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considering this unused coupling as inlineable and cast away like Wilson. also random magic number.
| let instanceId; | ||
|
|
||
| args.forEach(arg => { | ||
| process.argv.slice(2).forEach(arg => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more cohesion less coupling. now the 2 and 1 is kind of related making it a little less magic.
| } | ||
| }); | ||
| }); | ||
| const shutdown = shutdownServer(listener, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considering this unused coupling as inlineable and cast away like Wilson.
| await shutdownServer(listener, { | ||
| forceExit: false, // let the event loop clear | ||
| finally: () => debugLog("graceful shutdown finished."), | ||
| })(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for JS pros—creating a function inline and directly. In my opinion, this is logically equivalent, but I’m not a pro.
| @@ -1,26 +1,26 @@ | |||
| import shutdownServer from 'http-graceful-shutdown'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first things first, also workaround-fixing the comment bug in rewrite.
| import fs from 'fs'; | ||
|
|
||
| // | ||
| // this file will be glued to the top of the specific xy-serve.js file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could undo but making this info a little more bold as this is quite unique imho.
enabler for:
ECMAScript6BestPractices#2768related to:
ECMAScript6BestPracticesendless comment copy bug. openrewrite/rewrite#6330