Once upon a time
you can jump over that section it's merely an introduction of what has led me to adopt standardjs
It wasn't enough though. I quickly moved on to JSHint, later to JSCS and to ESLint with each time a new set of recommendations and some change to my coding style and habits. It is worse noting that most of these tools were actually a great help to polish my skills little by little each of them providing finner and finner warnings.
What's the link with Standard.js?
Recently, I've been working on 3 different freelance projects all using different configuration of ESLint... Why are we doing that to ourselves when there is a single style without config (a.k.a divergences) readily usable!
By using one single config for all the JS code out there no more time spent configuring an IDE, no more time "configuring" our brain to read and write the code according to this or that style.
The ultimate rules!
As said previously, standardjs makes opinionated yet fully justified choice regarding the coding style. You may not agree with all of them but it doesn't matter! (I disagree with many exceptions of the French language but I still accept them :x).
Here are the "main" ones:
- no unused variable: it always drive me nuts when I review some code to see them... I become a game of guessing, what that supposed to be used somewhere? Should I delete the whole stuff?
- plenty of aesthetic decisions that helps make the code clearer
Globally there is nothing out of the ordinary in there. Most of these rules are already applied by most of the good coding styles out there. The most important change however is yet to be introduced.
Getting ride of the semicolon
Perhaps the most important change when switching to standardjs is to stop putting
; all around the place. We don't need it! If you doubt it, go read this and that.
When I read it for the first time I paused for a second and asked myself why I had always put some? 'cause I was coming from Java and Java forced me to... Right but other than that? No idea.
Moreover, how many lines of code do we type everyday? sparing that one key press if helping greatly to reduce the stress and repetitive strain injury risks to our right ring finger. Ain't it great?
Just a few more words
A few notes to conclude this totally biased post:
- standard is totally compatible with ES6!
- there is an effort toward porting standard to the TypeScript world
- you don't need to agree with me but please give standard a try :D
Top comments (0)