Giter VIP home page Giter VIP logo

Comments (12)

sindresorhus avatar sindresorhus commented on May 21, 2024 1

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

from xo.

sindresorhus avatar sindresorhus commented on May 21, 2024

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?

from xo.

alessioalex avatar alessioalex commented on May 21, 2024

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.

from xo.

kevva avatar kevva commented on May 21, 2024

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

The readme is pretty clear to me.

from xo.

sindresorhus avatar sindresorhus commented on May 21, 2024

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

from xo.

joakimbeng avatar joakimbeng commented on May 21, 2024

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

from xo.

sindresorhus avatar sindresorhus commented on May 21, 2024

@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: standard/standard#216 (comment) As you can see, XO is a lot stricter. My personal preference is strict non-ambiguous readable code.

from xo.

joakimbeng avatar joakimbeng commented on May 21, 2024

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

from xo.

therealklanni avatar therealklanni commented on May 21, 2024

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!

from xo.

Qix- avatar Qix- commented on May 21, 2024

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

from xo.

therealklanni avatar therealklanni commented on May 21, 2024

@Qix- I was referring to Standard:

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

from xo.

Qix- avatar Qix- commented on May 21, 2024

@therealklanni Aha gotcha.

from xo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.