Closed alessioalex closed 9 years ago
That argument is regarding standard
trying to be the code style. I have no such goal. I just made XO after my code style, but I still allow other options, like spaces, for pragmatic reasons so other people can use it too. The reality is that the JS community is just too diverse and opinionated to create one code style. My goal is just to make it easier for me and people wanting to use this code style (or spaces by setting the spaces
option).
Any suggestions on how I can make that clearer?
Oh I see. That's perfectly fine, I was thinking that your goal was the same as standard
(one to rule them all). I guess you can specify what you just posted here inside the readme somewhere.
XO is more pragmatic and has no aspiration of being the style
The readme is pretty clear to me.
@kevva Yup. I still want rework that paragraph though. Keeping this open until then.
@sindresorhus I'm just curious. What choices do you think standard
made wrong, i.e. what popular rules do they not follow do you mean? If it's only the semicolons there's semistandard
for that...
@joakimbeng I don't remember them all from memory, but it was at least semicolons, space after function name function foo () {}
, lax use of braces. Good overview of differences between standard
and XO rules here: https://github.com/feross/standard/issues/216#issuecomment-127569835 As you can see, XO is a lot stricter. My personal preference is strict non-ambiguous readable code.
@sindresorhus thanks! I'm with you on the strictness! Then I'm convinced, XO is the one I'll stick to :)
That space after function thing really bugs me. I just can't stomach function myFunc () {}
, but I like the space when there's no name. function () {}
.
Just goes to show that Standard (while a great idea) is poorly executed, and there are just too many diverse opinions to have a standard on code style. Let's have standard on things that really matter.
Sorry for the rant!
@joakimbeng the semi-colons thing is a big one for me personally. I want to know when a statement is finished; it adds a wee bit of cognitive load reading source, imo.
@therealklanni just being clear, there isn't a space after the name of a function; only the function
keyword, which means a space between function
and ()
in the event it's anonymous.
@Qix- I was referring to Standard:
Space after function name
function name (arg) { ... }
@therealklanni Aha gotcha.
I've improved the section on how it differs from Standard: https://github.com/sindresorhus/xo#why-not-standard
Reading the FAQ you said that
standard
didn't pick the most popular style, but spaces are widely preferred over tabs. Can you make this switch so it can just be "the default standard"? :)