You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need consistent formatting of code and we should define it very explicitly. We can always do cleanup commits, or even have someone specifically assigned to do code cleanup.
Something I'm not quite sure about is the use of camel case vs underscore, which I think carries over from java. Jquery has it in it's guidelines, but it's imo much harder to read. Which casing should we adopt?
IMO, camel case. Thinking in the future here, if we use underscore.js (_(stuff).func()) or some sort of i18n (usually seen as __('Some string here.')), the extra underscores from variable names might confuse some.
I would recommend basing a lot of it on idiomatic.js, which is what I kind of follow already albeit with some white space changes.
I don't mind which style guide we choose, as long as make use of tabs (instead of spaces). With tabs I can choose my own size (2, 4, 8, ...), which is 4 for me personally.
Agreed, I propose we use tabs for indentation, and spaces for alignment of anything else after the indentation is correct, should we need to align anything.
Agreed, I propose we use tabs for indentation, and spaces for alignment of anything else after the indentation is correct, should we need to align anything.
I despise tabs, and so does most of the open source community from my experience. Challenge: find a popular open source project that uses tabs for indentation. Also the tab width on GH is huge so our code will look like shit here. Also, this is another barrier to entry. Spaces work everywhere, but tab width must be set where ever (if even possible) you plan to view the code.
Find a proper source code editor that will add the appropriate number of spaces when you hit the tab button (I know Notepad++ supports this). If this is a must have for you guys, I will write a node script that converts tabs to spaces and vice versa.
Also, I vote for the Greasemonkey style guidelines, with a few exceptions for the parts that apply to Firefox addon development.
@joesimmons What do you think? (I hope tagging a user brings it to their attention)
Can we use Douglas Crockford's code conventions?
It's idiomatic, from what I understand of that word.
I'm for using spaces. I used to use tabs but spaces are actually better.
Notepad++, as sizzle said, can replace tabs (as you type them) with a certain # of spaces.
I really like indentation to be 4 spaces, as it's clear to me when a block is indented. I could use 2, but I'd have to switch back and forth all the time when developing for the site, and developing my own scripts.
We could look into integrating an editor config to simplify things--there are plugins for all major text editors by the looks of it. This would fix any issues with tabs, line endings, and EOF newlines.
Most of all, I want to avoid any major debate between tabs and spaces. As we don't have a unified opinion, let's find a middle ground--editorconfig should help.
For clarification, I am OK with GM style guide aside from the space/tab issue.
I agree with all that, but it's very similar to the Greasemonkey style guide.
I really like indentation to be 4 spaces, as it's clear to me when a block is indented. I could use 2, but I'd have to switch back and forth all the time when developing for the site, and developing my own scripts.
I like using 2 spaces because you indent 4 spaces for a statement that continues onto the next line. If we use 4 spaces, that means 8 spaces on a continuation and it will quickly explode.
We could look into integrating an editor config to simplify things
So we just plug this into our editor of choice and it saves the files according to the defined guidelines? That page doesn't explain it very well.
Activity
jerone commentedon Nov 7, 2013
We can look at existing style guides, like the one from jQuery: http://contribute.jquery.org/style-guide/
simonzack commentedon Nov 7, 2013
Something I'm not quite sure about is the use of camel case vs underscore, which I think carries over from java. Jquery has it in it's guidelines, but it's imo much harder to read. Which casing should we adopt?
cletusc commentedon Nov 7, 2013
IMO, camel case. Thinking in the future here, if we use underscore.js (
_(stuff).func()) or some sort of i18n (usually seen as__('Some string here.')), the extra underscores from variable names might confuse some.I would recommend basing a lot of it on idiomatic.js, which is what I kind of follow already albeit with some white space changes.
jerone commentedon Nov 7, 2013
I don't mind which style guide we choose, as long as make use of tabs (instead of spaces). With tabs I can choose my own size (2, 4, 8, ...), which is 4 for me personally.
cletusc commentedon Nov 7, 2013
Agreed, I propose we use tabs for indentation, and spaces for alignment of anything else after the indentation is correct, should we need to align anything.
simonzack commentedon Nov 7, 2013
Same here, I absolutely love tabs.
sizzlemctwizzle commentedon Nov 7, 2013
I despise tabs, and so does most of the open source community from my experience. Challenge: find a popular open source project that uses tabs for indentation. Also the tab width on GH is huge so our code will look like shit here. Also, this is another barrier to entry. Spaces work everywhere, but tab width must be set where ever (if even possible) you plan to view the code.
Find a proper source code editor that will add the appropriate number of spaces when you hit the tab button (I know Notepad++ supports this). If this is a must have for you guys, I will write a node script that converts tabs to spaces and vice versa.
Also, I vote for the Greasemonkey style guidelines, with a few exceptions for the parts that apply to Firefox addon development.
@joesimmons What do you think? (I hope tagging a user brings it to their attention)
joesimmons commentedon Nov 7, 2013
Can we use Douglas Crockford's code conventions?
It's idiomatic, from what I understand of that word.
I'm for using spaces. I used to use tabs but spaces are actually better.
Notepad++, as sizzle said, can replace tabs (as you type them) with a certain # of spaces.
I really like indentation to be 4 spaces, as it's clear to me when a block is indented. I could use 2, but I'd have to switch back and forth all the time when developing for the site, and developing my own scripts.
cletusc commentedon Nov 7, 2013
We could look into integrating an editor config to simplify things--there are plugins for all major text editors by the looks of it. This would fix any issues with tabs, line endings, and EOF newlines.
Most of all, I want to avoid any major debate between tabs and spaces. As we don't have a unified opinion, let's find a middle ground--editorconfig should help.
For clarification, I am OK with GM style guide aside from the space/tab issue.
sizzlemctwizzle commentedon Nov 7, 2013
jerone commentedon Nov 7, 2013
And so starts the big spaces versus tabs discussion :)
As it stands now, we have:
cletusc commentedon Nov 7, 2013
That's the idea I think. I'll look more into it when I get home, but jQuery uses it and I'm sure many others as well. It's a good idea if it works.
What I was trying to avoid... :P
sizzlemctwizzle commentedon Nov 7, 2013
I thought this debate was settled before I was even born, but apparently I was wrong. I thought we were all spacemen by now.
Well if it works, then win-win.
jerone commentedon Nov 7, 2013
Does Node.js has a style guide?
sizzlemctwizzle commentedon Nov 7, 2013
It's written in C++.
14 remaining items
Remove straggling trailing commas in objects
Clarification of commas a bit more.
Some strong emphasis and additions/clarifications for OpenUserJS#19
Merge pull request #213 from Martii/Issue-19StyleGuide
Create STYLEGUIDE.md
Loosen up the death grip on OpenUserJS#19 with `switch`
Go with GM styled comment requirement of `// fallthrough` syntax inst…
More symmetry with the styleguide of indent with 2 spaces in the STYL…
Missed symmetry on 2 indention spaced example.
Add recommendation for `setTimeout` from OpenUserJS#208
Merge pull request #245 from Martii/Issue-19StyleGuide
Some misc STYLEGUIDE.md conformance in `.../scriptStorage.js`