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.

bracketSpacing doesn't add spaces within JSX codeblocks

See original GitHub issue

Prettier v0.19.0 with bracketSpacing enabled:

function Foo() {
  return (
    <div>
      {foo &&
        <p>some very long text here so we can see it wrapped, lol lol lol.</p>}
    </div>
  );
}

Call me picky but I’d expect something like this:

function Foo() {
  return (
    <div>
      { foo &&
        <p>some very long text here so we can see it wrapped, lol lol lol.</p> }
    </div>
  );
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
vramanacommented, Feb 24, 2017

{expression} in JSX is similar to (expresson) in JS. Along this line of argument, there shouldn’t be spaces around expression surrounded by {}.

2reactions
jlongstercommented, Feb 24, 2017

Do we want this? bracketSpacing was only intended to object/array literals mainly. It doesn’t mean unconditional spaces. I’ve honestly never seen JSX written that way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to put space after open the curly braces
Hello, is the first time when i use codeblocks and i have a problem. When ai write a code and i open curly...
Read more >
Options - Prettier
(Tabs will be used for indentation but Prettier uses spaces to align things, such as in ternaries.) Semicolons. Print semicolons at the ends...
Read more >
VS Code - Code Formatting space before curly braces
If you have a .prettierrc file, you can set bracket spacing property to true module.
Read more >
fs_prettier - npm
Start using fs_prettier in your project by running `npm i fs_prettier`. ... “I always put spaces in the wrong place, now I don't...
Read more >
How To Customize ESLint Rules with an Ejected Create React ...
Sadly you can't integrate Prettier, change rules to fit your team's style and you're locked into the version Create React App deems as...
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