pagarme / javascript-style-guide

:art: Javascript styleguide followed by us here at Pagar.me
MIT License
50 stars 8 forks source link

Choose which styleguide to use as base #1

Closed mccraveiro closed 7 years ago

mccraveiro commented 7 years ago

Right now we use standard for our core but new projects are using airbnb for better ES6 support. We got choose one as base for this styleguide. Does anyone disagree with airbnb? Changes to the base style are going to be discuss on separate issues.

dalthon commented 7 years ago

"[...] for better ES6 support [...] Does anyone disagree with airbnb?" I spent almost a day reading airbnb a few days ago when I got overwelmed by it, and my biggest issue with it is concerning it's pedantism, for example, enforcing: param => method instead of (param) => method but (param1, param2) => method when more than one param. This is just one, but I noticed that they like to shrink everything when there is a possible syntax... why don't use parenthesys everytime instead of adding exceptions for one param? I disagree with airbnb at a surprisingly high amout of rules, basically because I choose readability over minimization, clarity and flexibility over overspecification... Another example that enrages me is: a*(x-x0) + b, considered "too complex operator usage", they enforce this kind of thing (a*(x-x0))+b so precedence would be "clear"... I thought that clear enough for 7 year boys... The main principle that I would love to follow on a styleguide should code clarity first. Sometimes we achieve it with more bytes, with less exceptions, and sometimes with more freedom, if we could make airbnb follow this basic principle, I could agrre on it.

"Changes to the base style are going to be discuss on separate issues." Ok, that would be a lot of issues... there are a lot of non-sense rules to remove, and I can agree with it after cleaning it a lot.

mccraveiro commented 7 years ago

@dalthon Rules we can adapt (and please, open issues for them). However I'd like to start from a styleguide that was created with ES6 in mind. Standard have few ES6 rules.

In the future we might just drop a base styleguide and have all rules described by ourselves :)

dalthon commented 7 years ago

@mccraveiro sure, I like the idea of a styleguide, and I'm sure that would be a waste of time creating one from zero right now. Probably I sounded too harsh, due to my hate to airbnb linter, but the point I want to raise is: better than just choose a random styleguide, is to choose the principles that we want to follow to materialize it in our styleguide, whatever the choice.

IMO, the main principle should be "code clarity first", with the minimum count of exception rules.

mccraveiro commented 7 years ago

@dalthon I agree with you however I think its too soon to have this discussion. I'll start with some base rules and we can discuss changes later.