cozy-labs / cozy-light

Personal Server Made Easy
http://cozy-labs.github.io/cozy-light/
GNU Affero General Public License v3.0
104 stars 13 forks source link

Set a javascript lint configuration for the project #9

Closed frankrousseau closed 10 years ago

frankrousseau commented 10 years ago

Contributions don't follow the same code style as the core code. We should add a javacript lint configuration, stick to it and made it mandatory for any code contribution.

maboiteaspam commented 10 years ago

I did proposal PR about that. Hope it s fine.

I adjusted standard jshint with those noticeable values

  "latedef": false,
  "undef": false,
  "unused": false,
  "multistr": true,
  "esnext": true,
frankrousseau commented 10 years ago

Ok I don't know well available javascript linting rules, so I need to study them before going further. I come back to you very soon about that subject.

frankrousseau commented 10 years ago

What do you think about ESLint? http://eslint.org/docs/rules/

It looks to have a lot more rules.

maboiteaspam commented 10 years ago

seems real good, reading the README is engaging, and the doc is much more confortable to read. +1

Running it again the source code is, again, much more confortable to read.

This said, it triggers much more issues than JSHINT, such 509:10 error Don't use process.exit(); throw an error instead no-process-exit

Which i think, none of, the current solution, nor the error throw method are right way to do : / the process should stop naturally when resources gots closed.

Also it needs to change cozy-light binary file and append it a .js extension, otherwise, somehow, eslint does not parse it at all.

besides that, i confirm my first feeling, it s real good !

my 2 cents.

frankrousseau commented 10 years ago

Ok ESLint is now used to lint the code. It's stricter but it pushes to write better code.

maboiteaspam commented 10 years ago

great ! I d sggest also to revise all the callback to respect node standard always passing err first : (err, extraarg1...)

frankrousseau commented 10 years ago

:+1: