Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettierx

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettierx

prettierx - less opinionated code formatter fork of prettier

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27K
increased by53.06%
Maintainers
1
Weekly downloads
 
Created
Source

prettierx - less opinionated code formatter fork of prettier

License: MIT 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 with old language parsers deprecated as if this were prettier version 1.16.4 / 1.17.0-dev, INCLUDING HTML LWC Parser to support unquoted interop attributes in Lightning Web Components (prettier/prettier#5800)

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

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

CLI Usage

Quick CLI usage:

prettierx <options> <file(s)>

Additional prettierx options

OptionDefault valueCLI OverrideAPI OverrideDescription
Align object propertiesfalse--align-object-propertiesalignObjectProperties: <bool>Align colons in multiline object literals (not applied with any of the JSON parsers).
Space before function parenthesesfalse--space-before-function-parenspaceBeforeFunctionParen: <bool>Put a space before function parenthesis.
Spaces around the star (*) in generator functionsfalse--generator-star-spacinggeneratorStarSpacing: <bool>Add spaces around the star (*) in generator functions (before and after - from eslint).
Spaces around the star (*) in yield* expressionsfalse--yield-star-spacingyieldStarSpacing: <bool>Add spaces around the star (*) in yield* expressions (before and after - from eslint).
Indent chainstrue--no-indent-chainsindentChains: <bool>Print indents at the start of chained calls.
Align ternary linestrue--no-align-ternary-linesalignTernaryLines: <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.

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.

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.

FAQs

Package last updated on 09 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc