begriffs / css-ratiocinator

because your CSS is garbage
MIT License
1.03k stars 49 forks source link

switch to jshint #39

Closed losingkeys closed 11 years ago

losingkeys commented 11 years ago

reasons:

NOTE: The 'jslint' comments at the top are now moved into a project-specific '.jshintrc' json file. The global comments can still be used to identify external variables in each script, with the only difference being browser: true in '.jshintrc' may be a little different than browser: true in the jslint comments (they both define a list of globals specific to the browser iiuc), but this wasn't an issue for any of the files I've updated (those with 'jslint' comments).

NOTE: I've checked the changed files, and they all (with a small change to the indentation in lib/css.js) pass without warnings or errors.

As a final note, I've changed '.travis.yml' so it should still test the javascript files for compliance w/jshint

begriffs commented 11 years ago

This is interesting. I like that you can make a jshint config for the whole project.

On the other hand, one thing I like about jslint is that it is very strict. It doesn't tolerate much variation in syntax and everything is an error. I feel like it might force a more consistent style from contributors, even if that style is a little odd at times.

Check out this answer on stack overflow: http://stackoverflow.com/a/10763615

Do you think jshint's options allow you to crank up the strictness beyond jslint? The stricter the linter the more coherent the style.

losingkeys commented 11 years ago

I think you could crank up the strictness on jshint; if you're looking for something specific the options would probably help. This was mostly me learning about linters in javascript, but I ended up liking jshint because of the reasons above. Another thing to consider is the communities surrounding the two tools. Have a look at the jslint and jshint repositories for more info. Finally, if you like jslint, don't switch; It's not like I'm going to check in code that doesn't comply w/whatever you choose just because I would've chosen a different tool. I won't be sad if you close as 'WFM/WONTFIX' :P

losingkeys commented 11 years ago

Cheers, remember to crank up the strictness to your liking!

begriffs commented 11 years ago

It cranks up pretty well actually. (e0f36d2287918cfbe0d77504df75f048d55060da) Found some cruft that jslint had missed.

I'm glad you pushed me to use jshint.

losingkeys commented 11 years ago

I'm glad you like it. Note that you can have a "globals": {} object in your .jshintrc if you have some globals that will appear in all files. Alternatively you can use predefined sets of globlas (like in jslint), which don't go in the globals array, like "jQuery": true. Or you can keep em per-file, which is kind of an ok header.