qpwo/prettier-no-jsx-parens


prettier disable parens around jsx and tsx!

https://www.npmjs.com/package/prettier-no-jsx-parens

License: MIT

Language: JavaScript

Keywords: formatter, prettier, react, typescript


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

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

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

Installation

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

Then in your package.json:

{
  "scripts": {
    "fmt": "prettier-no-jsx-parens -w -l ."
  }
}
echo 'alias prettier="prettier-no-jsx-parens"' >> ~/.bashrc
# or
echo 'alias prettier="prettier-no-jsx-parens"' >> ~/.zshrc

Vscode setting

In your settings.json add

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

Project Statistics

Sourcerank 5
Repository Size 110 MB
Stars 2
Forks 0
Watchers 1
Open issues 0
Dependencies 0
Contributors 433
Tags 110
Created
Last updated
Last pushed

Top Contributors See all

fisker Cheung dependabot[bot] renovate[bot] Christopher Chedeau SUZUKI Sosuke Ika Lucas Duailibe Georgii Dolzhykov Lucas Azzola James Long Simon Lydell evilebottnawi Joseph Frazier Brian Ng Lipis Jed Fox Lily Skye Cyrille David Davy Duperron Alex Rattray

Packages Referencing this Repo

prettier-no-jsx-parens
Prettier but without the jsx parens
Latest release 3.4.0 - Updated - 2 stars

Recent Tags See all

2.5.1 December 04, 2021
2.5.0 November 25, 2021
2.4.1 September 16, 2021
2.4.0 September 09, 2021
2.3.2 June 26, 2021
2.3.1 June 05, 2021
2.3.0 May 09, 2021
2.2.1 November 28, 2020
2.2.0 November 20, 2020
2.1.2 September 16, 2020
2.1.1 August 26, 2020
2.1.0 August 24, 2020
2.0.5 April 21, 2020
2.0.4 April 06, 2020
2.0.3 April 05, 2020

Something wrong with this page? Make a suggestion

Last synced: 2024-06-27 02:28:49 UTC

Login to resync this repository