-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Use shorter arrow functions where possible #17550
Conversation
For arrow functions that are both simple and short, we can avoid using explicit `return` to shorten them even further without hurting readability. For the `gulp mozcentral` build-target this reduces the overall size of the output by just under 1 kilo-byte (which isn't a lot but still can't hurt).
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/db186b1fe9cf235/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/984a54882fbf44b/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/db186b1fe9cf235/output.txt Total script time: 24.54 mins
Image differences available at: http://54.241.84.105:8877/db186b1fe9cf235/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/984a54882fbf44b/output.txt Total script time: 38.54 mins
Image differences available at: http://54.193.163.58:8877/984a54882fbf44b/reftest-analyzer.html#web=eq.log |
Could we use https://eslint.org/docs/latest/rules/arrow-body-style ? |
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.
Looks good to me, with if possible the suggestion for the ESLint rule from Calixte applied since it'd be nice to enforce this automatically in linting. Thanks!
This manually ignores some cases where the resulting auto-formatting would not, as far as I'm concerned, constitute a readability improvement or where we'd just end up with more overall indentation. Please see https://eslint.org/docs/latest/rules/arrow-body-style
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/5d2e7fa8fe112f1/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/e772e24728127df/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/5d2e7fa8fe112f1/output.txt Total script time: 24.70 mins
Image differences available at: http://54.241.84.105:8877/5d2e7fa8fe112f1/reftest-analyzer.html#web=eq.log |
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.
LGTM. Thank you.
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/e772e24728127df/output.txt Total script time: 40.51 mins
Image differences available at: http://54.193.163.58:8877/e772e24728127df/reftest-analyzer.html#web=eq.log |
For arrow functions that are both simple and short, we can avoid using explicit
return
to shorten them even further without hurting readability.For the
gulp mozcentral
build-target this reduces the overall size of the output by just under 1 kilo-byte (which isn't a lot but still can't hurt).