3 ms·
I started skimming the rules and was like "this all seems fine" and then noticed "no semicolons". YOU'LL PRY THEM FROM MY COLD, DEAD HANDS FIRST
by catpolice 10y ago
I started skimming the rules and was like "this all seems fine" and then noticed "no semicolons".
YOU'LL PRY THEM FROM MY COLD, DEAD HANDS FIRST
- Khao 10y agoI hope they enjoy their subtle and extremely hard to find errors.
- untog 10y agoI alternate between projects with and without semicolons, and I'm yet to run into a single error as a result of omitting a semicolon. I don't understand what kind of code other people are writing that does.
- apo 10y agoCould you cite some examples? It seems that using the rest of the conventions might eliminate many, if not all, of them.
- deleted 10y ago[deleted]
- agency 10y agoThey address this directly - the only edge case with omiting semicolons is starting lines with ( or [ and they check this for you. See: https://github.com/feross/standard/blob/master/RULES.md#semicolons https://github.com/feross/standard/blob/master/RULES.md#semi...
- emodendroket 10y agoThat is a really bizarre choice since I think "no semicolons" is the less popular position by far.
- phpnode 10y agoLet's just say that coupling this preference with the name "standard" is an extremely contentious decision (search the github issues).
- emodendroket 10y agohttps://github.com/Flet/semistandard https://github.com/Flet/semistandard Of course the solution is to create a separate "standard."
- Rick-Butler 10y agoone semicolon to rule them all?
- tbolt 10y agothis is really great.
- andykellr 10y agoThis is great, but I don't like the space between function names and arguments. I'm going to fork this and create my own standard...
- tbolt 10y agono semicolons = no deal
- donatj 10y agoThat's how I felt about spaces instead of tabs. I actually got into a Twitter argument with Brendan Eich over it - he more or less won with the note that the tab key in most web editors switches input.
- distances 10y agoI used to like tabs. Then you have a person or two with different tab widths, and some spaces get mixed in, and the beauty of the idea flies out of the window. I've been all spaces for a long time now.
- exprx 10y agoDifferent tab widths are a non-issue. Sure, the maximum character per line only works for a set tab width, but I take that “problem” over the rigidity (and unsuitability) of spaces as indentation.
- distances 10y agoIt becomes issue when mixed with spaces. Say, aligning function parameters on multiple rows. If the indentation of the second row of parameters is mainly with tabs, and then adjusted to place with spaces, it's suddenly a huge issue. And that will happen. So spaces only for me, thanks.
- donatj 10y agoTabs for indent, spaces for alignment - solves the problem unless you're trying to align across indentation levels, but you probably shouldn't be.
- forthefuture 10y agoI don't know about others but jsbin, codepen, and c9.io all have e.preventDefault on tab because it's trivial and many people still use tab.
- andremendes 10y ago
- deadowl 10y agoMaybe if I was using Python or Ruby. But JS? REALLY ugly practice. Multiple blank lines not allowed? I usually go with two to segment heavily procedural code. The most appalling thing by far though is spaces instead of tabs... what's wrong with this guy?
- vkjv 10y agoI am well aware that we are in the minority when it comes to preferring tabs over spaces in JS, but, as useless as this decision is, I will fight over it the street. It's misplaced passion and I don't care.
- strictnein 10y agoI'll join that fight, unless you want you your tabs showing up as two spaces instead of four. Then we'll have to fight after we take down the spacers. On a slightly more serious note, the benefit of tabs is so clear: everyone can have whatever spacing they want and it doesn't affect anyone else. You just configure your IDE and it looks the way you want it to look. For whatever reason, indenting two spaces makes it hard for me to read code.
- madeofpalk 10y agoI've always found the dislike of tabs to be quite strange. Developers love being explicit and semantic about things, and here we have a character that represents a semantic indent, and there's a huge swath of developers who prefer to go with the airy-fairy presentational space character instead. It even solves the 2-vs-4 debate with allowing each user to render it how they will. Heck, you could even render it as three spaces if you will! It baffles me. Of course, at the end of the day it's just one IDE setting and I don't have to worry about it (we uses spaces at work and it's fine).
- vkjv 10y agoI'm on the fence about this syntax. var foo = 1, foo = 2; The reason being that things will align whether you use a tabs with a width of 2 or 4. I also use spaces for mid-line alignment and tabs exclusively for identation. I think this is called "smart tabs"?
- deleted 10y ago[deleted]