Skip to content

Latest commit

 

History

History
163 lines (128 loc) · 7.36 KB

README.md

File metadata and controls

163 lines (128 loc) · 7.36 KB

prettierx - less opinionated code formatter fork of prettier

NPM Build Status

Unofficial fork, intended to provide some additional options to help improve consistency with feross/standard and Flet/semistandard. This fork is an attempt to pick up where arijs/prettier-miscellaneous left off.

Language parsers are supported as if this were prettier version 1.15.3 / 1.16.0; old language parsers are deprecated as if this were prettier version 1.15.3 / 1.16.0.

Minimum Node.js version: 6

CLI Usage

Quick CLI usage:

prettierx <options> <file(s)>

Additional prettierx options

Option Default value CLI Override API Override Description
Align object properties false --align-object-properties alignObjectProperties: <bool> Align colons in multiline object literals (not applied with any of the JSON parsers).
Space before function parentheses false --space-before-function-paren spaceBeforeFunctionParen: <bool> Put a space before function parenthesis.
Spaces around the star (*) in generator functions false --generator-star-spacing generatorStarSpacing: <bool> Add spaces around the star (*) in generator functions (before and after - from eslint).
Spaces around the star (*) in yield* expressions false --yield-star-spacing yieldStarSpacing: <bool> Add spaces around the star (*) in yield* expressions (before and after - from eslint).
Indent chains true --no-indent-chains indentChains: <bool> Print indents at the start of chained calls.

standard-like formatting

The following options should be used to format the code according to standard js:

  • --generator-star-spacing (generatorStarSpacing: true)
  • --space-before-function-paren (spaceBeforeFunctionParen: true)
  • --single-quote (singleQuote: true)
  • --jsx-single-quote (jsxSingleQuote: true)
  • --no-semi (semi: false)
  • --yield-star-spacing (yieldStarSpacing: true)

Known conflict with standard in ternary returning objects (brodybits/prettierx#40)

Note that this tool does not follow any of the other standard js rules. It is recommended to use this tool together with eslint, in some form, to achive correct formatting according to standard js.

Input

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

Output

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

Contributing

See CONTRIBUTING.md.