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

"Infix operators must be spaced" not resolved correctly by `standard --format` #227

Closed
nknapp opened this issue Aug 12, 2015 · 4 comments

Comments

@nknapp
Copy link

commented Aug 12, 2015

I have a file test-infix.js containing the file

console.log(1===2?3:4)

When I run standard --format test-infix.js, the error test-infix.js:1:20: Infix operators must be spaced is displayed and the file is modified as follows

console.log(1 === 2? 3: 4)

The same error still occurs because of the missing space between 2 and ? and between 3 and :.
The correct formatting would be (I guess)

console.log(1 === 2 ? 3 : 4)

but standard does not change the file that way

@nknapp

This comment has been minimized.

Copy link
Author

commented Aug 12, 2015

Tested with standard@5.0.2

@Flet

This comment has been minimized.

Copy link
Member

commented Aug 12, 2015

This is actually a standard-format issue, but no worries!

I just fixed it here: maxogden/standard-format@f52b384 and published standard-format 1.6.3. I also added your tests above and they are passing.

If you reinstall standard it should pull in the fixed version... can you give it a try?

@nknapp

This comment has been minimized.

Copy link
Author

commented Aug 12, 2015

I've done another test and found out that

var gt = 'a'
var x = []
gt === '>' ? x[1] : 2

is always changed to

var gt = 'a'
var x = []
gt === '>' ? x[1]: 2

Wow, that was fast. I'll try!

@nknapp

This comment has been minimized.

Copy link
Author

commented Aug 12, 2015

Verified, many thanks

@nknapp nknapp closed this Aug 12, 2015

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

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