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

repl: named anonymous functions in repl.js #21765

Closed
wants to merge 1 commit into from

Conversation

babamihai
Copy link

refs: #8913

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Jul 11, 2018
@jasnell jasnell changed the title http: named anonymous functions in repl.js repl: named anonymous functions in repl.js Jul 11, 2018
@trivikr
Copy link
Member

trivikr commented Jul 11, 2018

Thank you @babamihai for your first PR in Node.js core! 🎉

CI: https://ci.nodejs.org/job/node-test-pull-request/15804/

@@ -1401,7 +1401,7 @@ function _turnOffEditorMode(repl) {
function defineDefaultCommands(repl) {
repl.defineCommand('break', {
help: 'Sometimes you get stuck, this gets you out',
action: function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name corresponds to the property name here so this is not really anonymous. The new name is more accurate though. Maybe use defineCommandBreakAction for consistency?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter enforces the same name. So all these functions can only be named action.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, it might make sense to use the shorthand syntax:

{
  action() {}
}

@@ -1466,7 +1466,7 @@ function defineDefaultCommands(repl) {

repl.defineCommand('load', {
help: 'Load JS from a file into the REPL session',
action: function(file) {
action: function defineDefineCommandLoadAction(file) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defineCommandLoadAction ?

BridgeAR
BridgeAR previously approved these changes Jul 12, 2018
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the comments addressed.

@BridgeAR BridgeAR dismissed their stale review July 12, 2018 22:59

The CI prohibits the different names.

@trivikr
Copy link
Member

trivikr commented Jul 18, 2018

@babamihai Can you please address the comments and update the PR as documented here

@maclover7 maclover7 added the wip Issues and PRs that are still a work in progress. label Jul 20, 2018
@maclover7
Copy link
Contributor

@babamihai Thank you for the PR! Closing due to inactivity. If you'd like to come back this, just reopen or leave a comment here. Please feel free to ask for any help you need in getting this over the finish line.

@maclover7 maclover7 closed this Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem. wip Issues and PRs that are still a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants