Skip to content
less opinionated code formatter fork of prettier
JavaScript CSS TypeScript HTML Other
Branch: dev
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.azure-pipelines Start JSDoc type linting (#6770) Nov 2, 2019
bin Update bin & usageSummary for prettierx Jan 2, 2019
changelog_unreleased Release 1.19.1 Nov 9, 2019
docs [prettierx] Merge tag '1.19.1' of https://github.com/prettier/prettier Nov 20, 2019
scripts [prettierx] Merge commit '1a419c0ddff61a70321c168f47e91ce0ca582340' of Nov 20, 2019
src [prettierx] add test & fix for wrong space in typescript generic func… Nov 25, 2019
tests [prettierx] add test & fix for wrong space in typescript generic func… Nov 25, 2019
tests_config [prettierx] fix tests_config/require_standalone.js Jan 6, 2019
tests_integration Update jest to 24.9.0 and jest-junit to 10.0.0 Jan 8, 2020
website [prettierx] Merge tag '1.19.1' of https://github.com/prettier/prettier Nov 20, 2019
.codecov.yml Improve coverage and remove some dead code (#2504) Jul 17, 2017
.eslintignore Introduce Release script (#4631) Jun 5, 2018
.eslintrc.yml [prettierx] Merge tag '1.19.0' of https://github.com/prettier/prettier Nov 20, 2019
.flowconfig Build the dist/ with rollup (#1794) May 29, 2017
.gitattributes fix: get rid of CRLF (#5494) Dec 8, 2018
.gitignore
.ignore fix: Adjacent JSX elements should be allowed in mdx (#6332) Jul 29, 2019
.pre-commit-hooks.yaml docs(blog): 1.15 release (#5296) Nov 7, 2018
.prettierignore set up cspell (#6684) Oct 24, 2019
.prettierrc Add empty .prettierrc to project root (#6125) May 15, 2019
.yarnrc chore(yarn): disable integrity migration Oct 27, 2018
CHANGELOG.md
CODE_OF_CONDUCT.md Add a code of conduct (#5891) Feb 22, 2019
CONTRIBUTING.md Add basic instructions on how to run Prettier locally for debugging. … Oct 20, 2019
LICENSE [prettierx] update LICENSE for @brodybits Feb 25, 2019
README.md [prettierx] document new plugins for Prettier Nov 20, 2019
azure-pipelines.yml [prettierx] Merge commit '1a419c0ddff61a70321c168f47e91ce0ca582340' of Nov 20, 2019
commands.md Add a new `trim` command to trim whitespaces in the current line (#4772) Oct 6, 2018
cspell.json [prettierx] Merge tag '1.19.1' of https://github.com/prettier/prettier Nov 20, 2019
index.js refactor: move index.js and standalone.js to src (#5054) Sep 6, 2018
jest.config.js tests_config/require_{ prettier -> prettierx }.js Jan 3, 2019
package.json Bump @babel/parser from 7.7.3 to 7.7.7 (#92) Jan 8, 2020
standalone.js refactor: move index.js and standalone.js to src (#5054) Sep 6, 2018
tsconfig.json Start JSDoc type linting (#6770) Nov 2, 2019
yarn.lock Bump @babel/parser from 7.7.3 to 7.7.7 (#92) Jan 8, 2020

README.md

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.18.0.

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

prettierx as a Prettier plugin

Provides the additional formatting options in a prettier plugin (or two).

Status: experimental

Major TODO items:

  • support option to use Babel parser to parse TypeScript ref: brodybits/prettierx#54
  • support the additional formatting options from the command line, somehow

ref: brodybits/prettierx#8

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.
paren spacing false --paren-spacing parenSpacing: <bool> Print spaces between parens, WordPress style.

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.

You can’t perform that action at this time.