Of course! https://twitter.com/mathias/status/247708186696634368
(No, there is not even a performance difference ā¦ http://jsperf.com/single-quote-vs-double-quote/3 )
Of course! https://twitter.com/mathias/status/247708186696634368
(No, there is not even a performance difference ā¦ http://jsperf.com/single-quote-vs-double-quote/3 )
Any such reason for preferring
'
in JS?
None, it is just personnal preference. And I prefer using " "
for class or id when I define inline HTML, so this prevent quotes collision and usage of \"
.
Edit : yeah, just like @faldrian
Also, about JS, I like JSON rather that function()
for object definitions :
JSON :
var object = {
var1: 'var',
var2: 'var also'
}
Function definition :
var object = function(){
var1 = 'var';
var2 = 'var also;
}
Prettier and easier to read.
Would be nice to set option multistr
to true, Milou bothers me with that >.<
The JSHint docs say
Multi-line strings can be dangerous in JavaScript because all hell breaks loose if you accidentally put a whitespace in between the escape character () and a new line.
I didnāt know that. Canāt wait for ES6ā¦
So, shall we put mandatory comments to a vote?
Since we exchanged arguments with pretty much no effect, this might be a good idea.
I think so.
To me, proposition should at least include these elements :
mandatory comments required for eavery PR
at least for functions that are above 3 lines.
Thatās contradictory, please clarify.
at least for JS code
All or nothing, doing it for part of the code base and for another part not is just worse.
I say at least, now if we vote fore mandatory comments and you think itās better to
Thatās contradictory, please clarify.
Every new function has to be documented unless it is obvious (less than 3 instructions) eg. this is obvious and this too.
I consider as an instruction any call of method. So, if thereās chained methods call, each call is an instruction. Eg :
var.call1().call2().call3().call4()
is 4 instructions. But Iād like to limit a too big number of chained call (not more than 4, maybe ?) if possible.
Also, about SCSS is nesting limit relevant ?
Thatās way too vague, you canāt measure complexity in LoC or calls.
Itās just a proposition, I donāt see any other easy way to measure it. Itās not useful to put mandatory comments for very obvious case, but we need a clear rule to determine what is ovious and what is not.
I donāt like rules and hard limits where none are necessary. It is already possible to look through new pull requests and add comments like āhmā¦ big block of code, care to comment some of that?ā - if the developer not already has done so.
We all want to write good and understandable code - if there are people who have hints how to make code better understandable, they can say so in the PRs.
I think the solution to documentation issues will more likely be solved by communication and external documentation than by enforcing arbitrary rules on the structure of new code.
Letās focus more on gettings things done here than setting up a ruleset to play byā¦ (that wonāt be used if people donāt see the purpose of it).
Iām totally with Faldrian. Since there obviously are no simple rules to determine when a mandatory comment should be placed, do you still hold to wanting them?
We have to find how to better document the code. This is the solution I found. If Iām the only one on this, of course it will never be accepted.
But the problem is still here : the code is still abstruse. So, no matter what, we need a solution on this.
When the styleguide is set, what if I set up a RubyMine inspection file for the official repo ?
But the problem is still here : the code is still abstruse. So, no matter what, we need a solution on this.
The way forward is to make it less abstruse, not to bury the clear parts in comments.
When the styleguide is set, what if I set up a RubyMine inspection file for the official repo ?
I donāt use RubyMine, so maybe. We will most likely add the above mentioned linters with configs that match the styleguide as good as possible and enable Hound.
I donāt use RubyMine, so maybe. We will most likely add the above mentioned linters with configs that match the styleguide as good as possible and enable Hound.
BTW, RM supports JSHinter and JSLinter.
JSLint is a bunch of cr*p. Itās too harsh for any sane person. JSHint is the way to go, I guess. I think comments should be optional, but each file should at least have a comment, explaining what itās trying to do in the system, why itās needed there. But this can be enforced when accepting PRās, thereās no need for a linter to check it.
Regarding SCSS - Itās a mess right now. Iāve been thinking a lot about it, and itās a difficult problem.
I propose to use the SMACSS approach and use these rules to separate the selectors:
https://smacss.com/book/categorizing
We should have 5 folders and a file:
base
layout
_layout.scss
the same rules as before
module
state
themes
default (a folder)
default
folder, itās something weird with loomio markdown)application.scss
@import ābase/baseā, ālayout/layoutā, āmodule/moduleā, āstate/stateā;
@import āthemes/cerulean/_mainā; (changed the theme to cerulean)
@dumitruursu We already use JSHint.