question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid syntax output when a

See original GitHub issue

When prettier v0.14.1 is executed on the following code:

var obj = {
  // comment here
};

It converts it to this, causing a syntax error:

var obj = {
  // comment here};

I use this pattern in example js files where I describe a function’s options object and default values, without actually specifying any. For example:

var textToSpeech = new TextToSpeechV1({
  // if left unspecified here, the SDK will fall back to the TEXT_TO_SPEECH_USERNAME and TEXT_TO_SPEECH_PASSWORD
  // environment properties, and then Bluemix's VCAP_SERVICES environment property
  //username: 'INSERT YOUR USERNAME FOR THE SERVICE HERE',
  //password: 'INSERT YOUR PASSWORD FOR THE SERVICE HERE'
});

https://github.com/watson-developer-cloud/node-sdk/blob/9943a1b936e686fddc15ce17a7b8a7d1de5994b4/examples/text_to_speech.v1.js#L6

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
vjeuxcommented, Feb 2, 2017

And, it’s live

0reactions
vjeuxcommented, Feb 3, 2017

I’m going to close this, as the original issue has been fixed!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid Syntax in Python: Common Reasons for SyntaxError
If the interpreter can't parse your Python code successfully, then this means that you used invalid syntax somewhere in your code. The interpreter...
Read more >
Python print statement “Syntax Error: invalid syntax” [duplicate]
In Python 3 print "Hello world" gives invalid syntax error. To display string content in Python3 have to use this ("Hello world") brackets....
Read more >
How to Fix Invalid SyntaxError in Python - Rollbar
The Python SyntaxError occurs when the interpreter encounters invalid syntax in code. When Python code is executed, the interpreter parses ...
Read more >
SyntaxError in Python: How to Handle Invalid Syntax in Python
In this tutorial, I will teach you how to handle SyntaxError in Python, including numerous strategies for handling invalid syntax in Python.
Read more >
SyntaxError: invalid syntax - Python Morsels
Python's "invalid syntax" error message comes up often, especially when you're first learning Python. What usually causes this error and how can you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found