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

benchmark,lib: var to const #26915

Closed
wants to merge 1 commit into from
Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Mar 26, 2019

This came up recently again. I just ran a modified eslint rule against lib and benchmark and I have no strong opinion about actually doing this and I am absolutely fine with closing this again. It's just there to resolve a comment in the referenced PR.

Note: I did not update any eslint rules as there is no explicit rule to do this. Instead, I just modified the prefer-const rule to match against var instead of let.

Refs: #26679

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

@BridgeAR BridgeAR requested a review from Trott March 26, 2019 04:24
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Mar 26, 2019
@gengjiawen
Copy link
Member

I am +1 on this.
Any thought on var to let ? Maybe in the end ,we can add https://eslint.org/docs/rules/no-var.

Copy link
Member

@tniessen tniessen left a comment

Choose a reason for hiding this comment

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

I know we have shot these PRs down multiple times, but this one is only 343 lines and if that's all it takes to make all possible varconst replacements, I think we should do it.

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 26, 2019
@Trott
Copy link
Member

Trott commented Mar 26, 2019

Note: I did not update any eslint rules as there is no explicit rule to do this. Instead, I just modified the prefer-const rule to match against var instead of let.

const and let have the same scoping rules so that ESLint rule makes sense. But var is different. Is there a chance that this introduces subtle bugs where some code expects a variable to be hoisted but now it isn't? I'm guessing there isn't a problem because all the tests are passing, but an extra careful eye in review and maybe even a CITGM run might be worthwhile. (Not saying it's semver major--just saying extra test exercising via CITGM might be a good extra-cautious measure.)

@BridgeAR
Copy link
Member Author

@Trott eslint itself should warn in case the scope is not correct anymore. There could in theory also be changes that can not be auto detected but that's unlikely. Especially with our test suite.

@Trott
Copy link
Member

Trott commented Mar 26, 2019

@Trott eslint itself should warn in case the scope is not correct anymore.

Ah, yes, of course.

There could in theory also be changes that can not be auto detected but that's unlikely. Especially with our test suite.

👍

@BridgeAR
Copy link
Member Author

Rebased due to conflicts.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 29, 2019

@targos
Copy link
Member

targos commented Mar 30, 2019

Landed in f86f573

@targos targos closed this Mar 30, 2019
targos pushed a commit that referenced this pull request Mar 30, 2019
Refs: #26679

PR-URL: #26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@BridgeAR BridgeAR mentioned this pull request Apr 1, 2019
2 tasks
BethGriggs pushed a commit that referenced this pull request Apr 5, 2019
Refs: #26679

PR-URL: #26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
BethGriggs pushed a commit that referenced this pull request Apr 8, 2019
Refs: #26679

PR-URL: #26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
@BethGriggs BethGriggs mentioned this pull request Apr 9, 2019
@ZYSzys ZYSzys mentioned this pull request Jun 6, 2019
2 tasks
@BridgeAR BridgeAR deleted the var-const branch January 20, 2020 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants