3 ms·
If you're going to use JS, you're not allowed to change things like this. It just causes problems for people. Easy solution, use CoffeeScript and have it compi
by nestlequ1k 15y ago
If you're going to use JS, you're not allowed to change things like this. It just causes problems for people.
Easy solution, use CoffeeScript and have it compile down to JS. My favorite feature of CoffeeScript is the ruby/python line conventions spacing (2 spaces, no tabs), and no semicolons.
They're already compiling the CSS from Less. Seems natural to add CoffeeScript to the chain.
- lloeki 15y agoFor the sake of completeness, PEP8 actually says 'Use 4 spaces per indentation level'
- mrspeaker 15y agoHe's not changing anything, and he's not relying on weird browser implementations - it's part of the spec. I hate unnecessary semicolons too. Though I deal with them by including them everywhere, but making them hard to see in my editor ;)
- VMG 15y agoalternatively, use JSLint
- beaumartinez 15y agoI much prefer JSHint. JSLint is draconian, and has some borderline insane decisions (it complains if you don't declare your vars at the top of a block—is this 1980?). And yes, I realise that some of these options can be turned off—but JSHint has better defaults.
- mudetroit 15y agoThere is a reason for the insanity you are complaining about. The vars are effectively hoisted there by the interpreter anyway, by pulling them to the top of the block you remove a possible point of confusion, and more importantly a possible point of bugs.
- bronson 15y agojshint is great. Putting this in ~/.jshintrc makes it a lot more sane: { "browser" : true, "node" : true, "undef" : true, "eqeqeq" : true, "noarg" : true }