max-mapper / standard-format

converts your code into Standard JavaScript Format
264 stars 59 forks source link

SyntaxError: Unexpected token #161

Closed ValentinH closed 7 years ago

ValentinH commented 8 years ago

When I run standard-format on my project sources, I get myFile.js: SyntaxError: Unexpected token (300:58). Is this a bug of the library or my code that contains something wrong?

If it's due to my code, how can I find the line that breaks? The line corresponding to 300:58 doesn't have any problems and if I remove it, I still get the error.

ValentinH commented 8 years ago

I found the problem, standard-format throw the SyntaxError for this kind of code:

if (test === 1)
    console.log('ok')
else {
    console.log('ko')
}

I know that this is not standard, but this should just be flagged as incorrect or be corrected directly.

feross commented 7 years ago

You should use standard --fix instead of this package. standard-format isn't being actively maintained anymore.