-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Added general recommendations #4002
Conversation
docs/style-guide.rst
Outdated
|
||
* Private functions | ||
|
||
It's convention to start private function names with an underscore (`_`). e.g. `_myPrivateFunction` |
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.
I'm not sure about this. Is any project doing this?
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.
This is one project: Crypto Zombies
at lesson 1 chapter 9
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.
There needs to be a bit stronger concensus if we put into the guide claiming it is a convention.
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.
@axic
They probably took it from the fact that it's a convention in languages like Python, PHP and other OOP languages. However in JS since everything is public, there are some discussions wether to do that or not. Also seen in the React and NPM source code.
But I guess any Styling convention comes down to preference really...
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.
And exactly because it comes down to preference I would rather not put naming conventions in a styling guide.
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.
I must say the Function parameter variable names
I have seen in many places and do think it's useful. Maybe we can just scratch out the private function name
one?
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.
The convention in python also comes from the fact that you cannot mark members as private (or at least you were not able to in previous versions). I think PHP is similar.
docs/style-guide.rst
Outdated
TODO | ||
* Function parameter variable names | ||
|
||
It's convention to start function parameter variable names with an underscore (`_`) in order to differentiate them from global variables. e.g. `function myFunction(_foo, _bar) { }` |
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.
This looks good.
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.
Since the format is RST (restructured text), it uses double backticks where Markdown would use one.
I'd rather not add this as a convention, but as a suggestion or guideline. As much as I'm in favor of conventions, I think we should leave this up to the users. |
This recommendation conflicts with the other naming conventions, so I fear we have to close this. |
No description provided.