Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard allows different style for ifs #266

Closed
ghost opened this issue Sep 21, 2015 · 6 comments

Comments

@ghost
Copy link

commented Sep 21, 2015

This is standard:

if (1) { } else { }

This is also standard:

if (1) { }else { }

I prefer the former, my coworker prefers the latter. Can't (shouldn't?) standard make us stop fighting? :)

@julien-f

This comment has been minimized.

Copy link

commented Sep 21, 2015

Yes, standard makes all of us stop fighting because it chooses for us to avoid unnecessary debates over trivial things. :)

@ghost

This comment has been minimized.

Copy link
Author

commented Sep 21, 2015

Yes? :)

@julien-f

This comment has been minimized.

Copy link

commented Sep 21, 2015

My bad, I did not understand the issue ^^

I think the first one is the most commonly used and, if one should ever been enforced, that will be it!

@rstacruz

This comment has been minimized.

Copy link
Member

commented Sep 21, 2015

if (1) { }else { }
my coworker prefers the latter.

oh god. why?

@dcousens dcousens added the bug label Sep 21, 2015

@dcousens

This comment has been minimized.

Copy link
Member

commented Sep 21, 2015

if (1) { }else { }

I've never seen that documented as being acceptable, and in fact it'd be my understanding that this is in fact a bug.

@feross ?

@feross

This comment has been minimized.

Copy link
Member

commented Sep 21, 2015

If you use the latest standard 5.3.1, if (1) { }else { } is an error.

  /Users/feross/code/standard/standard/t.js:1:11: Missing space before keyword "else".

Try reinstalling standard and give it another shot. 👍

@feross feross closed this Sep 21, 2015

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.