Mark Uivari
Mark Uivari

Reputation: 295

Configure Prettier Whitespaces in React Typescript

I use prettier for formatting my code. How can I configure prettier to add a space depending on curly braces in react code?

Current code:

<AdminPanel
    theme={myTheme}
    dataProvider={dataProvider}
    authProvider={authProvider}
    history={history}
/>

Expected result:

<AdminPanel
    theme={ myTheme }
    dataProvider={ dataProvider }
    authProvider={ authProvider }
    history={ history }
/>

Upvotes: 12

Views: 17180

Answers (1)

Michael Wallace
Michael Wallace

Reputation: 432

The option bracket-spacing is what you are looking for: bracketSpacing: true.

https://prettier.io/docs/en/options.html#bracket-spacing

Upvotes: 8

Related Questions