# prettierx

> prettierX - a less opinionated fork of the Prettier code formatter

Latest version **0.19.0** (published 2021-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install prettierx
pnpm add prettierx
yarn add prettierx
bun add prettierx
```

Provides the command `prettierx`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: insecure dependencies; abandoned.

## Facts

| | |
|---|---|
| Version | 0.19.0 |
| Published | 2021-07-06 |
| First published | 2019-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.17.0 |
| Dependencies | 64 |
| Unpacked size | 1021 KB |
| Known vulnerabilities | 0 (+22 in 8 direct dependencies) |
| Install scripts | no |
| GitHub stars | 214 |
| Maintainers | brodybits |

## Links

- npm: https://www.npmjs.com/package/prettierx
- Repository: https://github.com/brodybits/prettierx
- Issues: https://github.com/brodybits/prettierx/issues
- npm.io page: https://npm.io/package/prettierx

## Dependencies (64)

- [mem](https://npm.io/package/mem.md) 8.1.1
- [diff](https://npm.io/package/diff.md) 5.0.0
- [chalk](https://npm.io/package/chalk.md) 4.1.1
- [json5](https://npm.io/package/json5.md) 2.2.0
- [leven](https://npm.io/package/leven.md) 3.1.0
- [espree](https://npm.io/package/espree.md) 7.3.1
- [globby](https://npm.io/package/globby.md) 11.0.4
- [ignore](https://npm.io/package/ignore.md) 4.0.6
- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [semver](https://npm.io/package/semver.md) 7.3.5
- [vnopts](https://npm.io/package/vnopts.md) 1.0.2
- [ci-info](https://npm.io/package/ci-info.md) 3.2.0
- [dashify](https://npm.io/package/dashify.md) 2.0.0
- [esutils](https://npm.io/package/esutils.md) 2.0.3
- [graphql](https://npm.io/package/graphql.md) 15.5.1
- [meriyah](https://npm.io/package/meriyah.md) 4.1.5
- [outdent](https://npm.io/package/outdent.md) 0.8.0
- [postcss](https://npm.io/package/postcss.md) 8.3.5
- [resolve](https://npm.io/package/resolve.md) 1.20.0
- [unified](https://npm.io/package/unified.md) 9.2.1
- [wcwidth](https://npm.io/package/wcwidth.md) 1.0.1
- [minimist](https://npm.io/package/minimist.md) 1.2.5
- [camelcase](https://npm.io/package/camelcase.md) 6.2.0
- [cjk-regex](https://npm.io/package/cjk-regex.md) 2.0.1
- [fast-glob](https://npm.io/package/fast-glob.md) 3.2.6
- [get-stdin](https://npm.io/package/get-stdin.md) 8.0.0
- [minimatch](https://npm.io/package/minimatch.md) 3.0.4
- [strip-ansi](https://npm.io/package/strip-ansi.md) 6.0.0
- [@iarna/toml](https://npm.io/package/@iarna/toml.md) 2.2.5
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) 7.0.0
- [html-styles](https://npm.io/package/html-styles.md) 1.0.0
- [n-readlines](https://npm.io/package/n-readlines.md) 1.0.1
- [regexp-util](https://npm.io/package/regexp-util.md) 1.2.2
- [remark-math](https://npm.io/package/remark-math.md) 3.0.1
- [editorconfig](https://npm.io/package/editorconfig.md) 0.15.3
- [parse-srcset](https://npm.io/package/parse-srcset.md) github:ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee
- [postcss-less](https://npm.io/package/postcss-less.md) 4.0.1
- [postcss-scss](https://npm.io/package/postcss-scss.md) 3.0.2
- [string-width](https://npm.io/package/string-width.md) 4.2.2
- [@babel/parser](https://npm.io/package/@babel/parser.md) 7.14.7
- [jest-docblock](https://npm.io/package/jest-docblock.md) 27.0.6
- [unicode-regex](https://npm.io/package/unicode-regex.md) 3.0.0
- [html-tag-names](https://npm.io/package/html-tag-names.md) 1.1.5
- [@glimmer/syntax](https://npm.io/package/@glimmer/syntax.md) 0.80.0
- [find-parent-dir](https://npm.io/package/find-parent-dir.md) 0.3.1
- [remark-footnotes](https://npm.io/package/remark-footnotes.md) 2.0.0
- [@angular/compiler](https://npm.io/package/@angular/compiler.md) 12.0.5
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) 7.14.5
- [lines-and-columns](https://npm.io/package/lines-and-columns.md) 1.1.6
- [yaml-unist-parser](https://npm.io/package/yaml-unist-parser.md) 1.3.1
- [html-void-elements](https://npm.io/package/html-void-elements.md) 1.0.5
- [linguist-languages](https://npm.io/package/linguist-languages.md) 7.15.0
- [angular-html-parser](https://npm.io/package/angular-html-parser.md) 1.8.0
- [please-upgrade-node](https://npm.io/package/please-upgrade-node.md) 3.2.0
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) 4.0.0
- [angular-estree-parser](https://npm.io/package/angular-estree-parser.md) 2.4.0
- [postcss-values-parser](https://npm.io/package/postcss-values-parser.md) 2.0.1
- [@brodybits/remark-parse](https://npm.io/package/@brodybits/remark-parse.md) 8.0.5
- [html-element-attributes](https://npm.io/package/html-element-attributes.md) 2.3.0
- [postcss-selector-parser](https://npm.io/package/postcss-selector-parser.md) 2.2.3
- [editorconfig-to-prettier](https://npm.io/package/editorconfig-to-prettier.md) 0.2.0
- [fast-json-stable-stringify](https://npm.io/package/fast-json-stable-stringify.md) 2.1.0
- [postcss-media-query-parser](https://npm.io/package/postcss-media-query-parser.md) 0.2.3
- [@typescript-eslint/typescript-estree](https://npm.io/package/@typescript-eslint/typescript-estree.md) 4.28.2

## Recent versions

- 0.19.0 (latest) — 2021-07-06
- 0.18.3 — 2021-06-30
- 0.18.2 — 2021-06-15
- 0.18.1 — 2021-06-03
- 0.18.0 — 2021-04-13
- 0.17.0 — 2021-02-02
- 0.16.1 — 2021-01-27
- 0.16.0 — 2021-01-18
- 0.15.0 — 2021-01-14
- 0.14.3 — 2020-12-27
- 0.14.2 — 2020-12-27
- 0.14.0 — 2020-08-11
- 0.13.1 — 2020-07-26
- 0.13.0 — 2020-07-22
- 0.12.1 — 2020-07-14
- … 22 more at https://npm.io/package/prettierx/versions

## README

# prettierX - a less opinionated fork of Prettier

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
[![npm](https://img.shields.io/npm/v/prettierx.svg)](https://www.npmjs.com/package/prettierx)

An unofficial fork of the Prettier code formatter, intended to provide some additional options to help improve consistency with ["Standard JS"](https://standardjs.com/) ([`feross/standard`](https://github.com/standard/standard)) and [`Flet/semistandard`](https://github.com/Flet/semistandard). This fork is an attempt to pick up where [`arijs/prettier-miscellaneous`](https://github.com/arijs/prettier-miscellaneous) left off.

## prettierX as a Prettier plugin

[`prettier-plugin-x`](https://www.npmjs.com/package/prettier-plugin-x) - provides the additional formatting options in a prettier plugin

## CLI Usage

**Quick CLI usage:**

```sh
prettierx <options> <file(s)>
```

## Additional prettierX options

- `--align-object-properties` (`alignObjectProperties: true`): Align colons in multiline object literals (not applied with any of the JSON parsers).
- `--offset-ternary-expressions` (`offsetTernaryExpressions: true`): Indent and align ternary expression branches more consistently with "Standard JS" (similar to the corresponding eslint option).
- `--space-before-function-paren` (`spaceBeforeFunctionParen: true`): Put a space before function parenthesis in all declarations (similar to the corresponding eslint option). (Default is to put a space before function parenthesis for untyped anonymous functions only.)
- `--generator-star-spacing` (`generatorStarSpacing: true`): Put spaces around the star (`*`) in generator functions (before and after - similar to the corresponding eslint option). (Default is after only.)
- `--yield-star-spacing` (`yieldStarSpacing: true`): Put spaces around the star (`*`) in `yield*` expressions (before and after - similar to the corresponding eslint option). (Default is after only.)
- `--no-indent-chains` (`indentChains: false`): Disable indents at the start of chained calls.
- `--break-before-else` (`breakBeforeElse: true`): Always add a line break before else.
- <code>--import-formatting <auto&#124;oneline></code> (<code>importFormatting: "<auto&#124;oneline>"</code>): Formatting of import statements, may be `oneline` to avoid conflict with VSCode "Organize Imports" feature.
- `--html-void-tags` (`htmlVoidTags: true`): Format void HTML elements as void tags.
- `--break-long-method-chains` (`breakLongMethodChains: true`): Break method chains with more than 3 method calls, like Prettier 1.x.
- `--array-bracket-spacing` (`arrayBracketSpacing: true`): Put spaces between array brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.
- `--css-paren-spacing` (`cssParenSpacing: true`): Put spaces between parens in CSS, WordPress style. Status: experimental, with limited testing.
- `--computed-property-spacing` (`computedPropertySpacing: true`): Put spaces between computed property brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.",
- `--space-in-parens` (`spaceInParens: true`): Print spaces in between parens, WordPress style (similar to the corresponding eslint option). Not recommended in combination with the default `arrowParens: "always"` option. Status: experimental, with limited testing.
- `--space-unary-ops` (`spaceUnaryOps: true`): Put spaces after unary operator symbols, except in the middle of `!!` (similar to the corresponding eslint option). Status: experimental, with limited testing.
- `--template-curly-spacing` (`templateCurlySpacing: true`): Put spaces between template curly brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.
- `--type-angle-bracket-spacing` (`typeAngleBracketSpacing: true`): Put spaces between type angle brackets. Status: experimental, with limited testing.
- `--type-bracket-spacing` (`typeBracketSpacing: true`): Put spaces between type brackets. Status: experimental, with limited testing.
- `--no-export-curly-spacing` (`exportCurlySpacing: false`): Put or disable spaces between export curly braces.
- `--no-import-curly-spacing` (`importCurlySpacing: false`): Put or disable spaces between import curly braces.
- `--no-object-curly-spacing` (`objectCurlySpacing: false`): Disable spaces between object curly braces (similar to the corresponding eslint option).
- `--no-graphql-curly-spacing` (`graphqlCurlySpacing: false`): Disable spaces between curly braces for GraphQL.
- `--no-yaml-bracket-spacing` (`yamlBracketSpacing: false`): Disable spaces between brackets / curly braces for YAML.
- `--no-type-curly-spacing` (`typeCurlySpacing: false`): Disable spaces between type curly braces.

(See [`docs/options.md`](docs/options.md) for more information.)

## "Standard JS" formatting options

The following options should be used to _format_ the code _as consistently as possible_ with ["Standard JS"](https://standardjs.com/):

- `--arrow-parens avoid` (`arrowParens: "avoid"`)
- `--generator-star-spacing` (`generatorStarSpacing: true`)
- `--space-before-function-paren` (`spaceBeforeFunctionParen: true`)
- `--single-quote` (`singleQuote: true`)
- `--jsx-single-quote` (`jsxSingleQuote: true`)
- `--no-semi` (`semi: false`)
- `--offset-ternary-expressions` (`offsetTernaryExpressions: true`)
- `--yield-star-spacing` (`yieldStarSpacing: true`)
- `--trailing-comma none` (`trailingComma: "none"`)

Note that this tool does **not** follow any of the other ["Standard JS"](https://standardjs.com/) rules. It is recommended to use this tool together with eslint, in some form, to archive correct formatting according to ["Standard JS"](https://standardjs.com/).

Any known conflicts with ["Standard JS"](https://standardjs.com/) will be tracked in [open issues with the `conflict-with-standard` tag](https://github.com/brodybits/prettierx/issues?q=is%3Aissue+label%3Aconflict-with-standard+is%3Aopen).

## some recommended options

- `--arrow-parens avoid` (`arrowParens: "avoid"`), especially in combination with `--space-in-parens` (`spaceInParens: true`).
- `--break-long-method-chains` (`breakLongMethodChains: true`)
- `--offset-ternary-expressions` (`offsetTernaryExpressions: true`)

## options removed

- `--no-align-ternary-lines` - replaced with: `--offset-ternary-expressions`
- `--paren-spacing` - replaced with finer-grained options:
  - `--array-bracket-spacing`
  - `--css-paren-spacing`
  - `--computed-property-spacing`
  - `--space-in-parens`
  - `--space-unary-ops`
  - `--template-curly-spacing`
  - `--type-angle-bracket-spacing`
  - `--type-bracket-spacing`
- `no-bracket-spacing` - replaced with finer-grained options:
  - `--no-export-curly-spacing`
  - `--no-import-curly-spacing`
  - `--no-object-curly-spacing`
  - `--no-graphql-curly-spacing`
  - `--no-yaml-bracket-spacing`
  - `--no-type-curly-spacing`

<!-- - FUTURE TBD prettierx vs prettier (???):
## Prettier 2.0

This is the branch containing code for Prettier’s 2.0 release. See [the `master` branch](https://github.com/prettier/prettier) for the 1.x code/docs.

---

![Prettier Banner](https://raw.githubusercontent.com/prettier/prettier-logo/master/images/prettier-banner-light.png)

<h2 align="center">Opinionated Code Formatter</h2>

<p align="center">
  <em>
    JavaScript
    · TypeScript
    · Flow
    · JSX
    · JSON
  </em>
  <br />
  <em>
    CSS
    · SCSS
    · Less
  </em>
  <br />
  <em>
    HTML
    · Vue
    · Angular
  </em>
  <br />
  <em>
    GraphQL
    · Markdown
    · YAML
  </em>
  <br />
  <em>
    <a href="https://prettier.io/docs/en/plugins.html">
      Your favorite language?
    </a>
  </em>
</p>

<p align="center">
  <a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amain">
    <img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Prod?label=Prod&style=flat-square"></a>
  <a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amain">
    <img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Dev?label=Dev&style=flat-square"></a>
  <a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amain">
    <img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Lint?label=Lint&style=flat-square"></a>
  <a href="https://codecov.io/gh/prettier/prettier">
    <img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
  <a href="https://twitter.com/acdlite/status/974390255393505280">
    <img alt="Blazing Fast" src="https://img.shields.io/badge/speed-blazing%20%F0%9F%94%A5-brightgreen.svg?style=flat-square"></a>
  <br/>
  <a href="https://www.npmjs.com/package/prettier">
    <img alt="npm version" src="https://img.shields.io/npm/v/prettier.svg?style=flat-square"></a>
  <a href="https://www.npmjs.com/package/prettier">
    <img alt="weekly downloads from npm" src="https://img.shields.io/npm/dw/prettier.svg?style=flat-square"></a>
  <a href="#badge">
    <img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
  <a href="https://gitter.im/jlongster/prettier">
    <img alt="Chat on Gitter" src="https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square"></a>
  <a href="https://twitter.com/PrettierCode">
    <img alt="Follow Prettier on Twitter" src="https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier&style=flat-square"></a>
</p>
- -->

<!-- FUTURE TBD improved description of feature from WordPress Prettier fork somewhere:
## WordPress Prettier

This is a fork of Prettier that adds a new command line option `--paren-spacing` which inserts many extra spaces inside parentheses, the way how projects in the WordPress ecosystem (Calypso, Gutenberg, etc.) like to format their code.
- -->

<!-- - FUTURE TBD prettierx vs prettier (???):
In order to install a version based on a particular upstream version (like 1.x.x), run
```sh
npm i --save-dev "git+https://github.com/Automattic/wp-prettier.git#wp-prettier-1.x.x"
```
To figure out what the latest supported version of the fork is, look at the default branch of this repository.

The original readme continues unchanged below:

## Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
- --
- -->

### Input

<!-- prettier-ignore -->
```js
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
```

### Output

```js
foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne()
);
```

<!-- - FUTURE TBD prettierx vs prettier (???):
Prettier can be run [in your editor](http://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
- -->

## Integration with eslint

A couple packages by [@aMarCruz (Alberto Martínez)](https://github.com/aMarCruz):

- [`eslint-plugin-prettierx`](https://www.npmjs.com/package/eslint-plugin-prettierx)
- [`eslint-config-standardized`](https://www.npmjs.com/package/eslint-config-standardize)

<!-- -- --- -- -->

<!-- - FUTURE TBD prettierx vs prettier (???):
**[Documentation](https://prettier.io/docs/en/)**
- -->

<!-- prettier-ignore -->
<!-- - FUTURE TBD prettierx vs prettier (???):
[Install](https://prettier.io/docs/en/install.html) ·
[Options](https://prettier.io/docs/en/options.html) ·
[CLI](https://prettier.io/docs/en/cli.html) ·
[API](https://prettier.io/docs/en/api.html)

**[Playground](https://prettier.io/playground/)**
- -->

---

<!-- - FUTURE TBD prettierx vs prettier (???):
## Badge

Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

```md
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
```
- -->

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

---
_Source: https://npm.io/package/prettierx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
