FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

http: convert var to let or const for http by BeniCheni · Pull Request #26504 · nodejs/node · GitHub

/ node Public

http: convert var to let or const for http - #26504

Closed
BeniCheni wants to merge 2 commits into
nodejs:masterfrom
BeniCheni:let-const-http
Closed

http: convert var to let or const for http#26504
BeniCheni wants to merge 2 commits into
nodejs:masterfrom
BeniCheni:let-const-http

Conversation

Copy link
Copy Markdown
Contributor

Refs #26486

@ BeniCheni Can you put the var -> let/const stuff in a separate commit? (Separate PR would be even better!)

Per this comment in #26486 ☝️ , this PR follows up to convert var variables to let or const, in the scope of http source in lib/ path.

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

nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Mar 8, 2019

mscdex commented Mar 8, 2019

Copy link
Copy Markdown
Contributor

I think we've generally avoided these kinds of commits/PRs and preferred to only update them if you're already affecting those variables because of other changes.

Copy link
Copy Markdown
Contributor Author

@mscdex, thanks for letting me know. Should I then try A) or B) below? Happy to address either way.

A) Revert everything except lib/_http_client.js, which this PR is trying to follow up with the comment in another PR

B) Just close this PR.

jasnell commented Mar 8, 2019

Copy link
Copy Markdown
Member

I generally have no problem with these kinds of changes when done in batch. Lots of small changes like this get noisy.

Copy link
Copy Markdown
Member

i don’t think these changes have more improvements, but add some noisy commits

Copy link
Copy Markdown
Contributor Author

i don’t think these changes have more improvements, but add some noisy commits

@himself65, while it’s true that there are no major improvements, there is an subtle improvement to use “const” over “var” as it will throw an error to “promote” immutability, if a “const” variable’s value is reassigned after its declaration.

Copy link
Copy Markdown
Member

@BeniCheni
this task which change “var” to “const” or “let” should do when refactoring code or add new methods or anything else.
only commit with change “var” is unnecessary i think

BeniCheni commented Mar 8, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

@himself65, this is an actual follow-up per a suggestion from another PR, which is an actual change. (could be traced by 1st comment of this PR) The suggestion was to punt the var => let / const to a separate PR.

BridgeAR commented Mar 8, 2019

Copy link
Copy Markdown
Member

I guess we might just go ahead and accept a couple PRs like this. Otherwise this is going to come up frequently and as soon as we are through with it, we do not have to worry about it anymore.

I am aligned with @jasnell that we should do this as batched change. It is actually quite simple and straight forward to use eslint to auto fix these. Should we just do that?

ZYSzys commented Mar 8, 2019

Copy link
Copy Markdown
Member

Would changes like this make git blame less efficiently ?

BridgeAR commented Mar 8, 2019

Copy link
Copy Markdown
Member

@ZYSzys it adds one more step to find the actual author. Most tools I know / use allow to directly jump to the former blame as well, so I personally do not see this as a big downside anymore.

shisama commented Mar 8, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

@BridgeAR

It is actually quite simple and straight forward to use eslint to auto fix these. Should we just do that?

I agree this. Also, I think it is better to add no-var rule in eslint so that we won't worry about 'var' anymore. However, I think it needs agreement from some collaborators.

BridgeAR commented Mar 8, 2019

Copy link
Copy Markdown
Member

@nodejs/tsc PTAL

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good work! I don’t think this is a good idea just yet. There is still a perf gap in Node 8 when using let, and we still have to do backports there till the end of the year.

Copy link
Copy Markdown
Contributor Author

Thanks for your time and feedback. I’m closing this PR to avoid potential further confusions.

BeniCheni closed this Mar 9, 2019
BeniCheni deleted the let-const-http branch March 9, 2019 00:23
Trott mentioned this pull request Mar 15, 2019
2 tasks
ZYSzys mentioned this pull request Jun 6, 2019
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

10 participants


Back | FazBrowse Home | New Git URL