Closed cdelahousse closed 11 years ago
Imported comment by cdelahousse from 2012-07-13T17:58:21Z *
Things Simon, Bhee and I have agreed upon:
For CSS, classes and ids are lowercase with dashes for spaces Example:
Imported comment by spratt from 2012-07-14T22:05:16Z *
I've assigned this to Bhee. The first draft is mostly done, but it would be good to get Alexis' input before we submit it.
Imported comment by Gankro from 2012-07-15T03:02:29Z *
I'm not a fan of blha-balh-blah. For strictly emotional reasons. Regardless I have complied.
Imported comment by bheesham from 2012-07-15T03:41:51Z *
Check out my fork. I committed our progress on the standard so far (see CODING).
Imported comment by Gankro from 2012-07-15T03:54:08Z *
I would maybe suggest inverting the quotation marks. blah='what' for html, blah="what" for js.
That seems more natural to me. I feel like XML-like things favour single quotes, and C-Style languages prefer double quotes for genuine strings. Also when doing jquery $("
I like the start continuations with "," thing, but honestly I kind of feel like having
var x=0 ,y=5 ,z=2
is bad design to begin with.
var x=0; var y=0; var z=0;
is more robust and readable, in my opinion. Adding or removing a variable anywhere does not effect any other line.
However in foo(x ,y ,z);
I can see this being reasonable. I think it's ugly though. So I have mixed feelings. I do however recommend indenting continuations one level. So I would perhaps have
foo(x, y, z);
Which is more clear from a macro perspective of just passing over the code quickly.
Imported comment by cdelahousse from 2012-07-15T04:24:56Z *
The reason we have one var statement with continuations is because of variable hoisting. It may be bad design, but it's a convention that you see in a shitload of well written javascript. Both JShint and JSlint will complain if you don't have all variable declarations on one line up top.
var x = 0
, y = 'blah'
, z;
The only thing that's different about the above are the commas on the left. I suggested that because I saw it in a buncha node js scripts I've using, namely ExpressJS. At first I didn't like it very much, but it is growing on me. I'm not too partial to it, so I wouldn't mind having the commas on the right.
var x,
y,
z;
Tell me, what's more robust about var statements on every line?
About single quotes vs double quotes. Most of the HTML I look through uses double quotes. Google.com, Twitter, the HTML5 Boilerplate, Bootstrap, etc..., all use double quotes. It may be that "XML-ish" things prefer single quotes, but convention dictates double quotes.
I've no opinion about javascript quoting though.
Imported comment by Gankro from 2012-07-15T04:37:23Z *
I am netural to the HTML quotes. I'd be fine with just "double everywhere, unless it's a nested HTML string in javascript, in which case single quote".
More robust var is simply a matter of modularity. If i add or remove a var I don't have to worry about commas or if it's the first or last line in the thing. Also, I feel like chaining together a bunch of unrelated variables is confusing. I might be fine with chaining them like this if they were grouped together by similarity.
E.G. var a, b, c;
var x, y, z;
I also reject all comments by JSlint, which is a petty asshole.
Imported comment by cdelahousse from 2012-07-15T04:48:06Z *
Well, we can disable a lot of JSLint/JSHint's warnings/chirps/complaints. I agree that the defaults are pretty shitty. We still need to lint the code somehow.
The more we talk about this, though, the less I care. So if you want want a var
on every line, I won't complain. What does Bhee and Simon think?
Imported comment by spratt from 2012-07-15T04:55:38Z *
I don't like
var var1='val1' , var2='val2';
or
var var1='val1'; var var2='val2';
But I'd like to know more about variable hoisting before I can really form an opinion.
Imported comment by cdelahousse from 2012-07-15T05:14:31Z *
I need to you 'magically' find a book called Javascript Patterns by Stoyan Stefanov (2010, O'Reilly).
Read pages 14 and 61.
Imported comment by Gankro from 2012-07-15T05:16:53Z *
You're bad at the internet and you should feel bad.
This was resolved. See wiki.
Man, now what am I going to do with all this bikeshed paint?
Imported issue by cdelahousse from 2012-07-13T17:43:43Z Originally opened as https://github.com/SteamedPears/CodeReviewClientMaster/issues/44
Single quotes or double quotes? Tabs or spaces?
Camel case?
Etc...!?