Soonad / moonad.org-old

Website for Moonad
http://provit.fm
MIT License
4 stars 0 forks source link

refactor: code style and dead code #1

Closed bamorim closed 5 years ago

bamorim commented 5 years ago

Adds some code quality tools with some configs. It also removes some dead code and commented code.

About styling

Important: I dropped the comma-first (even though I like it) because it's kind of hard to get it working correctly on linters and formatters on JS land, and it's completely different from what the rest of JS community does.

The only thing that @MaiaVictor told he doesn't want to change is about snake_case vs camelCase. He really wants our variables and properties to be snake_cased. The downside to this is that it won't be consistent with the rest of the JS community. The upside to this is that it will be easier to differentiate from our code and third-party code, given that most third party code will be camelCased and our would be snake_cased. The other upside is that, in my opinion (and according to some studies), snakecase is way more readable (because the gives a better separation so our brains can read the words separately faster, comparing to have to find uppercase characters).

As for the rest, I didn't cared too much about, I just want to have some consistency across our code and use a linter to catch possible errors early on.

As for semicolon, we (me and Victor) opted for always having them, since some JS code can be erroneously interpreted without semicolons.

I also added two npm scripts: format and lint. format will run prettier-eslint --write which runs eslint and prettier and save the fixes. lint will just run eslint and prettier-eslint checking the differences. So it has a exit code != 0 when the code is not right. This is inteded to be used by a CI worker (I'll add that in another PR).

VictorTaelin commented 5 years ago

I'm fine with this as an experiment, just fix the comment alignment and let's see how it works in practice.