xojs / xo

❤️ JavaScript/TypeScript linter (ESLint wrapper) with great defaults
MIT License
7.66k stars 290 forks source link

If pragmatism then why not spaces instead of tabs? #9

Closed alessioalex closed 9 years ago

alessioalex commented 9 years ago

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"? :)

sindresorhus commented 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?

alessioalex commented 9 years ago

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.

kevva commented 9 years ago

XO is more pragmatic and has no aspiration of being the style

The readme is pretty clear to me.

sindresorhus commented 9 years ago

@kevva Yup. I still want rework that paragraph though. Keeping this open until then.

joakimbeng commented 9 years ago

@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...

sindresorhus commented 9 years ago

@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.

joakimbeng commented 9 years ago

@sindresorhus thanks! I'm with you on the strictness! Then I'm convinced, XO is the one I'll stick to :)

therealklanni commented 9 years ago

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!

Qix- commented 9 years ago

@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.

therealklanni commented 9 years ago

@Qix- I was referring to Standard:

Space after function name function name (arg) { ... }

Qix- commented 9 years ago

@therealklanni Aha gotcha.

sindresorhus commented 9 years ago

I've improved the section on how it differs from Standard: https://github.com/sindresorhus/xo#why-not-standard