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

test: change to arrow functions in send-bad-arguments #23483

Conversation

@annatangzhao
Copy link
Contributor

annatangzhao commented Oct 12, 2018

Part of Code and Learn workshop at Node + JS Interactive!

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
@@ -28,17 +28,17 @@ const buf = Buffer.from('test');
const host = '127.0.0.1';
const sock = dgram.createSocket('udp4');

assert.throws(function() {

This comment has been minimized.

Copy link
@trivikr

trivikr Oct 13, 2018

Member

Since the function contains only one statement, the curly brackets are not required here and other places in the code.
That means, () => { sock.send(); } can be () => sock.send()

This comment has been minimized.

Copy link
@Trott

Trott Oct 14, 2018

Member

In my opinion, the brackets should not be removed in this situation. They should only be removed if the arrow function is explicitly returning a value (in my opinion).

This comment has been minimized.

Copy link
@Trott

Trott Oct 14, 2018

Member

In other words:

() => { return foo(); } should be changed to () => foo(); but () => { foo(); } should be left as-is, in my opinion. Otherwise, someone reading the code is left wondering if the fact that the arrow function is returning a value is a result of the author wanting to omit the brackets for the sake of omitting the brackets or if it's because the function is meant to return a value.

@Trott Trott mentioned this pull request Oct 14, 2018
@Trott

This comment has been minimized.

@Trott

This comment has been minimized.

Copy link
Member

Trott commented Oct 15, 2018

Landed in 6783eed

@Trott Trott closed this Oct 15, 2018
Trott added a commit to Trott/io.js that referenced this pull request Oct 15, 2018
PR-URL: nodejs#23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
burgerboydaddy added a commit to burgerboydaddy/node that referenced this pull request Oct 17, 2018
PR-URL: nodejs#23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
jasnell added a commit that referenced this pull request Oct 17, 2018
PR-URL: #23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
addaleax added a commit that referenced this pull request Oct 20, 2018
PR-URL: #23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
MylesBorins added a commit that referenced this pull request Oct 30, 2018
PR-URL: #23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
@codebytere codebytere mentioned this pull request Nov 27, 2018
rvagg added a commit that referenced this pull request Nov 28, 2018
PR-URL: #23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
MylesBorins added a commit that referenced this pull request Nov 29, 2018
PR-URL: #23483
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
@codebytere codebytere mentioned this pull request Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.