[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:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vjeux I will create a PR for the second case in few minutes!
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!