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.

Add option for parentheses around JSX.

See original GitHub issue

I think prettier should have an option ~for TypeScript~ to omit JSX parentheses.

Instead of this:

public render(): JSX.Element {
    return (
        <div>
            <div>Hello world!</div>
        </div>
    );
}

Expected behavior:

public render(): JSX.Element {
    return <div>
        <div>Hello world!</div>
    </div>;
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:107
  • Comments:35 (6 by maintainers)

github_iconTop GitHub Comments

55reactions
DovydasNavickascommented, Nov 2, 2017

SIGNIFICANT DEMAND TOO!

51reactions
piersolenskicommented, Nov 2, 2017

SIGNIFICANT DEMAND! xD

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is it best practice to surround JSX assigned to variables ...
The usual reasons to add parentheses are either to override default operator precedence (not necessary here if the results are the same), or ......
Read more >
React, Part I: JSX Cheatsheet - Codecademy
A JSX expression that spans multiple lines must be wrapped in parentheses: ( and ) . In the example code, we see the...
Read more >
putting parentheses inside jsx breaks syntax : WEB-46905
add a parentheses to the root "div" const Test = () => ( <div>()</div> ) ... this is valid JSX - babel transpiles...
Read more >
When should I use curly braces { } and parenthesis ( ) in React?
Curly braces { } are special syntax in JSX. It is used to evaluate a JavaScript expression during compilation. A JavaScript expression can...
Read more >
Options - Prettier
JSX Quotes. Use single quotes instead of double quotes in JSX. ... However, when Prettier removes parentheses, it becomes harder to add type...
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