prettier-plugin-x

0.0.10 • Public • Published

prettier-plugin-x

LICENSE npm package

Use pretty printer with enhanced estree printer options from prettierX, all in a Prettier plugin.

Supported parsers:

Requires explicit configuration of parser. Recommended configuation helpers:

Recommended alternative: prettier-plugin-x-babel, with fixed use of Babel parser for ES languages JavaScript, Flow, and TypeScript.

Includes options from prettierX for improved consistency with "Standard JS" formatting, for example:

function * a () {}

console.log(typeof a)

with the following .prettierrc configuration:

{
  semi: false,
  generatorStarSpacing: true,
  spaceBeforeFunctionParen: true
}

Note that for the non-Babel x-typescript parser this plugin uses the TypeScript parser that is bundled with stock Prettier.

Installation

with Yarn (recommended):

yarn add --dev prettier-plugin-x

or with npm:

npm install --save-dev prettier-plugin-x

Sample usage

prettier --config ./sample-prettierx-prettierrc --parser=x-babel --check sample.js

with babel-ts parser:

prettier --config ./sample-prettierx-prettierrc --parser=x-babel-ts --check sample.js

or with the TypeScript parser:

prettier --config ./sample-prettierx-prettierrc --parser=x-typescript --check sample.js

with babel-flow parser:

prettier --config ./sample-prettierx-prettierrc --parser=x-babel-flow --check sample.js

Thanks and credits

  • Thanks to @prettier/plugin-php for an easy-to-understand Prettier plugin, which helped with the initial structure of this Prettier plugin.

Readme

Keywords

none

Package Sidebar

Install

npm i prettier-plugin-x

Weekly Downloads

925

Version

0.0.10

License

(MIT OR Apache-2.0)

Unpacked Size

17.2 kB

Total Files

5

Last publish

Collaborators

  • brodybits