Skip to content

bangkokjs/prettierx-0.4.x-fork

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prettierx 0.4.x archive

Please see brodybits/prettierx for new updates.

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 with old language parsers deprecated as if this were prettier version 1.16.1.

Minimum Node.js version supported: Node.js 6 - deprecated; Node.js 10 is recommended as described in: brodybits/prettierx#26

FUTURE TODO: It is desired to provide the additional formatting options in a prettier plugin as discussed in: brodybits/prettierx#37

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.
Align ternary lines true --no-align-ternary-lines alignTernaryLines: <bool> Align ternary lines in case of multiline ternery term (default behavior, which is in conflict with ESLint/StandardJS behavior). Should be disabled for consistency with ESLint/StandardJS behavior.

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)
  • --no-align-ternary-lines (alignTernaryLines: false)

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.

Any known conflicts with standard js will be tracked in open issues with the conflict-with-standard tag.

Input

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

Output

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

Integration with eslint

A couple packages by @aMarCruz (Alberto Martínez):


Contributing

See CONTRIBUTING.md.

About

Prettier fork where fixes will be proposed from

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.1%
  • CSS 7.1%
  • TypeScript 4.1%
  • HTML 3.3%
  • Other 0.4%