Closed chytreg closed 10 years ago
Using underscore for methods would mix with camelCased methods in e.g. angular (like isObject
), so it's quite ease choice for me here.
For variables it is harder. My inclination is to use camelCase (as in ruby we use underscores both in methods and variables), but I wouldn't die defending this proposal :)
Fine for me. It's easier to distinguish variables from functions.
How about https://github.com/apotonick/roar/issues/57 ?
No one sane uses camel case in JSON.
JavaScript community is insane imho.
On Sun, Feb 16, 2014 at 3:53 PM, Tymon Tobolski notifications@github.comwrote:
How about apotonick/roar#57 https://github.com/apotonick/roar/issues/57?
— Reply to this email directly or view it on GitHubhttps://github.com/monterail/guidelines/issues/193#issuecomment-35198539 .
The only thing I'm afraid some other libraries use camel case for variables so it would be inconsistent.
On Sun, Feb 16, 2014 at 3:55 PM, Adam Stankiewicz sheerun@sher.pl wrote:
No one sane uses camel case in JSON.
JavaScript community is insane imho.
On Sun, Feb 16, 2014 at 3:53 PM, Tymon Tobolski notifications@github.comwrote:
How about apotonick/roar#57 https://github.com/apotonick/roar/issues/57?
— Reply to this email directly or view it on GitHubhttps://github.com/monterail/guidelines/issues/193#issuecomment-35198539 .
Just one random example - https://github.com/brianreavis/selectize.js/blob/master/docs/usage.md everything is camelCased. The biggest issue I can see in returning camelCased fields from API is that often those same fields are used for updates so they would need to be converted back and forth to make rails happy. Personally I would leave it as is - write js in camelCase and treat under_scored properties as a hint that they are part of the JSON API
@Ostrzy @thion @szajbus ?
I like the idea.
Camel case for all JS, except for JSON API.
I just reviewed some of the JS code I have written lately and it more or less following this conventions.
JSON API should be rather wrapped in service anyway, so maybe it's good idea
On Sun, Feb 23, 2014 at 11:33 PM, Michał Szajbe notifications@github.comwrote:
I like the idea.
Camel case for all JS, except for JSON API.
I just reviewed some of the JS code I have written lately and it more or less following this conventions.
— Reply to this email directly or view it on GitHubhttps://github.com/monterail/guidelines/issues/193#issuecomment-35846310 .
PR?
I like idea: variables -> underscore, methods -> camelcase
I like idea: variables -> underscore, methods -> camelcase :+1:
Two naming conventions for better consistency? Seriously? I think in JS everything should go camelCase.
:-1: For underscore variable names. Only JSON is underscore.
I stand with "Personally I would leave it as is - write js in camelCase and treat under_scored properties as a hint that they are part of the JSON API"
I would go with camelCase.
I like idea: variables -> underscore, methods -> camelcase
:+1: Easy to remember, consistency with all things we get form api and send to api. I won't fight for this much, but I give :-1: for other concepts presented here.
+1 for using only camel case convention
Any more comments? If not I'm going to close this with "camelCase for everything, except JSON" at the end of this week.
/cc @monterail/dev
How do you deal with the naming in CoffeeScript? Do you use underscore as in Rails or camelCase as the Javascript prefer?
I tried to use in my latest Angular app to use JS convention and have some naming mismatch. Example
Maybe variable write using underscore convention but functions in camelcase
So I would have