An open API service indexing awesome lists of open source software.

https://github.com/qpwo/prettier-no-jsx-parens

prettier disable parens around jsx and tsx!
https://github.com/qpwo/prettier-no-jsx-parens

formatter prettier react typescript

Last synced: 8 months ago
JSON representation

prettier disable parens around jsx and tsx!

Awesome Lists containing this project

README

          

# prettier-no-jsx-parens

Prettier without so many parenthesis in jsx/tsx. Not perfect but decent. Seems to work fine with a global or a local install in my testing.

## Example comparison

```jsx
// prettier-no-jsx-parens:
function User({ username }) {
return <>
User:
{username}
>;
}

// regular prettier:
function User({ username }) {
return (
<>
User:
{username}
>
);
}
```

## Installation

```bash
npm i --save-dev prettier-no-jsx-parens
yarn add --dev prettier-no-jsx-parens
```

Then in your `package.json`:

```json
{
"scripts": {
"fmt": "prettier-no-jsx-parens -w -l ."
}
}
```

```bash
echo 'alias prettier="prettier-no-jsx-parens"' >> ~/.bashrc
# or
echo 'alias prettier="prettier-no-jsx-parens"' >> ~/.zshrc
```

## Vscode setting

In your settings.json add

```json
"prettier.prettierPath": "global-or-local-folder/node_modules/prettier-no-jsx-parens/"
```