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.

[MemberExpression] Missing parenthesis for object expressions and method calls

See original GitHub issue
({}.a().b());
({}).a().b();

outputs

{}.a().b();
{}.a().b();

which is invalid

https://jlongster.github.io/prettier/#{"content"%3A"({}.a().b())%3B%5Cn(%7B%7D).a().b()%3B%5Cn%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3Afalse%2C%22bracketSpacing%22%3Atrue%7D%7D

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
yamafaktorycommented, Jan 16, 2017

@vjeux I will create a PR for the second case in few minutes!

0reactions
jlongstercommented, Jan 16, 2017

Ah, I thought the member lookup would disambiguate it. I’ve dealt with that behavior behavior before but thought it was clear here. Gotcha, makes sense!

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript function call expression for object member functions
Parentheses act as syntactic grouping mechanisms, but they don't do anything in the semantic interpretation/evaluation of expressions.
Read more >
calling a method with parenthesis vs. no ... - Codecademy
So I keep running into this problem where I will call a method without parenthesis because I figure it doesn't have any parameters...
Read more >
13 ECMAScript Language: Expressions - TC39
Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma),...
Read more >
Chapter 6. Expressions - Ceylon
An expression produces a value when executed. An algorithm expressed using functions and expressions, rather than sequences of statements is often easier to ......
Read more >
prettier/CHANGELOG.md at main - GitHub
Parentheses for decorators with nested call expressions are optional for legacy decorators but they're required for decorators in the current proposal.
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